-
Notifications
You must be signed in to change notification settings - Fork 5
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
cmake: Drop Libtool's option #243
Conversation
The `-no-undefined` is not a linker flag, rather a Libtool flag, which we do not care about.
Thanks to @m3dwards who reported this bug offline. Friendly ping @TheCharlatan :) |
Mmm, we still want this behavior for shared libs though. A quick google says we want: Or perhaps we could/should do it per-target. |
I was thinking something very similar while working on this PR. Indeed, it might seem that Libtool's |
Hmm, I'm seeing the same. Not sure why. It definitely worked at some point in the past. Yes, I think we should be using the flag when possible. I'll investigate why libtool isn't adding it on master. |
Same here: bitcoin-core/secp256k1#1556. |
I checked the libtool and AFAIU Still, people have asked for this on Linux, but it was apparently never implemented. Here's some (Bitcoin-)prehistoric conversation about this: https://gcc.gnu.org/legacy-ml/gcc-patches/2001-02/msg00305.html. See in particular this one: https://gcc.gnu.org/legacy-ml/gcc-patches/2001-02/msg00376.html
Agreed! That's precisely our issue here...
I think it's desirable to have the flag. The referenced thread mentions some issues when not linking to ld-linux explicitly, but I can't find recent mentions of this (this is >23 years ago). Gentoo also recommends it: https://wiki.gentoo.org/wiki/Project:Quality_Assurance/-Wl,-z,defs_and_-Wl,--no-allow-shlib-undefined If it really breaks something, we could still revert. edit: But I don't know what the general strategy of the CMake migration is. If the plan is to switch to CMake first while trying to touch the actual build as little as possible, then the change should be postponed. |
I do agree with you. But I cannot see any compelling reasons to mix it with the CMake migration. Shouldn't a new linker option be introduced in the master branch? |
Thanks for the deep-dive @real-or-random!
The linker/ldflags aren't used for static libs, rather ar/arflags :) Still, I'm sure this has been used/needed at some point in the past. Is it possible it's wired up for gcc+mingw? |
The Libtool's |
Ok, maybe that's it then. I guess I just assumed it did the obvious thing (adding the linker flag). But that would explain why I remembered it doing "something". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 414bdee.
I think we want this behavior, but as it's not present in master, we should start there.
What about creating a milestone here for things you want to do after CMake has been merged into master? |
Unless it's something drastic, I'd rather not delay things, where possible, until after CMake, because that's just going to widen the gap in functionality between the builds. If it's just the case of adding a new linker flag to the build, we can just do that now. |
ACK 414bdee Without this PR I would get: ld: unknown options: -no-undefined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [src/kernel/CMakeFiles/bitcoinkernel.dir/build.make:1241: src/kernel/libbitcoinkernel.dylib] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:1867: src/kernel/CMakeFiles/bitcoinkernel.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:1651: src/CMakeFiles/bitcoin-chainstate.dir/rule] Error 2
gmake: *** [Makefile:803: bitcoin-chainstate] Error 2 |
There is no gap in functionality between the builds with this PR, unless I missed something.
Yes, we can. FWIW, I opened a related PR in the secp256k1 repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 414bdee
The
-no-undefined
is not a linker flag, rather a Libtool flag, which we do not care about.