Skip to content

Link error of undefined reference to `pthread_create' with Icx compilers

I used Intel Icx compilers but at the end I met this error

/usr/bin/ld: /home/jczhang/openfoam/platforms/linux64IcxDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `pthread_create'

From the grep output, It seems it is because linux64Icx/c++ doesn't have -pthread?

$ pwd
/ccs/home/jczhang/openfoam/wmake/rules
$ grep -r pthread *
darwin64Clang/c++:c++ARCH    := -m64 -pthread -ftrapping-math
linux64Amd/c++:c++ARCH    := -m64 -pthread
linux64Clang/c++:c++ARCH    := -m64 -pthread
linux64Cray/c++:c++ARCH    := -m64 -pthread
linux64Gcc/c++:c++ARCH    := -m64 -pthread
linux64Icc/c++:c++ARCH    := -pthread -fp-trap=common -fp-model precise
linux64Mingw/c++:c++ARCH    := -m64 -pthread
linuxARM64Arm/c++:c++ARCH    := -mcpu=native -pthread
linuxARM64Clang/c++:c++ARCH    := -pthread
linuxARM64Fujitsu/c++:c++ARCH    := -pthread
linuxARM64Gcc/c++:c++ARCH    := -pthread
linuxClang/c++:c++ARCH    := -m32 -pthread
linuxGcc/c++:c++ARCH    := -m32 -pthread
linuxIcc/c++:c++ARCH    := -pthread -fp-trap=common -fp-model precise