Summary: | sys-libs/ncurses-6.0-r1 failed to build with -flto -O2 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Xuefer <xuefer> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | CC: | bugs.gentoo.org, fabio.coatti, mgorny, neddyseagoon, nerdboy, sam |
Priority: | Normal | Keywords: | PATCH |
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 618550 | ||
Attachments: |
adds volatile
build.log config.log emerge --info ncurses-6.1-configure-link-test.patch ncurses-6.1-configure-link-test-upstream.patch |
Description
Xuefer
2017-01-18 03:49:18 UTC
Created attachment 460508 [details, diff]
adds volatile
Please attach the full build log and emerge --info. Created attachment 461360 [details]
build.log
Created attachment 461362 [details]
config.log
Created attachment 461364 [details]
emerge --info
log provided. please check Created attachment 526274 [details, diff] ncurses-6.1-configure-link-test.patch Version 6.1-r2 still fails with -O2 -flto: [...] checking for gpm.h... yes checking if you want to load GPM dynamically... yes checking for dlsym... yes checking whether able to link to dl*() functions... configure: error: Cannot link test program for libdl Actually, "checking for dlsym" should fail, but the configure test succeeds although the symbol is not available. Then, the check which is supposed to succeed ("checking for dlsym in -ldl") is skipped, and the last test which tries to use the dl* functions fails because it isn't linked with -ldl. The reason can be seen in the conftest source cited in comment #0. The important part is the following line: f = dlsym; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; The workaround doesn't work for gcc -O2 -flto because it's smart enough to know that the function's address must be non-null. So it optimizes out both the "if" and the assignment, and the symbol to be testes becomes unused! Upstream should really rebuild the configure script with a newer version of autotools to fix the issue. Until that happend we need yet another workaround. The attached patch works for me. I didn't add "volatile" as Xuefer suggested, but used the address as return value to ensure it won't get optimized out. *** Bug 644562 has been marked as a duplicate of this bug. *** *** Bug 578548 has been marked as a duplicate of this bug. *** I also faced the issue and found out that the reason is 'dlsym' optimized out by link time optimization Did you write an email to ncurses.org? I wrote an email to the community, waiting for an answer Guys, Thanks to Thomas E. Dickey, he has fixed the issue and provided a new version of ncurses Here the changelog is https://invisible-island.net/ncurses/NEWS.html#t20181006 We need to update ncurses in order to obtain a new fixed version Created attachment 572212 [details, diff]
ncurses-6.1-configure-link-test-upstream.patch
This is the back port of the upstream patch. I have not tested it yet. I wanted to make it available so we can get it tested and possibly added to a -r4 ebuild.
*** Bug 685186 has been marked as a duplicate of this bug. *** Seems obsolete given we're on 6.2 now? |