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 #468
Comments
The bug was originally reported with 2.63.0 which is also the latest version available in Gentoo. I cannot figure out how to try updating the package to test the new version -- perl version numbers have defeated me. But: the code with the LTO issue hasn't changed since that release anyway, so it shouldn't matter. |
PDL 2.063 was released in Nov 2021, is that what you mean by "2.63.0"? Is there some reason that Gentoo is that far behind? 2.069, released in Jan 2022, had various Fortran-module 64-bit updates (Slatec and Minuit), which is likely to have fixed this. Could you try it? Or indeed the latest PDL, either the latest released one, or the latest dev-release? |
I'm no maven when it comes to packaging perl modules, so I'm not entirely sure of the answers to any of that. However, I did figure out how to reverse engineer and reproduce it outside of the package manager. $ git clone https://github.com/PDLPorters/pdl/ && cd pdl
# no --enable-foo style flags, so edit configure options to successfully configure
$ vim perldl.conf
# Makefile.PL doesn't respect standard CFLAGS / LDFLAGS / FFLAGS, but does inject
# whatever perl itself was built with. Override some Makefile variables that aren't
# actually intended to work this way, but are inserted in the right places. In particular,
# this is egregious misuse of OPTIMIZE, but do it anyway since fortran code actually
# gets compiled with it.
$ perl Makefile.PL
$ make \
OTHERLDFLAGS="-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fstrict-aliasing" \
OPTIMIZE="-O2 -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fstrict-aliasing" It failed:
|
(cd Libtmp/Minuit/; rm minuitlib/bigun.f; (for x in minuitlib/*.f; do echo "#line 1 \"$x\""; cat $x; done) >bigun.f; mv bigun.f minuitlib/; time make test) and replace in the Makefile the OBJECT line minuitlib/*.o with minuitlib/bigun.o, and the compile line at end
Using a similar trick to #369 caught the |
Clearly you're much more of a maven than me! Thank you for the report. I don't know if this will benefit Gentoo, since they're so far behind already? |
Thanks, it gets much further. Still from my git clone: $ git clone https://github.com/PDLPorters/pdl/ && cd pdl
# no --enable-foo style flags, so edit configure options to successfully configure
$ vim perldl.conf
# Makefile.PL doesn't respect standard CFLAGS / LDFLAGS / FFLAGS, but does inject
# whatever perl itself was built with. Override some Makefile variables that aren't
# actually intended to work this way, but are inserted in the right places. In particular,
# this is egregious misuse of OPTIMIZE, but do it anyway since fortran code actually
# gets compiled with it.
$ perl Makefile.PL
$ make \
OTHERLDFLAGS="-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fstrict-aliasing" \
OPTIMIZE="-O2 -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fstrict-aliasing" Yields the following errors:
|
That last one is because a |
The remaining problem is that the FFT routines are a bit of a nightmare because they have a working array of 4-byte floats, the end of which gets used as 4-byte integers, which the LTO doesn't like. Since those routines are largely wrappers to other routines that keep the floats and integers separate, I can switch the PDL binding to just use those directly. |
Once this is all sorted, I will look at sorting out the Gentoo packaging too. Thank you very much! |
@eli-schwartz I believe the above commit fixes this. Can you confirm you agree? If you do, then @thesamesam do you need any assistance with that packaging? The latest PDL is having a problem with 32-bit (see #469), so please be aware of that. |
Re-opening so @eli-schwartz can close when it's agreed as done. |
pulling and incrementally building did not manage to recalculate the Makefiles. Doing a scratch build... |
Yes, everything compiles cleanly with LTO now. :) Thanks! |
Thank you for the report, and for your engagement! Slatec's Will Gentoo's PDL package be getting updated? |
@mohawk2 I've just updated our package to 2.087 and fixed some other lingering issues on our side so should be able to keep pace better now too. Thank you very much! |
@thesamesam Thank you right back! Please let me know if there's anything you need/want from us, and/or any other problems you spot. |
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 report: https://bugs.gentoo.org/856406
Full build log: build.log
The text was updated successfully, but these errors were encountered: