signalwire/libks

FreeBSD build error

fx02 opened this issue · 3 comments

fx02 commented

Building this on FreeBSD 11.2 failed:

/root/src/libks-1.2.0/src/ks_thread.c:142:17: error: use of undeclared identifier 'SYS_gettid'; did you mean 'SSL_get_fd'?
        return syscall(SYS_gettid);
                       ^~~~~~~~~~
                       SSL_get_fd
/usr/local/include/openssl/ssl.h:2148:5: note: 'SSL_get_fd' declared here
int SSL_get_fd(const SSL *s);
    ^
/root/src/libks-1.2.0/src/ks_thread.c:237:21: error: use of undeclared identifier 'pthread_setname_np'
        if (thread->tag && pthread_setname_np)

Reopening... there is a way to build this in FreeBSD?
A tutorial, patch or something else?

Since Freeswitch become a product of signalwire, many things have changed, like some modules depending on a lib that doesn't compile in FreeBSD.

I just commented the line in ks_thread.c

return syscall(SYS_gettid);

changed

cmake .
to
cmake . -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++

After that, just
make
make install

tm-up commented

Instead of commenting the line out, one could write:
#include <pthread_np.h>
return pthread_getthreadid_np();

This suggestion I have found here: https://reviews.llvm.org/D59735

The good news is, that the tests pass (the time test needs a bit more tolerance; the Ipv6 failed because I have no IPv6 configured).