# cave show -f wxGTK:2.8::gentoo * x11-libs/wxGTK:2.8::gentoo ::gentoo 2.8.12.1* {:2.8} x11-libs/wxGTK-2.8.12.1:2.8::gentoo Description GTK+ version of wxWidgets, a cross-platform C++ GUI toolkit Homepage http://wxwidgets.org/ Herds wxwidgets Maintainers <wxwidgets@gentoo.org> (All modifications to this package must be approved by the wxwidgets herd.) Use flags X (-aqua) -debug doc gnome gstreamer -odbc opengl pch sdl tiff build_options: symbols=strip dwarf_compress -optional_tests -trace work=tidyup So far I've not seen these issues with wxGTK:2.9 - knock on wood SYMPTOM thr_setconcurrency) src/unix/threadpsx.cpp includes thread.h since configure enables.. #define HAVE_THR_SETCONCURRENCY ..when it should not (-fno-lto does not define it) #### zgrep -B 1 error.*thread.h 1366160365-install-x11-libs_wxGTK-2.8.12.1:2.8::gentoo.out.gz x86_64-pc-linux-gnu-g++ -c -o basedll_threadpsx.o -I./.pch/wxprec_basedll -D__WXGTK__ -DWXBUILDING -I/var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/src/regex -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/wx/include/gtk2-unicode-release-2.8 -I/var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/include -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/libxml2 -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DWX_PRECOMP -pthread -Wall -Wundef -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing -pthread -I/usr/include/libgnomeprintui-2.2 -I/usr/include/libgnomeprint-2.2 -I/usr/include/libxml2 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gail-1.0 -I/usr/include/libart-2.0 -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=native -pipe -O2 -mfpmath=sse -flto=4 -floop-block -floop-interchange -floop-strip-mine -fuse-linker-plugin -fno-strict-aliasing /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/src/unix/threadpsx.cpp /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/src/unix/threadpsx.cpp:51:24: fatal error: thread.h: No such file or directory SYMPTOM dlopen) dlopen without -ldl .. dlerror without -ldl .. ..is checked positive by configure when it should not (running configure with -fno-lto results in "no") #### zgrep "error\|dlopen" 1366163053-install-x11-libs_wxGTK-2.8.12.1:2.8::gentoo.out.gz checking for dlopen... yes checking for dlerror... yes x86_64-pc-linux-gnu-gcc -c -o wxregex_regerror.o -D__WXGTK__ -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/wx/include/gtk2-unicode-release-2.8 -I/var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/include -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread -I/usr/include/gstreamer-0.10 -I/usr/include/libxml2 -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread -Wall -Wundef -O2 -fno-strict-aliasing -pthread -I/usr/include/libgnomeprintui-2.2 -I/usr/include/libgnomeprint-2.2 -I/usr/include/libxml2 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gail-1.0 -I/usr/include/libart-2.0 -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng15 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -march=native -pipe -O2 -mfpmath=sse -flto=4 -floop-block -floop-interchange -floop-strip-mine -fuse-linker-plugin -fno-strict-aliasing /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/src/regex/regerror.c x86_64-pc-linux-gnu-ar rcu /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/libwxregexu-2.8.a wxregex_regcomp.o wxregex_regexec.o wxregex_regerror.o wxregex_regfree.o /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/libwx_baseu-2.8.so: error: undefined reference to 'dlopen' /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/libwx_baseu-2.8.so: error: undefined reference to 'dlsym' /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/libwx_baseu-2.8.so: error: undefined reference to 'dlerror' /var/tmp/paludis/x11-libs-wxGTK-2.8.12.1/work/wxPython-src-2.8.12.1/wxgtk_build/lib/libwx_baseu-2.8.so: error: undefined reference to 'dlclose' collect2: error: ld returned 1 exit status RESOLUTION) The AC_CHECK_FUNC and AC_CHECK_FUNCS emit a bunch of test programs and dump them into configure. These test programs are not LTO save, the function definitions do not survive the optimizer. They are stripped out and function pointer f does not get a place in the symbol table, as illustrated below with dlopen for example: -->8------------------------acsample.c #undef dlopen /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlopen (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != dlopen; ; return 0; } --8<------------------------acsample.c #### gcc -flto -O2 -o acsample acsample.c #### ./acsample && echo $? 0 #### # --> wrong result (program incomplete) #### objdump -t acsample | grep "f$" #### # --> because symbol f is missing #### vim acsample.c #### diff -ur acsample.c~ acsample.c --- acsample.c~ 2013-04-18 04:10:47.442264985 +0200 +++ acsample.c 2013-04-18 04:12:16.811141467 +0200 @@ -14,7 +14,7 @@ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else -char (*f) () = dlopen; +char (*f) () __attribute__((used)) = dlopen; #endif #ifdef __cplusplus } #### gcc -flto -O2 -o acsample acsample.c /tmp/cc0VlSzR.ltrans0.ltrans.o:cc0VlSzR.ltrans0.o:function f: error: undefined reference to 'dlopen' /tmp/cc0VlSzR.ltrans0.ltrans.o:cc0VlSzR.ltrans0.o:function main: error: undefined reference to 'dlopen' collect2: Fehler: ld gab 1 als Ende-Status zurück #### # --> correct result, this is what we want for the configure test, i.e. to fail if dlopen is not available #### # (and this is what happens in the non-lto case as well) #### objdump -t acsample | grep "f$" 0000000000401980 g O .data 0000000000000008 f #### gcc -flto -O2 -o acsample acsample.c -ldl #### # --> compiles fine, (but) this is checked in a subsequent configure test CHANGES) How do we make the whole configure file LTO save for AC_CHECK_FUNC emited programs in this case? sed to the rescue.. sed -e '/^char *(.f) *() *=/ s:():() __attribute__((used)):' -i configure ..will do. Originally I patched the function definition as well, but the above suffices: -e '/^char *\($ac_func\|[[:alnum:]]*\|(.f)\) *() *[;=]/ s:():() __attribute__((used)):' For configure test cases covered by this patch, results shouldn't differ anymore comparing -fno-lto and -flto runs. For thr_setconcurrency I backported the usage of pthread_setconcurrency from wxGTK:2.9. Please find the backport patch and ebuild patch attached. Greetings Reproducible: Always
Created attachment 345850 [details] build log thread.h error - 1366160365-install-x11-libs_wxGTK-2.8.12.1:2.8::gentoo.out.gz
Created attachment 345852 [details] build log -ldl error - 1366163053-install-x11-libs_wxGTK-2.8.12.1:2.8::gentoo.out.gz
Created attachment 345854 [details, diff] files/wxGTK-2.8.12.1-setconcurrency-backport.patch backport pthread_setconcurrency usage from 2.9*
Created attachment 345856 [details, diff] wxGTK-2.8.12.1.ebuild.patch - add sed commands to make AC_CHECK_FUNC configure tests lto save - test for pthread_setconcurrency instead of thr_setconcurrency
If wxGTK is compiled with lto (with the help of the patches here), then sci-visualization/gnuplot with wxwidgets use flag can't be linked.
While I appreciate the analysis and work you've done here, we don't support systemwide lto. It has unfortunate consequences not only when linking in other libraries but also during compiler upgrades. Maybe upstream is interested?
(In reply to comment #6) > While I appreciate the analysis and work you've done here, we don't support > systemwide lto. It has unfortunate consequences not only when linking in > other libraries but also during compiler upgrades. Maybe upstream is > interested? 'During' CC upgrades? iirc wxGTK is not part of a cc toolchain. You do not _force_ anyone to actually use it by applying the patch. You just give people the choice to more easily tinker around with it and see what goes. Gentoo is about choices, the patch does not break usual builds, so I do not understand your rejection. As for linking issue with gnuplot: I do not seem to have this issue. Compiling gnuplot with lto'd wxGTK:2.8 works here.
(In reply to comment #5) > If wxGTK is compiled with lto (with the help of the patches here), then > sci-visualization/gnuplot with wxwidgets use flag can't be linked. Can you open another bug for this and attach the build log there? I cannot seem to reproduce this, just double checked. gcc-4.8.0 ebuild says: LTO support is still experimental and unstable. Any bug reports about LTO that do not include an upstream patch will be closed as invalid. Apparently this bug fell victim to this policy. Since upstream is unlikely to patch up on released versions, as experienced previously, we'll gladly wait another one to two years until the lto playground is labeled safe to play with by the authorities. Greetings
sorry, changing state was unintentional, people should try hard to find this.
Created attachment 347688 [details, diff] wxGTK-2.8.12.1.ebuild.patch - revised patch that checks {C,CXX,LD}FLAGS for "flto" or "-O4" (clang -O4 implies flto) - build files are made lto-save depending on *FLAGS tested successfully on amd64/x86 with gcc -flto and clang -O4
(In reply to comment #8) > (In reply to comment #5) > > If wxGTK is compiled with lto (with the help of the patches here), then > > sci-visualization/gnuplot with wxwidgets use flag can't be linked. > > Can you open another bug for this and attach the build log there? Again, I cannot confirm this. Neither on amd64 nor x86. On both archs gnuplot builds fine with lto'd wxGTK:2.8 - regardless of whether it has been built using "gcc -flto" or "clang -O4". Use flags in use here # cave show -f sci-visualization/gnuplot sci-visualization/gnuplot-4.6.2-r1:0::installed Description Command-line driven interactive plotting program Homepage http://www.gnuplot.info/ From repositories gentoo Installed time Wed May 08 04:58:28 CEST 2013 Installed using paludis-1.2.0 License gnuplot GPL-2 bitmap? ( free-noncomm ) Use flags (X) (-aqua) (-bitmap) (cairo) (doc) (-emacs) (examples) (gd) (ggi) (latex) (lua) (plotutils) (qt4) (readline) (-svga) (-thin-splines) (wxwidgets) (-xemacs) build_options: -trace Upstream is unlikely to add this to 2.8 branch since it's long been released. This isn't security related, it's more a "feature" request wrt build system. Requesting a second review, see revised ebuild patch.
They still make 2.8 releases. I suppose I'll have a look at this. I just hate messing around in wxGTK's build system. It's such a mess.
Comment on attachment 347688 [details, diff] wxGTK-2.8.12.1.ebuild.patch >+ sed -e '/^for ac_func in thr_/ s:thr:pthread:' \ Is this just because of the broken eautoreconf? I'd rather backport the full patch from upstream if we can.
cmuelle8: Thank you. I really appreciate your effort on this. (I am one of that lto system wide guys.)
wxGTK:2.8 has been last rited in bug 661284, thus marking this bug here as obsolete, as presumably the referenced commit in whiteboard would be in the 3.0 versions