Bug 559

Summary: mesa3d build fails
Product: buildroot Reporter: Frederik Pasch <fpasch>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot, clark.rawlins
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: i686 Target: i686
Build: x86_64
Attachments: Pass LDFLAGS to the build config file

Description Frederik Pasch 2009-08-11 12:34:23 UTC
Hello!

Just tried to compile x11 for x86 on a x86_64 machine with buildroot-2009.08-rc2. I'm using an external glibc-toolchain (created by crosstool-ng)

Build of Mesa 7.2 fails with:
/home/test/crosstool-ng/i686-unknown-linux-gnu/lib/gcc/i686-unknown-linux-gnu/4.3.2/../../../../i686-unknown-linux-gnu/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status


My current workaround is:
--- 1/package/x11r7/mesa3d/mesa3d.mk~	2009-08-11 14:30:37.000000000 +0200
+++ 2/package/x11r7/mesa3d/mesa3d.mk	2009-08-11 14:30:42.000000000 +0200
@@ -47,7 +47,7 @@
 		echo "SRC_DIRS = glx/x11 mesa glu glut/glx" && \
 		echo "USING_EGL = 0" && \
 		echo "X11_INCLUDES = " && \
-		echo "EXTRA_LIB_PATH = " && \
+		echo "EXTRA_LIB_PATH = -L$(STAGING_DIR)/usr/lib" && \
 		echo "PROGRAM_DIRS =" && \
 		echo "MKDEP_OPTIONS = -fdepend -Y$(STAGING_DIR)/usr/include -I$(MESA_GCCINCLUDE)" \
 	) >> $(MESA_CONFIG_FILE)
Comment 1 Peter Korsgaard 2009-08-26 20:50:20 UTC
(In reply to comment #0)
> Just tried to compile x11 for x86 on a x86_64 machine with
> buildroot-2009.08-rc2. I'm using an external glibc-toolchain (created by
> crosstool-ng)
> 
> Build of Mesa 7.2 fails with:
> /home/test/crosstool-ng/i686-unknown-linux-gnu/lib/gcc/i686-unknown-linux-gnu/4.3.2/../../../../i686-unknown-linux-gnu/bin/ld:
> cannot find -lX11
> collect2: ld returned 1 exit status

Hmm, could you post the entire cmdline? It sounds to me as if -sysroot is missing, otherwise it should look in STAGING_DIR/usr/lib automatically.
Comment 2 Frederik Pasch 2009-08-27 08:34:14 UTC
(In reply to comment #1)
> Hmm, could you post the entire cmdline? It sounds to me as if -sysroot is
> missing, otherwise it should look in STAGING_DIR/usr/lib automatically.
> 


/home/test/x-tools/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc -c -I. -I../../../include -I../../../include/GL/internal -I../../../src/mesa/main -I../../../src/mesa/glapi `pkg-config --cflags libdrm`  -Wall -Wmissing-prototypes -std=c99 -ffast-math -Os -pipe -Os  --sysroot /home/test/buildroot-2009.08-rc3/build_i686/staging_dir/ -fPIC -m32 -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -fno-strict-aliasing -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER -DDEFAULT_DRIVER_DIR=\"/usr/local/lib/dri\" ../../../src/mesa/glapi/glthread.c -o ../../../src/mesa/glapi/glthread.o
/home/test/x-tools/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc -c -I. -I../../../include -I../../../include/GL/internal -I../../../src/mesa/main -I../../../src/mesa/glapi `pkg-config --cflags libdrm`  -Wall -Wmissing-prototypes -std=c99 -ffast-math -Os -pipe -Os  --sysroot /home/test/buildroot-2009.08-rc3/build_i686/staging_dir/ -fPIC -m32 -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -fno-strict-aliasing -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER -DDEFAULT_DRIVER_DIR=\"/usr/local/lib/dri\"  ../../../src/mesa/x86/glapi_x86.S -o ../../../src/mesa/x86/glapi_x86.o
/bin/sh ../../../bin/mklib -o GL -linker '/home/test/x-tools/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc' -ldflags '' \
                -major 1 -minor 2  \
                -install ../../../lib -id /usr/local/lib/libGL.1.dylib \
                 -lX11 -lXext -lXxf86vm -lXdamage -lXfixes -lm -lpthread -ldl `pkg-config --libs libdrm` glcontextmodes.o clientattrib.o compsize.o eval.o glxcmds.o glxcurrent.o glxext.o glxextensions.o indirect.o indirect_init.o indirect_size.o indirect_window_pos.o indirect_texture_compression.o indirect_transpose_matrix.o indirect_vertex_array.o indirect_vertex_program.o pixel.o pixelstore.o render2.o renderpix.o single2.o singlepix.o vertarr.o xfont.o glx_pbuffer.o glx_query.o drisw_glx.o dri_common.o dri_glx.o XF86dri.o glxhash.o ../../../src/mesa/main/dispatch.o ../../../src/mesa/glapi/glapi.o ../../../src/mesa/glapi/glthread.o ../../../src/mesa/x86/glapi_x86.o
mklib: Making Linux shared library:  libGL.so.1.2
/home/test/x-tools/i686-unknown-linux-gnu/lib/gcc/i686-unknown-linux-gnu/4.3.2/../../../../i686-unknown-linux-gnu/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
Comment 3 Clark Rawlins 2009-12-01 13:50:52 UTC
Created attachment 783 [details]
Pass LDFLAGS to the build config file

Without the LDFLAGS in the build configuration file
building mesa3d fails with an external toolchain on amd64
machines targeting i686.  The error indicates that libX11
can't be found.

This change passes the --sysroot parameter (along with any
others specified by buildroot for LDFLAGS to the mklib script.
Comment 4 Lionel Landwerlin 2009-12-01 13:54:03 UTC
(In reply to comment #3)
> Created an attachment (id=783) [details]
> Pass LDFLAGS to the build config file
> 
> Without the LDFLAGS in the build configuration file
> building mesa3d fails with an external toolchain on amd64
> machines targeting i686.  The error indicates that libX11
> can't be found.
> 
> This change passes the --sysroot parameter (along with any
> others specified by buildroot for LDFLAGS to the mklib script.
> 

A few other packages have the same problem (tested with external toolchain too), e2fsprogs for example.
Comment 5 Peter Korsgaard 2009-12-06 19:14:15 UTC
Committed, thanks!