I am trying to emerge xfree-4.2.1-r1 and am getting a large number of undefined reference errors in GL/mesa/src/libGLcore.a. I will attach the full ebuild log, but a short part is below. The system I am using was converted from a gcc 2.95.3 to gcc 3.2 with only the gcc 2.95.3 compiled c/c++ libraries intact. I am only using gcc 3.2. I have successfully compiled xfree 4.2.1. I have the following ebuilds installed that may be of help: glibc-2.3.1-r1 ccache-1.9-r1 nvidia-kernel-1.0.3123-r1 nvidia-glx-1.0.3123 USE="-gnome kde qt qtmt gtk2 -3dnow alsa apm pcmcia mmx sse sse2 gphoto2 pda cups dga opengl dvd pam ssl socks5 mozilla truetype java perl mysql pdflib xmms odbc acpi4linux" GL/mesa/src/libGLcore.a(logic.o)(.text+0xb): In function `_mesa_LogicOp': : undefined reference to `_glapi_Context' GL/mesa/src/libGLcore.a(masking.o)(.text+0xb): In function `_mesa_IndexMask': : undefined reference to `_glapi_Context' GL/mesa/src/libGLcore.a(masking.o)(.text+0xa1): In function `_mesa_ColorMask': : undefined reference to `_glapi_Context' GL/mesa/src/libGLcore.a(rastpos.o)(.text+0xf): more undefined references to `_glapi_Context' follow collect2: ld returned 1 exit status make[3]: *** [Xnest] Error 1 make[3]: Leaving directory `/var/tmp/portage/xfree-4.2.1-r1/work/xc/programs/Xserver' make[2]: *** [install] Error 2 make[2]: Leaving directory `/var/tmp/portage/xfree-4.2.1-r1/work/xc/programs' make[1]: *** [install] Error 2 make[1]: Leaving directory `/var/tmp/portage/xfree-4.2.1-r1/work/xc' make: *** [install] Error 2
Created attachment 5365 [details] xfree.log: output from ebuild xfree-4.2.1-r1.ebuild install I made this file by running "ebuild xfree-4.2.1-r1.ebuild install" a second time. I get the same results from emerge.
what happens if you emerge nvidia-kernel-1.0.3123 ? or what if you run `opengl-update xfree` and then emerge ?
emerge nvidia-kernel works fine. I tried opengl-update xfree and then emerge xfree, same results. I did notice that the same link errors appearing during compilation as well. I can do a clean compile and grab the entire log and attach if that would be helpful.
Try without ccache ? What version binutils ?
binutils 2.13.90.0.10 I will try without ccache although I don't think XFree actually uses it, it seems to find gcc itself.
Same results when compiling without ccache.
Anything special that is not standard for a Gentoo system ? I cannot recreate this, so it makes things a bit difficult.
I can't think of anything special. I'm using an up to date Gentoo unstable x86 system (i.e. ~x86 in ACCEPT_KEYWORDS). Is there any diagnostic info I can upload? Such as the output from qpkg or similar?
CFLAGS/CXXFLAGS ?
CFLAGS="-O3 -pipe -march=pentium4 -mmmx -msse2 -mfpmath=sse -fexpensive-optimizations -fschedule-insns2 -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4" CXXFLAGS="${CFLAGS}" CHOST="i686-pc-linux-gnu" I tried taking "mmx sse sse2" out of the USE flags, no difference. The only time I've had trouble with these flags is that I will get a gcc instruction error such as "instruction doesn't match constraints". I also, just to be sure, compiled xfree-4.2.1 yet again and it works fine. I tried remerging binutils, and no difference. I do seem to be the only one with this problem, two co-workers of mine have not experienced it. No email on the gentoo-user or gentoo-dev lists. I am using the KDE cvs ebuilds. Would that make a difference? I wouldn't think so, but perhaps.
Looks like a CFLAGS problem. I tried: CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe" nice ebuild xfree-4.2.1-r1.ebuild clean install and it works fine. Should've known, although I've never seen CFLAGS cause a linker error unless the build for mesa failed but the makefile carried on. I noticed this behavior with several of the xfree makefiles. During the compile this linker error appears several times although the build never stops. I will experiment to find out which flag is the problem, probably the -msse -mfpmath=sse2. Would it be possible to update the ebuild to remove these similar to how the -march=pentium4 is changed to -march=pentium3 ?
Hmm .. supposidly the 'strip-flags' should do it, but I guess I should recheck it again ....
I will systematically add flags and find the one that breaks and report back.
Yes, strip-flags works correctly. I tried using the following CFLAGS/CXXFLAGS and it worked: -O3 -pipe -march=i686 However, using "pentium3" instead of "i686" did not work. Strange since I compiled xfree-4.2.1 with "pentium3" without problem.
Hmm .. compiled fine with -march=pentium3 here. Wonder if it could be the cause of other system libs being compiled with your more aggressive original flags...
I suppose that could be the case. It would have to be a problem with the linker though as the optimized flags _shouldn't_ affect the export library symbols. I could try remerging binutils with more conservative flags and then emerge xfree. Although I can live with i686 optimizations. I'll try it tonight when I'm not using the machine. I have a snapshot of gcc 3.3, perhaps I could try that for fun :)
I remerged binutils with CFLAGS/CXXFLAGS="-O3 -pipe -march=i686" and then did emerge xfree which used my previously given flags. After flag-o-matic this is equivalent to "-O3 -pipe -march=pentium3". Worked fine. Looks like something in binutils, most probably the linker, doesn't work well with a flag I have. Might be time to filter more flags with flag-o-matic.
gcc 3.2.1 seems to have fixed this problem. After merging gcc 3.2.1, I merged binutils (the latest unstable) and xfree 4.2.1-r1 again and no problems. I'm certain this is related to the SSE fixes in gcc 3.2.1.