title: Build cython extension in fresh environment: cannot find /lib/libpthread.so.0
body: <p>I am trying to deploy a package that uses some cython extensions. I have written the following setup script:</p>
  
  <pre><code>import os
  import sys
  from setuptools import setup, Extension
  
  # factory function
  def my_build_ext(pars):
      # import delayed:
      from setuptools.command.build_ext import build_ext as _build_ext
  
      # include_dirs adjusted: 
      class build_ext(_build_ext):
          def finalize_options(self):
              _build_ext.finalize_options(self)
              # Prevent numpy from thinking it is still in its setup process:
              __builtins__.__NUMPY_SETUP__ = False
              import numpy
              self.include_dirs.append(numpy.get_include())
  
      #object returned:
      return build_ext(pars)
  
  # cython c++ extensions
  extnames = [
      'npextc',
      'intquickheapdict',
      'FixedOrderedIntDict'
      ]
  
  ...
  
  PATHADD = 'vemomoto_core/npcollections/'
  PACKAGEADD = PATHADD.replace("/", ".")
  
  ext = '.pyx'
  
  extensions = [Extension(PACKAGEADD+name, [PATHADD+name+ext],
                          extra_compile_args=['-std=c++11', '-O3']+parcompileargs,
                          extra_link_args=parlinkargs,
                          )
                for name in extnames]
  for e in extensions:
      e.language_level = 3
      e.language = 'c++'
  
  setup(
      name="vemomoto_core_npcollections",
      version="0.9.0.a7",
      cmdclass={'build_ext' : my_build_ext},
      setup_requires=['numpy', 'setuptools&gt;=18.0'],
      install_requires=['numpy', 'scipy'], 
      python_requires='&gt;=3.6',
      packages=['vemomoto_core', PACKAGEADD[:-1]],
      ext_modules=extensions,
      package_data={
          '': ['*.pxd', '*.pyx', '*.c', '*.cpp'],
      },
      zip_safe=False,
  )
  </code></pre>
  
  <p>When I build the package via executing <code>pip install .</code> in the directory of the <code>setup.py</code>, everything works fine as long as I work in my default environment. However, when I test the process in a fresh testing environment, I get the error</p>
  
  <pre><code>    /home/user/anaconda3/envs/test37/compiler_compat/ld: cannot find /lib/libpthread.so.0
      /home/user/anaconda3/envs/test37/compiler_compat/ld: cannot find /usr/lib/libpthread_nonshared.a
      collect2: error: ld returned 1 exit status
      error: command 'g++' failed with exit status 1
  </code></pre>
  
  <p>(Full output is below.)</p>
  
  <p>I assume that there is some dependency missing here, but I have no idea how I could find out what it is and thus how to resolve the error. What could I do?</p>
  
  <p>Full error message:</p>
  
  <pre><code>Building wheels for collected packages: vemomoto-core-npcollections                                                                                                                                   [76/1898]
    Building wheel for vemomoto-core-npcollections (setup.py) ... error
    ERROR: Command errored out with exit status 1:
     command: /home/user/anaconda3/envs/test37/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-0_ns61r9/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-0_ns61r9/se
  tup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-4zeu
  yeay
         cwd: /tmp/pip-req-build-0_ns61r9/
    Complete output (49 lines):
    /home/user/anaconda3/envs/test37/lib/python3.7/site-packages/setuptools/dist.py:476: UserWarning: Normalizing '0.9.0.a1' to '0.9.0a1'
      normalized_version,
    running bdist_wheel
    running build
    running build_py
    package init file 'vemomoto_core/__init__.py' not found (or not a regular file)
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/vemomoto_core
    creating build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/_setup_npextc.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/sparse3d.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/_setup_FixedOrderedIntDict.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/_FixedOrderedIntDict_reduce.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/__init__.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections                                                                                                      copying vemomoto_core/npcollections/_setup_intquickheapdict.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections                                                                                       copying vemomoto_core/npcollections/npext.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/_npextc_utils.py -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/__init__.pxd -&gt; build/lib.linux-x86_64-3.7/vemomoto_core
    copying vemomoto_core/npcollections/FixedOrderedIntDict.pxd -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/npextc.pxd -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/intquickheapdict.pxd -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/intquickheapdict.pyx -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections                                                                                             copying vemomoto_core/npcollections/npextc.pyx -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/FixedOrderedIntDict.pyx -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/heapoperations_c.c -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/sectionsum.c -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections                                                                                                     copying vemomoto_core/npcollections/intquickheapdict.cpp -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections                                                                                             copying vemomoto_core/npcollections/FixedOrderedIntDict.cpp -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    copying vemomoto_core/npcollections/npextc.cpp -&gt; build/lib.linux-x86_64-3.7/vemomoto_core/npcollections
    running build_ext
    building 'vemomoto_core.npcollections.npextc' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/vemomoto_core
    creating build/temp.linux-x86_64-3.7/vemomoto_core/npcollections                                                                                                                                               gcc -pthread -B /home/user/anaconda3/envs/test37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/anaconda3/envs/test37/include/python3.7m -I/home/user/anaconda3/envs/test37/lib/python3.7/site-packages/numpy/core/include -c vemomoto_core/npcollections/npextc.cpp -o build/temp.linux-x86_64-3.7/vemomoto_core/npcollections/npextc.o -std=c++11 -O3 -fopenmp
    cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
    In file included from /home/user/anaconda3/envs/test37/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
                     from /home/user/anaconda3/envs/test37/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                     from /home/user/anaconda3/envs/test37/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from vemomoto_core/npcollections/npextc.cpp:636:
    /home/user/anaconda3/envs/test37/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEP
  RECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it with " \
      ^~~~~~~
    g++ -pthread -shared -B /home/user/anaconda3/envs/test37/compiler_compat -L/home/user/anaconda3/envs/test37/lib -Wl,-rpath=/home/user/anaconda3/envs/test37/lib -Wl,--no-as-needed -Wl,--sysroot=
  / -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections build/temp.linux-x86_64-3.7/vemomoto_core/npcollections/npextc.o -o build/lib.linux-x86_64-3.7/ve
  momoto_core/npcollections/npextc.cpython-37m-x86_64-linux-gnu.so -fopenmp
    /home/user/anaconda3/envs/test37/compiler_compat/ld: cannot find /lib/libpthread.so.0
    /home/user/anaconda3/envs/test37/compiler_compat/ld: cannot find /usr/lib/libpthread_nonshared.a
    collect2: error: ld returned 1 exit status
    error: command 'g++' failed with exit status 1
    ----------------------------------------
    ERROR: Failed building wheel for vemomoto-core-npcollections
    Running setup.py clean for vemomoto-core-npcollections
  Failed to build vemomoto-core-npcollections
  
  </code></pre>