Bug 39147

Summary: egl_gallium.so: errors when linking
Product: Mesa Reporter: Laurent carlier <lordheavym>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: andyrtr, lordheavym
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: fix linking errors

Description Laurent carlier 2011-07-11 09:42:49 UTC
When trying to build egl driver under ArchLinux, there is erros while linking:

-------8<-------
make[3]: Leaving directory `/build/src/mesa-b033f050fd5179b051181a0a4b6d94110624d25c/src/gallium/winsys/nouveau/drm'
make[2]: Leaving directory `/build/src/mesa-b033f050fd5179b051181a0a4b6d94110624d25c/src/gallium/winsys'
make[2]: Entering directory `/build/src/mesa-b033f050fd5179b051181a0a4b6d94110624d25c/src/gallium/targets'
make[3]: Entering directory `/build/src/mesa-b033f050fd5179b051181a0a4b6d94110624d25c/src/gallium/targets/egl-static'
gcc -c -o egl.o egl.c -DFEATURE_ES1=1 -DFEATURE_ES2=1 -DFEATURE_GL=1 -DGALLIUM_RBUG -DGALLIUM_SOFTPIPE -DGALLIUM_TRACE -D_EGL_EXTERNAL_GL=1 -D_EGL_MAIN=_eglMain -D_EGL_PIPE_NOUVEAU=1 -D_EGL_PIPE_R300=1 -D_EGL_PIPE_R600=1 -I../../../../include -I../../../../src/egl/main -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/include -I../../../../src/gallium/state_trackers/egl -I../../../../src/gallium/winsys -I../../../../src/mesa -I/usr/include/libdrm -DGALLIUM_LLVMPIPE -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fPIC -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -fvisibility=hidden
gcc -c -o egl_pipe.o egl_pipe.c -DFEATURE_ES1=1 -DFEATURE_ES2=1 -DFEATURE_GL=1 -DGALLIUM_RBUG -DGALLIUM_SOFTPIPE -DGALLIUM_TRACE -D_EGL_EXTERNAL_GL=1 -D_EGL_MAIN=_eglMain -D_EGL_PIPE_NOUVEAU=1 -D_EGL_PIPE_R300=1 -D_EGL_PIPE_R600=1 -I../../../../include -I../../../../src/egl/main -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/include -I../../../../src/gallium/state_trackers/egl -I../../../../src/gallium/winsys -I../../../../src/mesa -I/usr/include/libdrm -DGALLIUM_LLVMPIPE -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fPIC -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -fvisibility=hidden
gcc -c -o egl_st.o egl_st.c -DFEATURE_ES1=1 -DFEATURE_ES2=1 -DFEATURE_GL=1 -DGALLIUM_RBUG -DGALLIUM_SOFTPIPE -DGALLIUM_TRACE -D_EGL_EXTERNAL_GL=1 -D_EGL_MAIN=_eglMain -D_EGL_PIPE_NOUVEAU=1 -D_EGL_PIPE_R300=1 -D_EGL_PIPE_R600=1 -I../../../../include -I../../../../src/egl/main -I../../../../src/gallium/auxiliary -I../../../../src/gallium/drivers -I../../../../src/gallium/include -I../../../../src/gallium/state_trackers/egl -I../../../../src/gallium/winsys -I../../../../src/mesa -I/usr/include/libdrm -DGALLIUM_LLVMPIPE -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fPIC -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -fvisibility=hidden
gcc -c -o st_GL.o st_GL.c -I ../../../../src/mesa -I../../../../src/gallium/include -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -march=x86-64 -mtune=generic -O2 -pipe -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fPIC -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -fvisibility=hidden
egl_st.c: In function 'dlopen_gl_lib_cb':
egl_st.c:58:13: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat]
egl_st.c:58:13: warning: field precision specifier '.*' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat]
/bin/sh ../../../../bin/mklib -o st_GL.so -noprefix -linker 'g++' \
-ldflags '-L../../../../lib -Wl,--hash-style=gnu -Wl,--as-needed -L/usr/lib/llvm -lpthread -lffi -ldl -lm ' \
-cplusplus -install ../../../../lib/egl \
st_GL.o -Wl,--start-group ../../../../src/mesa/libmesagallium.a ../../../../src/gallium/auxiliary/libgallium.a -Wl,--end-group \
-lm -lpthread -ldl -lLLVMObject -lLLVMMCJIT -lLLVMMCDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreInfo -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMSparcCodeGen -lLLVMSparcInfo -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMPTXCodeGen -lLLVMPTXInfo -lLLVMMipsCodeGen -lLLVMMipsInfo -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMBlazeDisassembler -lLLVMMBlazeAsmParser -lLLVMMBlazeCodeGen -lLLVMMBlazeAsmPrinter -lLLVMMBlazeInfo -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMX86Info -lLLVMAsmParser -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMAsmPrinter -lLLVMARMInfo -lLLVMArchive -lLLVMBitReader -lLLVMAlphaCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAlphaInfo -lLLVMMC -lLLVMSupport -lstdc++
mklib: Making Linux shared library: st_GL.so
/bin/sh ../../../../bin/mklib -o egl_gallium.so -noprefix -linker 'g++' \
-ldflags '-L../../../../lib -Wl,--no-undefined -Wl,--hash-style=gnu -Wl,--as-needed -L/usr/lib/llvm -lpthread -lffi -ldl -lm ' \
-cplusplus -install ../../../../lib/egl \
egl.o egl_pipe.o egl_st.o -Wl,--start-group ../../../../src/gallium/auxiliary/libgallium.a ../../../../src/gallium/drivers/identity/libidentity.a ../../../../src/gallium/drivers/nouveau/libnouveau.a ../../../../src/gallium/drivers/nv50/libnv50.a ../../../../src/gallium/drivers/nvc0/libnvc0.a ../../../../src/gallium/drivers/nvfx/libnvfx.a ../../../../src/gallium/drivers/r300/libr300.a ../../../../src/gallium/drivers/r600/libr600.a ../../../../src/gallium/drivers/rbug/librbug.a ../../../../src/gallium/drivers/softpipe/libsoftpipe.a ../../../../src/gallium/drivers/trace/libtrace.a ../../../../src/gallium/state_trackers/egl/libegl.a ../../../../src/gallium/winsys/nouveau/drm/libnouveaudrm.a ../../../../src/gallium/winsys/r600/drm/libr600winsys.a ../../../../src/gallium/winsys/radeon/drm/libradeonwinsys.a ../../../../src/gallium/winsys/sw/xlib/libws_xlib.a ../../../../src/gallium/drivers/llvmpipe/libllvmpipe.a -Wl,--end-group \
-lEGL -lX11 -lXext -lXfixes -ldl -ldrm -ldrm_nouveau -ldrm_radeon -lm -lrt -ludev -lLLVMObject -lLLVMMCJIT -lLLVMMCDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreInfo -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMSparcCodeGen -lLLVMSparcInfo -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMPTXCodeGen -lLLVMPTXInfo -lLLVMMipsCodeGen -lLLVMMipsInfo -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMBlazeDisassembler -lLLVMMBlazeAsmParser -lLLVMMBlazeCodeGen -lLLVMMBlazeAsmPrinter -lLLVMMBlazeInfo -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMX86Info -lLLVMAsmParser -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMAsmPrinter -lLLVMARMInfo -lLLVMArchive -lLLVMBitReader -lLLVMAlphaCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAlphaInfo -lLLVMMC -lLLVMSupport -lstdc++
mklib: Making Linux shared library: egl_gallium.so
../../../../src/gallium/drivers/rbug/librbug.a(rbug_core.o): In function `pipe_thread_create.constprop.17':
rbug_core.c:(.text+0x13c9): undefined reference to `pthread_sigmask'
rbug_core.c:(.text+0x13e2): undefined reference to `pthread_create'
rbug_core.c:(.text+0x13f3): undefined reference to `pthread_sigmask'
../../../../src/gallium/drivers/rbug/librbug.a(rbug_core.o): In function `rbug_stop':
rbug_core.c:(.text+0x1474): undefined reference to `pthread_join'
../../../../src/gallium/winsys/radeon/drm/libradeonwinsys.a(radeon_drm_cs.o): In function `pipe_thread_create.constprop.7':
radeon_drm_cs.c:(.text+0x2b9): undefined reference to `pthread_sigmask'
radeon_drm_cs.c:(.text+0x2d2): undefined reference to `pthread_create'
radeon_drm_cs.c:(.text+0x2e3): undefined reference to `pthread_sigmask'
../../../../src/gallium/winsys/radeon/drm/libradeonwinsys.a(radeon_drm_cs.o): In function `radeon_drm_cs_sync_flush':
radeon_drm_cs.c:(.text+0x95b): undefined reference to `pthread_join'
../../../../src/gallium/drivers/llvmpipe/libllvmpipe.a(lp_rast.o): In function `pipe_thread_create.constprop.5':
lp_rast.c:(.text+0x539): undefined reference to `pthread_sigmask'
lp_rast.c:(.text+0x552): undefined reference to `pthread_create'
lp_rast.c:(.text+0x563): undefined reference to `pthread_sigmask'
../../../../src/gallium/drivers/llvmpipe/libllvmpipe.a(lp_rast.o): In function `thread_func':
lp_rast.c:(.text+0x615): undefined reference to `pthread_barrier_wait'
lp_rast.c:(.text+0x629): undefined reference to `pthread_barrier_wait'
../../../../src/gallium/drivers/llvmpipe/libllvmpipe.a(lp_rast.o): In function `lp_rast_create':
lp_rast.c:(.text+0xf2b): undefined reference to `pthread_barrier_init'
../../../../src/gallium/drivers/llvmpipe/libllvmpipe.a(lp_rast.o): In function `lp_rast_destroy':
lp_rast.c:(.text+0xffa): undefined reference to `pthread_join'
lp_rast.c:(.text+0x1064): undefined reference to `pthread_barrier_destroy'
/usr/lib/llvm/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text+0x31): undefined reference to `pthread_mutexattr_init'
/usr/lib/llvm/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text+0x3d): undefined reference to `pthread_mutexattr_settype'
/usr/lib/llvm/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text+0x47): undefined reference to `pthread_mutexattr_setpshared'
/usr/lib/llvm/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::MutexImpl(bool)':
(.text+0x5a): undefined reference to `pthread_mutexattr_destroy'
/usr/lib/llvm/libLLVMSupport.a(Mutex.o): In function `llvm::sys::MutexImpl::tryacquire()':
(.text+0xe8): undefined reference to `pthread_mutex_trylock'
/usr/lib/llvm/libLLVMSupport.a(RWMutex.o): In function `llvm::sys::RWMutexImpl::RWMutexImpl()':
(.text+0x2b): undefined reference to `pthread_rwlock_init'
/usr/lib/llvm/libLLVMSupport.a(RWMutex.o): In function `llvm::sys::RWMutexImpl::~RWMutexImpl()':
(.text+0x58): undefined reference to `pthread_rwlock_destroy'
/usr/lib/llvm/libLLVMSupport.a(RWMutex.o): In function `llvm::sys::RWMutexImpl::reader_acquire()':
(.text+0x78): undefined reference to `pthread_rwlock_rdlock'
/usr/lib/llvm/libLLVMSupport.a(RWMutex.o): In function `llvm::sys::RWMutexImpl::reader_release()':
(.text+0x98): undefined reference to `pthread_rwlock_unlock'
/usr/lib/llvm/libLLVMSupport.a(RWMutex.o): In function `llvm::sys::RWMutexImpl::writer_acquire()':
(.text+0xb8): undefined reference to `pthread_rwlock_wrlock'
/usr/lib/llvm/libLLVMSupport.a(RWMutex.o): In function `llvm::sys::RWMutexImpl::writer_release()':
(.text+0xd8): undefined reference to `pthread_rwlock_unlock'
/usr/lib/llvm/libLLVMSupport.a(ThreadLocal.o): In function `llvm::sys::ThreadLocalImpl::~ThreadLocalImpl()':
(.text+0x16): undefined reference to `pthread_key_delete'
/usr/lib/llvm/libLLVMSupport.a(ThreadLocal.o): In function `llvm::sys::ThreadLocalImpl::ThreadLocalImpl()':
(.text+0x8a): undefined reference to `pthread_key_create'
/usr/lib/llvm/libLLVMSupport.a(ThreadLocal.o): In function `llvm::sys::ThreadLocalImpl::setInstance(void const*)':
(.text+0xb7): undefined reference to `pthread_setspecific'
/usr/lib/llvm/libLLVMSupport.a(ThreadLocal.o): In function `llvm::sys::ThreadLocalImpl::getInstance()':
(.text+0xc7): undefined reference to `pthread_getspecific'
/usr/lib/llvm/libLLVMSupport.a(Threading.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
(.text+0x126): undefined reference to `pthread_create'
/usr/lib/llvm/libLLVMSupport.a(Threading.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
(.text+0x146): undefined reference to `pthread_attr_setstacksize'
/usr/lib/llvm/libLLVMSupport.a(Threading.o): In function `llvm::llvm_execute_on_thread(void (*)(void*), void*, unsigned int)':
(.text+0x158): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
mklib: Installing egl_gallium.so in ../../../../lib/egl
mklib: Installing st_GL.so in ../../../../lib/egl
mv: cannot stat `egl_gallium.so': No such file or directory
make[3]: Leaving directory `/build/src/mesa-b033f050fd5179b051181a0a4b6d94110624d25c/src/gallium/targets/egl-static'
------->8-------

A workaround to get it building is to filter -Wl,--as-needed from LDFLAGS. This problem seems present since the comming of egl-static target.

See https://bugs.archlinux.org/task/25093
Comment 1 Chia-I Wu 2011-07-12 08:00:34 UTC
Created attachment 49010 [details] [review]
fix linking errors

Does this patch help?

There are two hunks in the patch.  If the patch helps, could you undo the second hunk and see if it is also needed?
Comment 2 Laurent carlier 2011-07-12 08:59:17 UTC
The patch fixes the problem.
Comment 3 Laurent carlier 2011-07-12 09:11:40 UTC
... and applying only the first hunk seems enough.
Comment 4 Chia-I Wu 2011-07-13 00:27:58 UTC
I've pushed the first hunk to master (and will cherry-pick it to 7.11 later).  Thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.