I can't compile wxGTK-3.0.0.0 because of this undefined reference to main. the relevant part is this, I think: /var/tmp/portage/x11-libs/wxGTK-3.0.0.0/work/wxPython-src-3.0.0.0/wxgtk_build/bk-make-pch ./.pch/wxprec_basedll/wx/wxprec.h.gch wx/wxprec.h x86_64-pc-linux-gnu-g++ -I./.pch/wxprec_basedll -D__WXGTK__ -DWXBUILDING -I/var/tmp/portage/x11-libs/wxGTK-3.0.0.0/work/wxPython-src-3.0.0.0/src/regex -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/var/tmp/portage/x11-libs/wxGTK-3.0.0.0/work/wxPython-src-3.0.0.0/wxgtk_build/lib/wx/include/gtk2-unicode-3.0 -I/var/tmp/portage/x11-libs/wxGTK-3.0.0.0/work/wxPython-src-3.0.0.0/include -D_REENTRANT -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/directfb -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/X11R6/include -DWX_PRECOMP -pthread -pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -D_REENTRANT -pthread -I/usr/include/gtk-unix-print-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/directfb -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -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/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -O2 -pipe -fomit-frame-pointer -march=native -Wl,-O1 -Wl,--as-needed -fvisibility=hidden -fvisibility-inlines-hidden /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status Makefile:15504: recipe for target '.pch/wxprec_basedll/wx/wxprec.h.gch' failed make: *** [.pch/wxprec_basedll/wx/wxprec.h.gch] Error 1 Reproducible: Always
Created attachment 372376 [details] complete build.log
Created attachment 372378 [details] emerge -info
Me too! Removing '-Wl,-O1' from CXXFLAGS fixes this for me.
(In reply to Rick Harris from comment #3) > Me too! > > Removing '-Wl,-O1' from CXXFLAGS fixes this for me. Yes, I can confirm this resolves the issue. Thanks. P.S. In my case those flags were introduced into CXXFLAGS by portage-bashrc-mv.
I still run into this issue for x11-libs/wxGTK-3.0.4-r300 It's not clear how I'm supposed to remove '-Wl,-O1' from the CXXFLAGS since I'm not adding it via make.conf.
(In reply to throwd from comment #5) > I still run into this issue for x11-libs/wxGTK-3.0.4-r300 > > It's not clear how I'm supposed to remove '-Wl,-O1' from the CXXFLAGS since > I'm not adding it via make.conf. Please share emerge --info and attach the full build.log.
(In reply to Sam James from comment #6) sorry, I'd missed that the update to the bug was because of Emily's PR, and not this comment. Whoops.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b215f0743a4266e48ff3377811a7ce73f287d1f commit 8b215f0743a4266e48ff3377811a7ce73f287d1f Author: Emily Rowlands <emily@erowl.net> AuthorDate: 2022-08-23 15:19:23 +0000 Commit: David Seifert <soap@gentoo.org> CommitDate: 2022-08-23 15:19:23 +0000 x11-libs/wxGTK: Disable precompiled headers This commit adds USE=pch to disable precompiled headers. PCHes are unstable and as such, USE=pch is masked globally. This bug can alternatively be fixed by filtering various FLAGs (-Wl,-O1 -Wl,-z,relro, and similar). Closes: https://bugs.gentoo.org/504204 Signed-off-by: Emily Rowlands <emily@erowl.net> Signed-off-by: David Seifert <soap@gentoo.org> x11-libs/wxGTK/wxGTK-3.0.4-r3.ebuild | 7 ++++++- x11-libs/wxGTK/wxGTK-3.0.5.1.ebuild | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-)