Page MenuHomePhabricator

OpenIGTLink does not link on Linux with CMake 3.16
Closed, WontfixPublic

Description

Linking CXX shared library ../bin/libOpenIGTLink.so
cd /home/stefan/MITK-superbuild-3.16/ep/src/OpenIGTLink-build/Source && /usr/bin/cmake -E cmake_link_script CMakeFiles/OpenIGTLink.dir/link.txt --verbose=1
/usr/bin/g++-8 -fPIC  -DBOOST_ALL_DYN_LINK -std=c++14  -ftemplate-depth-50 -fno-tree-vectorize -O3 -DNDEBUG   pthread -shared -Wl,-soname,libOpenIGTLink.so.3 -o ../bin/libOpenIGTLink.so.3.0.0 (...) -Wl,-rpath,:::::::::::::: -lm -lpthread 
g++-8: error: pthread: No such file or directory

There's an orphaned "pthread" in the command above additionally to "-lpthread". Possibly a CMake bug.

Event Timeline

kislinsk triaged this task as Normal priority.Dec 4 2019, 6:52 AM
kislinsk created this task.

A script to easily reproduce the error:

#!/usr/bin/env bash

# CMake executable
cmake=/usr/bin/cmake

# Download OpenIGTLink v3.0 source code from GitHub (only once)
[ ! -f ./OpenIGTLink-3.0.tar.gz ] && \
  curl -JLO https://github.com/openigtlink/OpenIGTLink/archive/v3.0.tar.gz

# Extract source code (only once)
[ ! -d ./OpenIGTLink-3.0 ] && \
  $cmake -E tar xzf ./OpenIGTLink-3.0.tar.gz

# Remove build directory
$cmake -E remove_directory ./OpenIGTLink-3.0-build

# Configure and generate
$cmake -G "Unix Makefiles" \
       -D BUILD_SHARED_LIBS:BOOL=ON \
       -D BUILD_TESTING:BOOL=OFF \
       -S ./OpenIGTLink-3.0 \
       -B ./OpenIGTLink-3.0-build

# Build
$cmake --build ./OpenIGTLink-3.0-build -- VERBOSE=1
kislinsk claimed this task.

Will be fixed in CMake 3.16.1.