Bug 101971 - Mesa fails to build when Wayland and EGL support enabled due to missing C++ lib from mesautil
Summary: Mesa fails to build when Wayland and EGL support enabled due to missing C++ l...
Status: RESOLVED DUPLICATE of bug 101851
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL/Wayland (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium minor
Assignee: Wayland bug list
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-29 21:36 UTC by Michael Pyne
Modified: 2017-07-31 08:37 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Fix build by using dummy source to force C++ link mode for libEGL (749 bytes, patch)
2017-07-29 21:36 UTC, Michael Pyne
Details | Splinter Review

Description Michael Pyne 2017-07-29 21:36:42 UTC
Created attachment 133131 [details] [review]
Fix build by using dummy source to force C++ link mode for libEGL

Mesa from git 7ea4cda2ab4ddaeabaf4fd1c3337f9894424ce92 fails to compile with Wayland and EGL enabled.  This is the git commit I tested, but probably not the git commit that introduced the build failure.

Pertinent logs are included below, but the specific linker error is: ./.libs/libEGL_common.a(libmesautil_la-string_to_uint_map.o):string_to_uint_map.cpp:DW.ref.__gxx_personality_v0: error: undefined reference to '__gxx_personality_v0'

This failure occurs when building libEGL, which I believe is due to a libtool confusion when using libmesautil (included into libEGL_common at src/egl/Makefile.am:85).  libmesautil includes a C++-based source file (string_to_uint_map.cpp).  While libtool properly uses the C++ linker to build libmesautil.la, it doesn't appear to use libmesautil.a (the generated archive) when building libEGL_common or libEGL, but instead appears to try to link libmesautil's *.o files directly.  But when it does this, it uses the C linker instead of the C++ linker, and so misses the runtime support lib needed for the C++ file in libmesautil.

I have a workaround patch attached that tricks libtool into using the C++ linker (as documented in the Automake manual https://www.gnu.org/software/automake/manual/html_node/Libtool-Convenience-Libraries.html#Libtool-Convenience-Libraries), which I will attach separately.

But I'm not sure if that's the right fix for autotools (C++ mode is used unilaterally with my patch even if Wayland is not used), or if there's a better approach for the Mesa codebase.


-----   make output log extract
/bin/sh ../../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -m32 -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/include -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/main -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/gbm/main -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DTEXTURE_FLOAT_ENABLED -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_DLOPEN -DHAVE_DL_ITERATE_PHDR -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_X11_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_WAYLAND_PLATFORM -DHAVE_DRM_PLATFORM -DHAVE_DRI3 -DENABLE_SHADER_CACHE -DHAVE_MINCORE -DHAVE_ST_VDPAU -DHAVE_LLVM=0x0400 -DMESA_LLVM_VERSION_PATCH=1 -fvisibility=hidden -I/usr/include/libdrm   -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11    -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/loader -I../../src/egl/drivers/dri2 -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/drivers/dri2 -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/gbm/backends/dri -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/wayland/wayland-egl -I../../src/egl/wayland/wayland-drm -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/wayland/wayland-drm -DDEFAULT_DRIVER_DIR=\"/usr/lib32/dri\" -D_EGL_BUILT_IN_DRIVER_DRI2  -march=native -O2 -pipe -Wno-error -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-math-errno -fno-trapping-math   -Wl,-O1 -fuse-ld=bfd -fuse-ld=gold -o libEGL_common.la  main/eglapi.lo main/eglarray.lo main/eglconfig.lo main/eglcontext.lo main/eglcurrent.lo main/egldisplay.lo main/egldriver.lo main/eglfallbacks.lo main/eglglobals.lo main/eglimage.lo main/egllog.lo main/eglsurface.lo main/eglsync.lo drivers/dri2/egl_dri2.lo drivers/dri2/platform_x11.lo drivers/dri2/platform_wayland.lo drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo drivers/dri2/platform_drm.lo drivers/dri2/platform_surfaceless.lo  drivers/dri2/platform_x11_dri3.lo -ldl  -lpthread -pthread -lX11-xcb -lX11 -lxcb -lxcb-dri2 -lxcb-xfixes  ../../src/loader/libloader_dri3_helper.la -lwayland-client -lwayland-server  -ldrm  ../../src/egl/wayland/wayland-drm/libwayland-drm.la ../../src/util/libmesautil.la ../../src/gbm/libgbm.la  ../../src/loader/libloader.la -ldl -ldrm   
libtool: link: (cd .libs/libEGL_common.lax/libloader_dri3_helper.a && ar x "/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/egl/../../src/loader/.libs/libloader_dri3_helper.a")
libtool: link: (cd .libs/libEGL_common.lax/libwayland-drm.a && ar x "/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/egl/../../src/egl/wayland/wayland-drm/.libs/libwayland-drm.a")
libtool: link: (cd .libs/libEGL_common.lax/libmesautil.a && ar x "/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/egl/../../src/util/.libs/libmesautil.a")
libtool: link: (cd .libs/libEGL_common.lax/libloader.a && ar x "/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/egl/../../src/loader/.libs/libloader.a")
libtool: link: ar cru .libs/libEGL_common.a main/.libs/eglapi.o main/.libs/eglarray.o main/.libs/eglconfig.o main/.libs/eglcontext.o main/.libs/eglcurrent.o main/.libs/egldisplay.o main/.libs/egldriver.o main/.libs/eglfallbacks.o main/.libs/eglglobals.o main/.libs/eglimage.o main/.libs/egllog.o main/.libs/eglsurface.o main/.libs/eglsync.o drivers/dri2/.libs/egl_dri2.o drivers/dri2/.libs/platform_x11.o drivers/dri2/.libs/platform_wayland.o drivers/dri2/.libs/linux-dmabuf-unstable-v1-protocol.o drivers/dri2/.libs/platform_drm.o drivers/dri2/.libs/platform_surfaceless.o drivers/dri2/.libs/platform_x11_dri3.o   .libs/libEGL_common.lax/libloader_dri3_helper.a/loader_dri3_helper.o  .libs/libEGL_common.lax/libwayland-drm.a/wayland-drm-protocol.o .libs/libEGL_common.lax/libwayland-drm.a/wayland-drm.o  .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-bitscan.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-build_id.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-crc32.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-debug.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-disk_cache.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-format_srgb.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-half_float.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-hash_table.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-mesa-sha1.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-ralloc.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-rand_xor.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-register_allocate.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-rgtc.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-set.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-sha1.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-slab.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-string_to_uint_map.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-strtod.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-u_atomic.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-u_queue.o .libs/libEGL_common.lax/libmesautil.a/libmesautil_la-u_vector.o  .libs/libEGL_common.lax/libloader.a/libloader_la-loader.o .libs/libEGL_common.lax/libloader.a/libloader_la-pci_id_driver_map.o .libs/libEGL_common.lax/libloader.a/libxmlconfig_la-xmlconfig.o 
libtool: link: ranlib .libs/libEGL_common.a
libtool: link: rm -fr .libs/libEGL_common.lax
libtool: link: ( cd ".libs" && rm -f "libEGL_common.la" && ln -s "../libEGL_common.la" "libEGL_common.la" )
/bin/sh ../../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -m32 -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/include -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/main -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/gbm/main -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DNDEBUG -DTEXTURE_FLOAT_ENABLED -DHAVE_XLOCALE_H -DHAVE_SYS_SYSCTL_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_DLOPEN -DHAVE_DL_ITERATE_PHDR -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_USE_DRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_X11_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_WAYLAND_PLATFORM -DHAVE_DRM_PLATFORM -DHAVE_DRI3 -DENABLE_SHADER_CACHE -DHAVE_MINCORE -DHAVE_ST_VDPAU -DHAVE_LLVM=0x0400 -DMESA_LLVM_VERSION_PATCH=1 -fvisibility=hidden -I/usr/include/libdrm   -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11    -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/loader -I../../src/egl/drivers/dri2 -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/drivers/dri2 -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/gbm/backends/dri -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/wayland/wayland-egl -I../../src/egl/wayland/wayland-drm -I/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999/src/egl/wayland/wayland-drm -DDEFAULT_DRIVER_DIR=\"/usr/lib32/dri\" -D_EGL_BUILT_IN_DRIVER_DRI2  -march=native -O2 -pipe -Wno-error -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-math-errno -fno-trapping-math  -no-undefined -version-number 1:0 -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined -Wl,-O1 -fuse-ld=bfd -fuse-ld=gold -o libEGL.la -rpath /usr/lib32  libEGL_common.la 
libtool: link: x86_64-pc-linux-gnu-gcc -m32 -shared  -fPIC -DPIC  -Wl,--whole-archive ./.libs/libEGL_common.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/gbm/.libs -lpthread -lxcb-dri2 -lX11-xcb -lX11 -lxcb -lxcb-dri3 -lxcb-xfixes -lxcb-present -lxcb-sync -lxshmfence -lz /var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/gbm/.libs/libgbm.so -lwayland-client -lwayland-server -lexpat -lm -ldl -ldrm  -m32 -march=native -O2 -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined -Wl,-O1 -fuse-ld=bfd -fuse-ld=gold   -pthread -Wl,-soname -Wl,libEGL.so.1 -o .libs/libEGL.so.1.0.0
./.libs/libEGL_common.a(libmesautil_la-string_to_uint_map.o):string_to_uint_map.cpp:DW.ref.__gxx_personality_v0: error: undefined reference to '__gxx_personality_v0'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:1017: libEGL.la] Error 1
make[4]: Leaving directory '/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/egl'
make[3]: *** [Makefile:935: all] Error 2
make[3]: Leaving directory '/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src/egl'
make[2]: *** [Makefile:853: all-recursive] Error 1
make[2]: Leaving directory '/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src'
make[1]: *** [Makefile:644: all] Error 2
make[1]: Leaving directory '/var/tmp/paludis/media-libs-mesa-9999/work/mesa-9999-abi_x86_32.x86/src'
make: *** [Makefile:649: all-recursive] Error 1
Comment 1 Mike Lothian 2017-07-30 10:15:04 UTC

*** This bug has been marked as a duplicate of bug 11851 ***
Comment 2 Timo Aaltonen 2017-07-31 08:37:07 UTC

*** This bug has been marked as a duplicate of bug 101851 ***


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.