When I try to compile vcontrold (current master), I get
[ 14%] Building C object CMakeFiles/vclient.dir/src/socket.c.o
/Users/hmueller/src/raspberry/vcontrold/src/socket.c:78:5: warning: implicit declaration of function 'asprintf' is invalid in C99 [-Wimplicit-function-declaration]
asprintf(&port, "%d", tcpport);
^
/Users/hmueller/src/raspberry/vcontrold/src/socket.c:135:24: error: use of undeclared identifier 'NI_MAXHOST'
char clienthost [NI_MAXHOST];
^
/Users/hmueller/src/raspberry/vcontrold/src/socket.c:136:24: error: use of undeclared identifier 'NI_MAXSERV'
char clientservice[NI_MAXSERV];
^
1 warning and 2 errors generated.
I use OSX Catalina with XCode. cmake from brew.
cmake outputs
(hmueller@mbp2)~/src/raspberry/vcontrold/build> cmake -DVSIM=ON -DMANPAGES=OFF -DCMAKE_INSTALLATION_PREFIX=/usr/local ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found LibXml2: /usr/lib/libxml2.dylib (found version "2.9.4")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_INSTALLATION_PREFIX
-- Build files have been written to: /Users/hmueller/src/raspberry/vcontrold/build
So it looks like _POSIX_C_SOURCE is defined and _DARWIN_C_SOURCE is not.
If I add
set (CMAKE_C_FLAGS "-D_DARWIN_C_SOURCE ${CMAKE_C_FLAGS}")
into CMakeLists.txt this error is gone. But this might not be correct for all platforms.
When I try to compile vcontrold (current master), I get
I use OSX Catalina with XCode. cmake from brew. cmake outputs
Looking into /usr/include/netdb.h I see
So it looks like
_POSIX_C_SOURCE
is defined and_DARWIN_C_SOURCE
is not.If I add
set (CMAKE_C_FLAGS "-D_DARWIN_C_SOURCE ${CMAKE_C_FLAGS}")
into CMakeLists.txt this error is gone. But this might not be correct for all platforms.