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
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?
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
yeah let's try to do it without the flag for now
although @Emi are you on Linux? If so, can you try building with the --roc-linker
flag and see if that Just Works?
Sure! I'm about to hit the hay for tonight, but I'll give it a try in the morning!
Yes! That did fix it!
Is the roc linker meant to supersede the system linker at some point? if so, do you still want the PR?
oh although roc repl
can't use --roc-linker
yet anyway, so a change would be needed anyway
yeah long-term the --roc-linker
flag should go away, because it'll be the only linker :big_smile:
but it currently only works on x64 linux, not yet on ARM or macOS
or Windows
although I think the Linux one is feature-complete (@Brendan Hansknecht made it, so he would know for sure!)
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:
Just opened up a PR!
https://github.com/rtfeldman/roc/pull/2546
Emi has marked this topic as resolved.
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