This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bam-readcount compilation with cmake 3.5.1 produces "list GET given empty list" error

To build bam-readcount, I cloned the bam-readcount repository, made a separate build directory, and from it entered cmake <repository dir>, resulting in the following output and errors:

-- The C compiler identification is GNU 4.1.2
-- The CXX compiler identification is GNU 4.1.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
CMake Error at build-common/cmake/VersionHelper.cmake:9 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:15 (include)


CMake Error at build-common/cmake/VersionHelper.cmake:10 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:15 (include)


CMake Error at build-common/cmake/VersionHelper.cmake:11 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:15 (include)


CMake Error at build-common/cmake/VersionHelper.cmake:14 (if):
  if given arguments:

    "STREQUAL" "-unstable"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:15 (include)


-- Configuring incomplete, errors occurred!
See also "/local/scratch/PACKAGES/src/bam-readcount/14Apr2016/build_directory/CMakeFiles/CMakeOutput.log".
See also "/local/scratch/PACKAGES/src/bam-readcount/14Apr2016/build_directory/CMakeFiles/CMakeError.log".

Checking CMakeError.log, it shows two errors:

CheckSymbolExists.c:(.text+0x18): undefined reference to `pthread_create'

and

/usr/bin/ld: cannot find -lpthreads

CMakeOutput.log didn't seem to have any errors in it.

Suggestions?

build error

Which OS? I am guessing MacOSX, as I've vaguely remember reading a few years ago its implementation of pthreads was broken. Or maybe your GCC is too old. And did you try something like:

find /usr/include -name "pthreads.h"

or

find /usr/ -name "pthreads.h"

1 answer

I had this problem in a restricted build environment (GNU Guix), and I was able to fix it by adding either Perl or Python2 to the environment (I'm not sure which fixed it).

Thanks for this pointer. As an additional data point, I ran into a similar issue in a restricted build environment for bioconda and adding perl to the environment fixes it for me.

Log in to answer this question.