Hi, I am trying to create a c++ project from existing source, but I am stuck with an error during the pre-build process and I can’t figure out what leads to it. The first one is a CMakeError, which is shown below:
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeTmpRun Build Command(s):C:/MinGW/msys/1.0/bin/make.exe -f Makefile cmTC_394d9/fast && /usr/bin/make -f CMakeFiles/cmTC_394d9.dir/build.make CMakeFiles/cmTC_394d9.dir/build
make[1]: Entering directory `/e/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeTmp’
Building C object CMakeFiles/cmTC_394d9.dir/src.c.objE:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/nbproject/private/tools/localhost/MinGW/gcc.exe -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_394d9.dir/src.c.obj -c E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeTmp/src.c
E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeTmp/src.c: In function ‘main’:
E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeTmp/src.c:15:3: warning: implicit declaration of function ‘pthread_atfork’; did you mean ‘pthread_join’? [-Wimplicit-function-declaration]
15 | pthread_atfork(NULL, NULL, NULL);
| ^~~~~~~~~~~~~~
| pthread_join
Linking C executable cmTC_394d9.exe“C:/Program Files/CMake/bin/cmake.exe” -E rm -f CMakeFiles/cmTC_394d9.dir/objects.a
C:/MinGW/bin/ar.exe cr CMakeFiles/cmTC_394d9.dir/objects.a @CMakeFiles/cmTC_394d9.dir/objects1.rsp
E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/nbproject/private/tools/localhost/MinGW/gcc.exe -Wl,–whole-archive CMakeFiles/cmTC_394d9.dir/objects.a -Wl,–no-whole-archive -o cmTC_394d9.exe -Wl,–out-implib,libcmTC_394d9.dll.a -Wl,–major-image-version,0,–minor-image-version,0 @CMakeFiles/cmTC_394d9.dir/linklibs.rsp
c:/mingw/bin/…/lib/gcc/mingw32/9.2.0/…/…/…/…/mingw32/bin/ld.exe: CMakeFiles/cmTC_394d9.dir/objects.a(src.c.obj):src.c:(.text+0x36): undefined reference to `_imp__pthread_create’c:/mingw/bin/…/lib/gcc/mingw32/9.2.0/…/…/…/…/mingw32/bin/ld.exe: CMakeFiles/cmTC_394d9.dir/objects.a(src.c.obj):src.c:(.text+0x4c): undefined reference to `_imp__pthread_detach’
c:/mingw/bin/…/lib/gcc/mingw32/9.2.0/…/…/…/…/mingw32/bin/ld.exe: CMakeFiles/cmTC_394d9.dir/objects.a(src.c.obj):src.c:(.text+0x62): undefined reference to `_imp__pthread_cancel’
c:/mingw/bin/…/lib/gcc/mingw32/9.2.0/…/…/…/…/mingw32/bin/ld.exe: CMakeFiles/cmTC_394d9.dir/objects.a(src.c.obj):src.c:(.text+0x80): undefined reference to `_imp__pthread_join’
c:/mingw/bin/…/lib/gcc/mingw32/9.2.0/…/…/…/…/mingw32/bin/ld.exe: CMakeFiles/cmTC_394d9.dir/objects.a(src.c.obj):src.c:(.text+0x9e): undefined reference to `pthread_atfork’
c:/mingw/bin/…/lib/gcc/mingw32/9.2.0/…/…/…/…/mingw32/bin/ld.exe: CMakeFiles/cmTC_394d9.dir/objects.a(src.c.obj):src.c:(.text+0xaa): undefined reference to `_imp__pthread_exit’
collect2.exe: error: ld returned 1 exit status
make[1]: *** [cmTC_394d9.exe] Error 1
make[1]: Leaving directory `/e/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeTmp’
make: *** [cmTC_394d9/fast] Error 2Source file was:
#include <pthread.h>static void* test_func(void* data)
{
return data;
}int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_cancel(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);return 0;
}
And the terminal output is:
cd ‘E:\Yifan\Hiwi-FSD\FluCo1\Libraries\fsd-libs\trunk\build-dev’
C:/Program Files/CMake/bin/cmake.exe -G Unix Makefiles -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/nbproject/private/tools/localhost/MinGW/gcc.exe -DCMAKE_CXX_COMPILER=E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/nbproject/private/tools/localhost/MinGW/g++.exe -DCMAKE_C_FLAGS_DEBUG=-g3 -gdwarf-2 -DCMAKE_CXX_FLAGS_DEBUG=-g3 -gdwarf-2 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DPROJECT_SUFFIX=-dev …
– The C compiler identification is GNU 9.2.0
– The CXX compiler identification is GNU 9.2.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/nbproject/private/tools/localhost/MinGW/gcc.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/nbproject/private/tools/localhost/MinGW/g++.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– The cmake will use build type Debug
– libfsd-io-dev version is 1.0+
– Install include dir include/fsd-io-dev
– fsd-io-dev PROJECT_SOURCE_DIR = E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/IO
– fsd-io-dev Build directory = E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev
– Found PkgConfig: C:/MinGW/bin/pkg-config.exe (found version “0.26”)
– Checking for one of the modules ‘openssl’
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPkgConfig.cmake:843 (message):
None of the required ‘openssl’ found
Call Stack (most recent call first):
IO/CMakeLists.txt:47 (pkg_search_module)– Looking for pthread.h
– Looking for pthread.h - found
– Performing Test CMAKE_HAVE_LIBC_PTHREAD
– Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
– Check if compiler accepts -pthread
– Check if compiler accepts -pthread - yes
– Found Threads: TRUE
– libfsd-log-dev version is 1.0+
– fsd-log-dev PROJECT_SOURCE_DIR = E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/Log
– fsd-log-dev Build directory = E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev
– Install include dir include/fsd-log-dev
– libfsd-math-dev version is 1.0+
– fsd-math-dev PROJECT_SOURCE_DIR = E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/Math
– fsd-math-dev Build directory = E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev
– Configuring incomplete, errors occurred!
See also “E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeOutput.log”.
See also “E:/Yifan/Hiwi-FSD/FluCo1/Libraries/fsd-libs/trunk/build-dev/CMakeFiles/CMakeError.log”.PRE-BUILD FAILED (exit value 1, total time: 8s)
Can anyone please help me about it? If you need any further information, I would be glad to offer. I have totally no idea about what’s the cause and where may I find it. I would really appreciate your help, thanksss!!