<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - compiling glsl fails with undefined reference to `pthread_create'"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101071#c16">Comment # 16</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - compiling glsl fails with undefined reference to `pthread_create'"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101071">bug 101071</a>
              from <span class="vcard"><a class="email" href="mailto:john.ettedgui@gmail.com" title="John <john.ettedgui@gmail.com>"> <span class="fn">John</span></a>
</span></b>
        <pre>Hello,

I've been having the same issue for a while, even with Emil's patch on master:

libtool: link: ( cd "glsl/.libs" && rm -f "libstandalone.la" && ln -s
"../libstandalone.la" "libstandalone.la" )
/bin/sh ../../libtool  --tag=CXX   --mode=link g++ -fvisibility=hidden
-Werror=pointer-arith -Werror=vla -march=native -O2 -pipe
-fstack-protector-strong -fno-plt -fstack-check -flto=8 -g
-fvar-tracking-assignments -g -fvar-tracking-assignments -Wall -fno-math-errno
-fno-trapping-math   -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
-Wl,-flto -o glsl_compiler glsl/main.o glsl/libstandalone.la  
libtool: link: g++ -fvisibility=hidden -Werror=pointer-arith -Werror=vla
-march=native -O2 -pipe -fstack-protector-strong -fno-plt -fstack-check -flto=8
-g -fvar-tracking-assignments -g -fvar-tracking-assignments -Wall
-fno-math-errno -fno-trapping-math -Wl,-O1 -Wl,--sort-common -Wl,--as-needed
-Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-flto -o glsl_compiler glsl/main.o 
glsl/.libs/libstandalone.a -lz -lpthread -pthread
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/libstdc++.so: undefined
reference to `pthread_create'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/libstdc++.so: undefined
reference to `pthread_once'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/libstdc++.so: undefined
reference to `pthread_join'
collect2: error: ld returned 1 exit status


If I remove "--as-needed" from my LDFLAGS it compiles with no problem.

I'm on GCC 7.1.1, glibc 2.25, not cross-compiling, but compiling for my system.

What am I doing wrong?

Thanks!</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>