xkaraman left a comment (kamailio/kamailio#4551)

> **bullseye** 
> https://jenkins.kamailio.org/job/kamailiodev-nightly-binaries/117/consoleText
> 
> ```
> ./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c:11:
>  undefined reference to `pthread_create'
> /usr/bin/ld: 
> ./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c:12:
>  undefined reference to `pthread_detach'
> /usr/bin/ld: 
> ./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c:13:
>  undefined reference to `pthread_cancel'
> /usr/bin/ld: 
> ./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/./obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c:14:
>  undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status
> [...]
> /usr/bin/cc -g -O2 
> -ffile-prefix-map=/build/kamailio-6.1.0~pre0+bpo11.20260113075045.82=. 
> -fstack-protector-strong -Wformat -Werror=format-security -DVERSION_NODATE 
> -Wdate-time -D_FORTIFY_SOURCE=2 -DCHECK_FUNCTION_EXISTS=pthread_create 
> -Wl,-z,relro -Wl,-z,now  CMakeFiles/cmTC_73f5f.dir/CheckFunctionExists.c.o -o 
> cmTC_73f5f  -lpthreads 
> /usr/bin/ld: cannot find -lpthreads
> ```

this so far trying to compile from docker 
`https://github.com/kamailio/pkg-kamailio-docker/pkgs/container/pkg-kamailio-docker/640036598?tag=master-bullseye`:

The quoted error is not the actual error but some check that cmake does 
internally to check what thread library is available.
and their results found in this lines:
```
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- 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
```

The actual error is found lower in the logs where

```
CMake Error at 
/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
  Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) (found
  version "13.23")
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 
(_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.18/Modules/FindPostgreSQL.cmake:248 
(find_package_handle_standard_args)
  src/modules/db_postgres/CMakeLists.txt:5 (find_package)
```

1. Package `postgresql-server-dev-all` is required due to a bug in cmake 
`find_package` call. 
See error https://gitlab.kitware.com/cmake/cmake/-/issues/17223 with the fix in 
https://gitlab.kitware.com/cmake/cmake/-/commit/8b066f1a65466ae2dc542b097f877795f386f942
 fixed in `cmake v3.20`. Bullseye has 3.18.
Fix with installing (unused) package `apt install postgresql-server-dev-all`

2. Requested `libmicrohttpd >= 0.9.75` but version of libmicrohttpd is 
`0.9.72`. 
After resolving the first error, we now have this error due to 
`https://github.com/kamailio/kamailio/issues/3618`. Daniel suggest this was 
developed with `0.9.75` so i required that version and bullseye offers 
`0.9.72`. Was this build fine before with make? If so i can remove the 
requirement.
Another fix would be to exclude the module since it does not satisfy the 
requirements.

3.  Final error
```
CMake Error at cmake/modules/FindNETSNMP.cmake:58 (set_target_properties):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "COMPILE_FLAGS" is not allowed.
Call Stack (most recent call first):
  src/modules/snmpstats/CMakeLists.txt:6 (find_package)
```
This is due to old CMake again but it's easily fixed with a patch. See 
https://discourse.cmake.org/t/how-to-find-current-interface-library-property-whitelist/4784.
 Before `v3.19` it required the properties to be prefixed with `INTERFACE_`.

After doing the changes in 1. and 2. and changing `COMPILE_FLAGS` to 
`INTERFACE_COMPILE_FLAGS`, it seems to build correctly. will test also on 
bookworm and trixie to verify i didnt break anything else.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4551#issuecomment-3744304838
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/4551/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to