Open hdante opened 2 years ago
This is normal. In GCC you can pass -ffat-lto-objects
to avoid this issue, but I don't know about Clang (source).
I think that Meson should warn then the user requests both LTO and static libraries, as they can't easily coexist.
Hello, just giving a warning probably will not be enough, since LTO makes sense to build binaries in the same package. Maybe add support for enabling or disabling LTO on a per target basis ?
I think you can do that with override_options
Ok, I'll give it a try, but what about the binary targets that use the static library ? They could be compiled with LTO enabled and use the library. Would it be necessary to define a second library target for them with LTO enabled ?
I don't know, but if you figure it out please report back here as I'm curious :)
I've recently been bit by this (or something similar) on GCC as well. I wonder if meson could automatically add that flag when a build with LTO enabled includes static libraries as installable output, or possibly have an option to disable LTO for the static library.
Hello, creating a static library with clang and LTO enabled generates a static library without the target object code (only LLVM IR code). Distributing this static library to the client and trying to link the static library with some program with gcc/ld results in the following error: