Bug 49504 - [Bisected] Mesa master compilation broke when built with --with-llvm-shared-libs
Summary: [Bisected] Mesa master compilation broke when built with --with-llvm-shared-libs
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-04 11:20 UTC by roberth
Modified: 2012-09-07 10:30 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description roberth 2012-05-04 11:20:23 UTC
Building mesa master fails when --with--llvm-shared-libs is used like so:

g++  -L/usr/lib/llvm-3.0/lib  -lpthread -lffi -ldl -lm  lp_test_round.o lp_test_main.o -o lp_test_round -Wl,--start-group  -L../../auxiliary/ -lgallium libllvmpipe.a -lLLVM-3.0  -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx -lxcb -lXxf86vm   -ldrm   -lm -lpthread -ldl -Wl,--end-group
/usr/bin/ld: ../../auxiliary//libgallium.a(u_dl.o): undefined reference to symbol 'dlopen@@GLIBC_2.1'
/usr/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libdl.so so try adding it to the linker command line
/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libdl.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[4]: *** [lp_test_blend] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory `/home/sarvatt/mesa/src/gallium/drivers/llvmpipe'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/sarvatt/mesa/src/gallium/drivers'
make[2]: *** [default] Error 1
make[2]: Leaving directory `/home/sarvatt/mesa/src/gallium'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/home/sarvatt/mesa/src'
make: *** [default] Error 1


I bisected it down to this commit

0b0f4628d6fb8276a9f1c336a785a838b602bca8 is the first bad commit
commit 0b0f4628d6fb8276a9f1c336a785a838b602bca8
Author: James Benton <jbenton@vmware.com>
Date:   Wed Apr 18 15:25:34 2012 +0100

    llvmpipe: Added support for color masks in AoS blending.
    
    Signed-off-by: José Fonseca <jfonseca@vmware.com>

:040000 040000 5521841f3b528eac2ae62ed61eb43c7ffed7f3c9 816e632242eccd9401f90212dfd2332c678999ce M	src

Full bisect log:

git bisect start
# good: [2d75a1e25e6ddcd65964d30fc3c782df2e880cc4] glsl: Initialize member variable in ir_copy_propagation_elements_visitor.
git bisect good 2d75a1e25e6ddcd65964d30fc3c782df2e880cc4
# bad: [51691f0767f6a75a1f549cd979a878a0ad12a228] darwin: Use ASL for logging
git bisect bad 51691f0767f6a75a1f549cd979a878a0ad12a228
# bad: [6cd76b800bed70435f499c6c498a487a5056a731] gallivm: Add a lp_build_const_func_pointer() helper.
git bisect bad 6cd76b800bed70435f499c6c498a487a5056a731
# good: [6d5efe96ee710ca1dd5f745f74a5bbfa4fd42fd9] dri/nouveau: Add general support for compressed formats.
git bisect good 6d5efe96ee710ca1dd5f745f74a5bbfa4fd42fd9
# bad: [9bc58d941ac32d10c6b4c601e0c4c6e00876d738] llvmpipe: Check when a shader does not satisfy 0 < imm < 1.
git bisect bad 9bc58d941ac32d10c6b4c601e0c4c6e00876d738
# good: [85d09d1c61d3e5ab2c2ae6fc74a30ea6a572f25e] gallivm: added aligned pointer get/set
git bisect good 85d09d1c61d3e5ab2c2ae6fc74a30ea6a572f25e
# bad: [c426e63aa064debc23f9819c3862f357f1726bce] gallivm: fixed memory leak in lp_build_tgsi_aos
git bisect bad c426e63aa064debc23f9819c3862f357f1726bce
# bad: [0b0f4628d6fb8276a9f1c336a785a838b602bca8] llvmpipe: Added support for color masks in AoS blending.
git bisect bad 0b0f4628d6fb8276a9f1c336a785a838b602bca8

Options used:
./autogen.sh --with-driver=dri --with-dri-drivers=" r200 radeon nouveau i915 i965" --with-dri-driverdir=/usr/lib/x86_64-linux-gnu/dri --enable-glx-tls --enable-shared-dricore --enable-shared-glapi --enable-texture-float --with-llvm-shared-libs --enable-xa --enable-driglx-direct --with-egl-platforms="x11 drm wayland" --enable-gallium-llvm --with-gallium-drivers=" nouveau r600 r300 svga swrast" --enable-gles1 --enable-gles2 --enable-openvg --enable-gallium-egl --disable-glu CFLAGS="-Wall -g -O2" CXXFLAGS="-Wall -g -O2"

Dropping --with-llvm-shared-libs does work.
Comment 1 Iaroslav Andrusyak 2012-05-08 10:34:03 UTC
I have the same problem.
The problem in llvmpipe driver.

mklib: Making Linux static library:  libllvmpipe.a
 ar: creating libllvmpipe.a
 g++  -L/usr/lib  -lpthread -ldl -lm  lp_test_format.o lp_test_main.o -o lp_test_format -Wl,--start-group  -L../../auxiliary/ -lgallium libllvmpipe.a -lLLVM-3.2svn  -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx -lxcb -lXxf86vm   -ldrm   -lm -lpthread -ldl -Wl,--end-group
 g++  -L/usr/lib  -lpthread -ldl -lm  lp_test_arit.o lp_test_main.o -o lp_test_arit -Wl,--start-group  -L../../auxiliary/ -lgallium libllvmpipe.a -lLLVM-3.2svn  -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx -lxcb -lXxf86vm   -ldrm   -lm -lpthread -ldl -Wl,--end-group
 g++  -L/usr/lib  -lpthread -ldl -lm  lp_test_blend.o lp_test_main.o -o lp_test_blend -Wl,--start-group  -L../../auxiliary/ -lgallium libllvmpipe.a -lLLVM-3.2svn  -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx -lxcb -lXxf86vm   -ldrm   -lm -lpthread -ldl -Wl,--end-group
 g++  -L/usr/lib  -lpthread -ldl -lm  lp_test_conv.o lp_test_main.o -o lp_test_conv -Wl,--start-group  -L../../auxiliary/ -lgallium libllvmpipe.a -lLLVM-3.2svn  -lXext -lXdamage -lXfixes -lX11-xcb -lX11 -lxcb-glx -lxcb -lXxf86vm   -ldrm   -lm -lpthread -ldl -Wl,--end-group
/usr/lib/gcc/i586-suse-linux/4.7/../../../../i586-suse-linux/bin/ld: ../../auxiliary//libgallium.a(u_dl.o): undefined reference to symbol 'dlopen@@GLIBC_2.1'
 /usr/lib/gcc/i586-suse-linux/4.7/../../../../i586-suse-linux/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO /usr/lib/libdl.so so try adding it to the linker command line
 /usr/lib/libdl.so: could not read symbols: Invalid operation
 collect2: error: ld returned 1 exit status
 gmake[4]: *** [lp_test_blend] Error 1
 gmake[4]: *** Waiting for unfinished jobs....
 gmake[4]: Leaving directory `/home/abuild/rpmbuild/BUILD/mesa/src/gallium/drivers/llvmpipe'
 gmake[3]: *** [all-recursive] Error 1
 gmake[3]: Leaving directory `/home/abuild/rpmbuild/BUILD/mesa/src/gallium/drivers'
 gmake[2]: *** [default] Error 1
 gmake[2]: Leaving directory `/home/abuild/rpmbuild/BUILD/mesa/src/gallium'
 make[1]: *** [subdirs] Error 1
 make[1]: Leaving directory `/home/abuild/rpmbuild/BUILD/mesa/src'
 make: *** [default] Error 1
 error: Bad exit status from /var/tmp/rpm-tmp.wiHQfL (%build)
Comment 2 Jose Fonseca 2012-06-08 08:13:03 UTC
I don't see how this commit changes anything.

It seems this is a linking bug, that was always there, but latent. And this commit simply slightly changed the order that symbols are linked.

-ldl is being passed to the linker, so I don't see why it dlopen symbol is not found.

I read from another change that SUSE defauls to building LLVM with clang, may be that's related.
Comment 3 Iaroslav Andrusyak 2012-06-13 08:32:44 UTC
(In reply to comment #2)
> I don't see how this commit changes anything.
> 
> It seems this is a linking bug, that was always there, but latent. And this
> commit simply slightly changed the order that symbols are linked.
> 
> -ldl is being passed to the linker, so I don't see why it dlopen symbol is not
> found.
> 
> I read from another change that SUSE defauls to building LLVM with clang, may
> be that's related.

But with the same version of llvm mesa master before Wed Apr 18 build without problem, after Wed Apr 18 fails with --with--llvm-shared-libs.
There must be a reason.
Comment 4 roberth 2012-08-05 01:47:32 UTC

*** This bug has been marked as a duplicate of bug 52167 ***
Comment 5 Fabio Pedretti 2012-09-07 10:30:26 UTC
Unduplicate: this is fixed, while #52167 still not.


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.