-
Notifications
You must be signed in to change notification settings - Fork 79
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
Build fails with LTO #976
Comments
Unfortunately it appears that against my will, cmake is forcing it to build with LTO even when I remove it from my *FLAGS. Which means that the resulting build artifacts are still broken, and since I didn't remove |
This seems like an issue in pybind11, maybe you can report it upstream? |
The issue is a type in iminuit that clashes with a type in pybind11. It's not immediately obvious to me why that is the responsibility of pybind11. Can you clarify? |
Ok, you are right, I missed that in the error message. I am working on a fix. |
Closes #976 This fixes an ODR violation and adds more warnings regarding ODR violations to the standard build flags (which are treated as errors).
Sorry for the lateness of the reply... this didn't actually fix it for me at the time. 2.26
2.28
I cannot tell from CI whether gcc or clang is being used -- |
This is strange. In my patch, I activated strong warnings and errors in the GNU build and then fixed the issue. The issue occurs because I am overriding a template specialization of pybind11 in some translation units, which to my understanding is not UB and not a ODR violation. The compiler seems to agree. |
you need LTO for
I think this is a case of [temp.expl.spec]p7 (an instantiation of |
I only see it in compile opts, not in link opts. It is the linker stage that compares LTO bytecode across multiple TUs to perform whole-program optimization, and in the process checks whether the resulting multi-TU analysis has ODR issues or type mismatches between implementations in one file and callers in another file. (LTO gives the compiler driver another chance to detect several types of warnings that are easier to detect at link time than at compile time. -Wmaybe-uninitialized is another warning that can start showing up at link time when not originally found at compile time.) Also:
The reason I mention this is because clang has weaker diagnostics for |
Thank you for this insightful comment, that's very useful for me. I will come back to this issue, right now I am working on completing another patch. |
@henryiii You introduced uv to this repo. How can we get the compiler messages back during the package build? |
Thanks, I confirm it works for me now. |
Excellent, glad to hear it. |
The latest versions of uv (from a day or two ago) should now include streaming build output in the |
I tried to build with the following *FLAGS to optimize the build:
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
Note the -Werror=* flags are used to help detect cases where the compiler tries to optimize by assuming UB cannot exist in the source code -- if it does exist, ordinarily the code would be miscompiled, and this says to make the miscompilation a fatal error.
I got this error:
Downstream bug report: https://bugs.gentoo.org/856778
Full build log: build.log
The text was updated successfully, but these errors were encountered: