Skip to content

crystal: Set CRYSTAL_CONFIG_LIBRARY_RPATH#162182

Merged
BrewTestBot merged 2 commits intoHomebrew:masterfrom
straight-shoota:patch-3
Feb 9, 2024
Merged

crystal: Set CRYSTAL_CONFIG_LIBRARY_RPATH#162182
BrewTestBot merged 2 commits intoHomebrew:masterfrom
straight-shoota:patch-3

Conversation

@straight-shoota
Copy link
Contributor

Programs build with a crystal compiler from homebrew fail to execute because some libraries can't be located:

$ docker run --rm homebrew/ubuntu22.04
# brew install crystal
# crystal run 'puts %(hello world)'
/home/linuxbrew/.cache/crystal/crystal-run-eval.tmp: error while loading shared libraries: libgc.so.1: cannot open shared object file: No such file or directory

Note this affects the program runtime, not the compiler itself.

Binaries need to know where to find their binaries. The linker is told to look in homebrew's lib path via CONFIG_LIBRARY_PATH. But at runtime the loader doesn't have this information. It can be baked into the binary via CONFIG_LIBRARY_RPATH.

Issue report: https://forum.crystal-lang.org/t/crystal-installation-using-linuxbrew-is-not-working/6559

Copy link
Member

@p-linnane p-linnane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's so weird that it stopped working. Thanks for the fix though!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2024

🤖 An automated task has requested bottles to be published to this PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2024

⚠️ Bottle publish failed.

Programs build with a crystal compiler from homebrew fail to execute because some libraries can't be located:

```console
$ docker run --rm homebrew/ubuntu22.04
# brew install crystal
# crystal run 'puts %(hello world)'
/home/linuxbrew/.cache/crystal/crystal-run-eval.tmp: error while loading shared libraries: libgc.so.1: cannot open shared object file: No such file or directory
```

Note this affects the program runtime, not the compiler itself.

Binaries need to know where to find their binaries. The linker is told to look in homebrew's lib path via `CONFIG_LIBRARY_PATH`. But at runtime the loader doesn't have this information. It can be baked into the binary via `CONFIG_LIBRARY_RPATH`.

Issue report: https://forum.crystal-lang.org/t/crystal-installation-using-linuxbrew-is-not-working/6559
@p-linnane
Copy link
Member

Had to rebase due to an audit change we just made.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2024

🤖 An automated task has requested bottles to be published to this PR.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Feb 9, 2024
@BrewTestBot BrewTestBot enabled auto-merge February 9, 2024 22:58
@BrewTestBot BrewTestBot added this pull request to the merge queue Feb 9, 2024
Merged via the queue into Homebrew:master with commit adbbe7e Feb 9, 2024
@straight-shoota straight-shoota deleted the patch-3 branch February 10, 2024 10:45
@straight-shoota
Copy link
Contributor Author

Note: This change currently has no effect because the Crystal compiler does not respect CRYSTAL_CONFIG_LIBRARY_PATH.
I have created a PR to fix this: crystal-lang/crystal#14319

There's no harm in setting the variable and I hope it will be effective in the next Crystal release, so I don't see much reason to revert this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants