-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile failure when LD=lld
or LD=gold
, but not LD=mold
or LD
(unset, using bfd)
#158
Comments
--ld-path=/bin/ld.{gold|lld}
or -fuse-ld={gold|lld}
LD=lld
or LD=gold
, but not LD=mold
or LD
(unset, using bfd)
Similar results occur with |
I hope somebody else who follows this project may be able to help you, because I can't. I presume lld, mold and gold are alternative linkers, but I know nothing about the nitty-gritty of linking. Nor am I at all knowledgeable in the autotools stuff - it was all contributed by someone who was; I've just about been able to tweak it from time to time. |
ld (bfd) is the standard binutils' linker. gold is the binutils' newer linker. lld is clang/LLVM's linker. mold is the one diverging away from FOSS going commercial with a radioactive license despite crowdfunding, so we might stop using it. My guess is both failing linkers try to create shared objects with the wrong names. strace and verbosity would be probably be able to resolve it. (Technical people doing "business" footguns.) It's a learning opportunity then. ;) Right as you rip-replace it with bazel, conan, or cmake to save your sanity. |
Learning opportunities are hard work at my age (and remembering what's been learned is another issue :-) but: I have installed lld on my Arch Linux box, and I can reproduce the failure with just "LD=lld ./configure". It isn't generating the basic shared library file. Not quite sure how to proceed, but I've no more time left today anyway. |
It's a libtool issue. When you run ./configure, it creates a script called "libtool" which it subsequently runs to do linking and library building. I ran a default ./configure (which uses ld of course) and saved the libtool file it created. Then I ran with LD=lld and compared the two files. In addition to the different linker name, there were other differences. I edited the "good" version of the script, changing /usr/bin/ld to /usr/bin/lld and ran it. It worked! I will try to find out which setting in the libtool script causes the problem and then the task will be to find out why setting LD=/usr/bin/lld has this effect. |
I have narrowed this down to one line in the libtool script. The "good" version sets a value for archive_cmds, whereas the "bad" version does not. The setting is: archive_cmds="$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib" and the comment above it is "Commands used to build a shared archive", which figures. It would appear that the code that builds the "libtool" script behaves differently when LD is not GNU ld (there's a setting for that too, but it doesn't affect the outcome). I will try to research if there is any way to alter this behaviour; if not, I suppose a bug needs reporting somewhere. |
Does using instead
|
LD=ld.lld works for me. If this is the correct way to invoke lld, it isn't a workaround! |
/usr/bin/ld.lld on my system is just a symbolic link to /usr/bin/lld and yet setting LD to the first one works, but the second does not. There must be something weird going on inside "configure". However, it appears that this issue is not PCRE2's problem. |
You generally should not be setting |
I am closing this as dealt with. |
Environment
Configuration
lld
MCE error repro (either lld or gold)
No error (either mold or ld (bfd))
Error output
Success output
Error `{{build}}/.libs/` contents
Success `{{build}}/.libs/` contents
The text was updated successfully, but these errors were encountered: