Stream: beginners

Topic: ✔ request to open pr: linker library searching


view this post on Zulip Emi (Feb 21 2022 at 01:41):

when i was getting the Roc compiler set up, I had an issue where it couldn't detect several libraries, namely the glibc and libgcc libraries. These were installed, but they were installed under /usr/lib64/, which roc wasn't checking in. foolishly, i wrote a patch to reconcile this before reading the CONTRIBUTING.md and finding out that first time contributors have to talk to an existing contributor before making their first PR. In light of this, I absolutely understand if I need to throw away or majorly rework my change, and take full responsibility for that

view this post on Zulip Emi (Feb 21 2022 at 01:44):

that said: current behavior is to check for the first library directory that exists (e.g. /usr/lib/<arch> or /usr/lib), and then look for the libraries in that directory. This means we can't just add /usr/lib64 to the list of directories, because if /usr/lib exists, it will take precedence, even if the library isn't in there
would it make sense to resolve this issue by adding a new function which, given a list of directories and a filename, produces a PathBuf containing the first instance of the matching path, or None?

view this post on Zulip Ayaz Hafiz (Feb 21 2022 at 02:16):

I would agree with that! It could be good to have a "library search path" flag like clang/gcc/etc do (-L in those cases). I think there's also value to the sensible defaults currently in place

view this post on Zulip Richard Feldman (Feb 21 2022 at 03:17):

yeah let's try to do it without the flag for now

view this post on Zulip Richard Feldman (Feb 21 2022 at 03:18):

although @Emi are you on Linux? If so, can you try building with the --roc-linker flag and see if that Just Works?

view this post on Zulip Emi (Feb 21 2022 at 03:24):

Sure! I'm about to hit the hay for tonight, but I'll give it a try in the morning!

view this post on Zulip Emi (Feb 21 2022 at 14:12):

Yes! That did fix it!

view this post on Zulip Emi (Feb 21 2022 at 14:13):

Is the roc linker meant to supersede the system linker at some point? if so, do you still want the PR?

view this post on Zulip Emi (Feb 21 2022 at 14:38):

oh although roc repl can't use --roc-linker yet anyway, so a change would be needed anyway

view this post on Zulip Richard Feldman (Feb 21 2022 at 15:21):

yeah long-term the --roc-linker flag should go away, because it'll be the only linker :big_smile:

view this post on Zulip Richard Feldman (Feb 21 2022 at 15:21):

but it currently only works on x64 linux, not yet on ARM or macOS

view this post on Zulip Richard Feldman (Feb 21 2022 at 15:21):

or Windows

view this post on Zulip Richard Feldman (Feb 21 2022 at 15:22):

although I think the Linux one is feature-complete (@Brendan Hansknecht made it, so he would know for sure!)

view this post on Zulip Richard Feldman (Feb 21 2022 at 15:22):

this is actually not the first time it's solved someone's local linking issues on Linux; it's encouraging to hear that it worked for your use case too! :tada:

view this post on Zulip Emi (Feb 21 2022 at 15:41):

Just opened up a PR!
https://github.com/rtfeldman/roc/pull/2546

view this post on Zulip Notification Bot (Feb 21 2022 at 15:41):

Emi has marked this topic as resolved.

view this post on Zulip Brendan Hansknecht (Feb 21 2022 at 16:56):

Yeah, should theoretically be feature complete, though that depends on plans for dealing with builtins for the dev backend


Last updated: Jul 06 2025 at 12:14 UTC