-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Unable to compile with LTO on Ubuntu 14.04 (with ubuntu-toolchain-r ppa) #3441
Comments
Here's what I think is going on: with LTO object files include compiler-specific intermediate representation. Your linker then has to understand this internal representation to run the optimization passes on and emit machine code in the codegen phase. That's the reason GCC ships Lines 225 to 227 in f1384f5
(and probably should fail if LTO is on and we can not detect them) @karenzshea can you investigate why you have a gcc 4.9.4 but not these gcc-specific binaries? From what I can tell Trusty has gcc 4.8 (ref.) for which we disable LTO altogether. You're probably using the ubuntu-toolchaiun-r ppa? If you scroll down to So my guess for now is you already have the gcc specific binaries but they are version-suffixed (think |
These are actually only needed for older versions of binutils as per https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ On my system using binutil 2.27 it does not matter which one is used. That is the primary reason we are not failing by default of they are not detected. I think we should just disable LTO by default for everything below gcc 5 and clang 3.8 |
I just came across #2006 - which describes exactly the problem here. This is not related to specific gcc version. Instead it's related to some distributions shipping version-suffixed tools such as |
Closing as Ubuntu 14 + export AR=gcc-ar-4.9
export NM=gcc-nm-4.9
export RANLIB=gcc-ranlib-4.9 Encoding this in the CMakeLists now. |
https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ is great to read/see @TheMarex. I'll keep a closer eye on this in the future to see what actually requires |
This disables the `-flto` LTO flag by default since we're seeing segfaults in compiler lto plugins, binutils and linker errors again and again for various clang / gcc / binutils combinations. Pass `-DNEBALE_LTO` to `cmake` in order to re-enable LTO. LTO situation in short: - LTO does not work at all for gcc<4.9 - With gcc>=4.9 the "slim" LTO format is getting used dumping IR - Older binutils need LTO plugins which know how to read this IR - Recent binutils handle this format all by themselves - LLVM is more or less the same with some Clang versions segfaulting If you need the performance benefit of LTO, make sure your compiler and binutils are up to date and see for yourself if LTO builds work for you. References: - https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ - #3481 (comment) - #3501 - #3441 (and a ton of other LTO tickets if you search for them)
This disables the `-flto` LTO flag by default since we're seeing segfaults in compiler lto plugins, binutils and linker errors again and again for various clang / gcc / binutils combinations. Pass `-DNEBALE_LTO` to `cmake` in order to re-enable LTO. LTO situation in short: - LTO does not work at all for gcc<4.9 - With gcc>=4.9 the "slim" LTO format is getting used dumping IR - Older binutils need LTO plugins which know how to read this IR - Recent binutils handle this format all by themselves - LLVM is more or less the same with some Clang versions segfaulting If you need the performance benefit of LTO, make sure your compiler and binutils are up to date and see for yourself if LTO builds work for you. References: - https://gcc.gnu.org/wiki/LinkTimeOptimizationFAQ - #3481 (comment) - #3501 - #3441 (and a ton of other LTO tickets if you search for them)
Ubuntu 14.04 has a binutils-2.26 package that can be installed alongside the distro's native binutils (which is version 2.24). Then with |
Splitting off from #3269 (comment) - this is a separate issue. @karenzshea reported seeing:
The text was updated successfully, but these errors were encountered: