[Pkg-cmake-team] Bug#897560: Bug#897560: cmake: CHECK_FUNCTION_EXISTS is broken

Felix Geyer fgeyer at debian.org
Thu May 3 16:45:26 BST 2018


Hi,

On 02.05.2018 23:45, Nicolas Braud-Santoni wrote:
> Package: cmake
> Version: 3.11.1-1
> Severity: important
>
> Dear cmake maintainers,
>
> CMake's CHECK_FUNCTION_EXISTS was seemingly broken in the last upload, resulting
> in configure failures when the function exists in headers but cannot be found by
> the linker:
>
>> Determining if the pthread_create exist failed with the following output:
>> Change Dir: /<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp
>>
>> Run Build Command:"/usr/bin/make" "cmTC_78338/fast"
>> make[2]: Entering directory '/<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp'
>> /usr/bin/make -f CMakeFiles/cmTC_78338.dir/build.make CMakeFiles/cmTC_78338.dir/build
>> make[3]: Entering directory '/<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp'
>> Building C object CMakeFiles/cmTC_78338.dir/CheckSymbolExists.c.o
>> /usr/bin/cc   -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/libgit2-0.27.0+dfsg.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2    -o CMakeFiles/cmTC_78338.dir/CheckSymbolExists.c.o   -c /<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp/CheckSymbolExists.c
>> Linking C executable cmTC_78338
>> /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_78338.dir/link.txt --verbose=1
>> /usr/bin/cc -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/libgit2-0.27.0+dfsg.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2   -Wl,-z,relro -Wl,-z,now  -rdynamic CMakeFiles/cmTC_78338.dir/CheckSymbolExists.c.o  -o cmTC_78338 
>> CMakeFiles/cmTC_78338.dir/CheckSymbolExists.c.o: In function `main':
>> ./build-debian-release/CMakeFiles/CMakeTmp/./build-debian-release/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: undefined reference to `pthread_create'
>> collect2: error: ld returned 1 exit status
>> make[3]: *** [CMakeFiles/cmTC_78338.dir/build.make:87: cmTC_78338] Error 1
>> make[3]: Leaving directory '/<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp'
>> make[2]: *** [Makefile:126: cmTC_78338/fast] Error 2
>> make[2]: Leaving directory '/<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp'
>>
>> File /<<BUILDDIR>>/libgit2-0.27.0+dfsg.1/build-debian-release/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
>> /* */
>> #include <pthread.h>
>>
>> int main(int argc, char** argv)
>> {
>>   (void)argv;
>> #ifndef pthread_create
>>   return ((int*)(&pthread_create))[argc];
>> #else
>>   (void)argc;
>>   return 0;
>> #endif
>> }

I guess you are taking about check_symbol_exists()?
Access to the source and a full error log (what's the check_symbol_exists() call that failed?)
would help a lot.

From a first glance though this looks like expected behavior.
You are testing for a library function so you need to set CMAKE_REQUIRED_LIBRARIES accordingly.

> As this results in other packages failing to build, please consider fixing ASAP.

Which packages? Can you give some examples?

Cheers,
Felix



More information about the Pkg-cmake-team mailing list