Created attachment 476322 [details] emerge --info On my hardened ~amd64 system I see the following build failure for mesa. This is happening for quite some time (last successful merge was for mesa-17.0.4). Any hints on what to do? libtool: link: x86_64-pc-linux-gnu-g++ -fvisibility=hidden -Werror=pointer-arith -Werror=vla -O2 -pipe -march=native -finline-functions -floop-nest-optimize -flto=4 -Wall -fno-math-errno -fno-trapping-math -Wl,-O1 -Wl,--as-needed -o glsl_compiler glsl/main.o glsl/.libs/libstandalone.a -lz -lpthread /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so: undefined reference to `pthread_create' /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so: undefined reference to `pthread_once' /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libstdc++.so: undefined reference to `pthread_join'
Created attachment 476324 [details] build log (bzipped)
Does it build with LTO disabled?
Indeed disabling LTO made the issue go away. I must have missed this in one debugging round and then thought that I checked it.
Try please to add '-Wl,--no-as-needed' before -lpthread so it becomes x86_64-pc-linux-gnu-g++ -fvisibility=hidden -Werror=pointer-arith -Werror=vla -O2 -pipe -march=native -finline-functions -floop-nest-optimize -flto=4 -Wall -fno-math-errno -fno-trapping-math -Wl,-O1 -Wl,--as-needed -o glsl_compiler glsl/main.o glsl/.libs/libstandalone.a -lz -Wl,--no-as-needed -lpthread
(In reply to David Kredba from comment #4) > Try please to add '-Wl,--no-as-needed' before -lpthread so it becomes > > x86_64-pc-linux-gnu-g++ -fvisibility=hidden -Werror=pointer-arith > -Werror=vla -O2 -pipe -march=native -finline-functions -floop-nest-optimize > -flto=4 -Wall -fno-math-errno -fno-trapping-math -Wl,-O1 -Wl,--as-needed -o > glsl_compiler glsl/main.o glsl/.libs/libstandalone.a -lz -Wl,--no-as-needed > -lpthread This worked too. :) However I have no idea how to convince the Makefile to add this programmatically (I just ran the command by hand).
Mesa added -pthread to PTHREAD_LIBS in the "Bug 101071 - compiling glsl fails with undefined reference to `pthread_create' "(https://bugs.freedesktop.org/show_bug.cgi?id=101071).
This is fixed in mesa-17.1.4.