Bug 101851 - [regression] libEGL_common.a undefined reference to '__gxx_personality_v0'
Summary: [regression] libEGL_common.a undefined reference to '__gxx_personality_v0'
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
: 101971 (view as bug list)
Depends on:
Blocks: 101911
  Show dependency treegraph
 
Reported: 2017-07-19 23:31 UTC by Mike Lothian
Modified: 2017-08-29 14:27 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Build log (53.95 KB, application/x-xz)
2017-07-19 23:31 UTC, Mike Lothian
Details

Description Mike Lothian 2017-07-19 23:31:30 UTC
Created attachment 132780 [details]
Build log

Here's the error:

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/portage/media-libs/mesa-9999/work/mesa-9999/include -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/egl/main -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/gbm/main -I/var/tmp/portage/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 -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -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=0x0500 -DMESA_LLVM_VERSION_PATCH=0 -fvisibility=hidden -I/usr/include/libdrm  -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11    -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/loader -I../../src/egl/drivers/dri2 -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/egl/drivers/dri2 -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/gbm/backends/dri -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/egl/wayland/wayland-egl -I../../src/egl/wayland/wayland-drm -I/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/egl/wayland/wayland-drm -DDEFAULT_DRIVER_DIR=\"/usr/lib32/dri\" -D_EGL_BUILT_IN_DRIVER_DRI2  -O2 -march=native -pipe -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 -Wl,--hash-style=gnu -Wl,--as-needed -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/portage/media-libs/mesa-9999/work/mesa-9999-abi_x86_32.x86/src/gbm/.libs -Wl,--as-needed -lpthread -lxcb-dri2 -lX11-xcb -lX11 -lxcb -lxcb-dri3 -lxcb-xfixes -lxcb-present -lxcb-sync -lxshmfence -lz /var/tmp/portage/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 -O2 -march=native -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined -Wl,-O1 -Wl,--hash-style=gnu   -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

I've attached the full log too

I think it should be using g++ or including -lstdc++
Comment 1 Mike Lothian 2017-07-27 19:44:56 UTC
I was asked to bisect this

02cc359372773800de817950aebdf9be2c7973d1 is the first bad commit
commit 02cc359372773800de817950aebdf9be2c7973d1
Author: Daniel Stone <daniels@collabora.com>
Date:   Fri Jun 16 18:01:23 2017 +0100

    egl/wayland: Use linux-dmabuf interface for buffers
    
    When available, use the zwp_linux_dambuf_v1 interface to create buffers,
    which allows multiple planes and buffer modifiers to be used.
    
    Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Comment 2 Mike Lothian 2017-07-27 20:12:54 UTC
Realise I never mentioned in the bug, this only happens with ld.gold, not ld.bfd

It can be controlled with passing -fuse-ld=bfd or -fuse-ld=gold in your LD_FLAGS
Comment 3 Emil Velikov 2017-07-28 13:45:05 UTC
I'll look into solving this today - either inlining the dynarray implementation into the header, converting the required code to C or adding a link.
Comment 4 Timo Aaltonen 2017-07-31 08:37:07 UTC
*** Bug 101971 has been marked as a duplicate of this bug. ***
Comment 5 Mike Lothian 2017-08-11 10:41:53 UTC
I'm seeing this with 17.2-rc2 even when passing -fuse-ld=bfd

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 -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/include -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/egl/main -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/gbm/main -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/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 -DUSE_X86_64_ASM -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 -DENABLE_SHADER_CACHE -DHAVE_MINCORE -fvisibility=hidden -I/usr/include/libdrm  -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11    -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/loader -I../../src/egl/drivers/dri2 -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/egl/drivers/dri2 -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/gbm/backends/dri -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/egl/wayland/wayland-egl -I../../src/egl/wayland/wayland-drm -I/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3/src/egl/wayland/wayland-drm -DDEFAULT_DRIVER_DIR=\"/usr/lib64/dri\" -D_EGL_BUILT_IN_DRIVER_DRI2  -O2 -march=native -pipe -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 -Wl,--hash-style=gnu -Wl,--as-needed -fuse-ld=bfd -o libEGL.la -rpath /usr/lib64  libEGL_common.la
libtool: link: x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  -Wl,--whole-archive ./.libs/libEGL_common.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3-abi_x86_64.amd64/src/gbm/.libs -lpthread -lX11-xcb -lX11 -lxcb -lxcb-dri2 -lxcb-xfixes -lz /var/tmp/portage/media-libs/mesa-17.2.0_rc3/work/mesa-17.2.0-rc3-abi_x86_64.amd64/src/gbm/.libs/libgbm.so -lwayland-client -lwayland-server -lexpat -lm -ldl -ldrm  -O2 -march=native -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed   -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
Comment 6 Steve Arnold 2017-08-20 00:51:48 UTC
I think one of the main problems is libtool failing to pass flags specified by the user; note in the previous comment #5 it fails to pass "-fuse-ld=bfd".  Also, I'm assuming the upstream flag -Wl,--no-undefined is recent otherwise this would be visible in previous versions.  So I think the real answer for now is g++ and -lstdc++ as needed, then long-term get rid of libtool and use pkg-config instead.  Just my $0.02...
Comment 7 Emil Velikov 2017-08-26 09:57:53 UTC
(In reply to Steve Arnold from comment #6)
> I think one of the main problems is libtool failing to pass flags specified
> by the user; note in the previous comment #5 it fails to pass
> "-fuse-ld=bfd".  Also, I'm assuming the upstream flag -Wl,--no-undefined is
> recent otherwise this would be visible in previous versions.  So I think the
> real answer for now is g++ and -lstdc++ as needed, then long-term get rid of
> libtool and use pkg-config instead.  Just my $0.02...

Most of this is off I'm afraid. I'm 99.9% sure that -fuse-ld... works correctly, since Mike uses Gentoo and they pull the following patch. 

http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=f9970d99293faf908fdc153a653fa5781095fb7a

While the -Wl,--no-undefined flag has been around since 2014 with commit d187a150d45cbf5bd3476eab49be5057382c2c86.

All, please try ti the following patch - it resolves the problem on my end.

https://patchwork.freedesktop.org/patch/173778/
Comment 8 James Harvey 2017-08-26 11:29:45 UTC
Hi Emil,
 I applied your patch against mesa-17.2.0_rc5 on gentoo, it fixed the build failure for me.  I did a quick test with eglgears on both X11 and wayland and didn't see any problems.  Thanks!
Comment 9 Mike Lothian 2017-08-29 09:43:54 UTC
I've just tested this patch with 17.2-rc5 it does indeed allow compilation with ld.gold again :D

Feel free to add my tested by, hope this lands in 17.2 final
Comment 10 Emil Velikov 2017-08-29 14:27:58 UTC
Thanks all. Merged as

commit 0ac78dc92582a59d4319ebce019b4caa41fb432d
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Sat Aug 26 02:37:11 2017 +0100

    util: move string_to_uint_map to glsl


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.