linux build fixes

This commit is contained in:
Joseph Henry
2016-06-27 10:54:13 -07:00
parent 51cef4539f
commit f657da5d18
3 changed files with 13 additions and 21 deletions

View File

@@ -81,20 +81,23 @@ one: $(OBJS) service/OneService.o one.o osdep/LinuxEthernetTap.o
ln -sf zerotier-one zerotier-idtool
ln -sf zerotier-one zerotier-cli
osx_shared_lib: $(OBJS)
shared_lib: $(OBJS)
rm -f *.o
# Need to selectively rebuild one.cpp and OneService.cpp with ZT_SERVICE_NETCON and ZT_ONE_NO_ROOT_CHECK defined, and also NetconEthernetTap
$(CXX) $(CXXFLAGS) $(LDFLAGS) -DZT_SDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -Izerotierone/osdep -Izerotierone/node -Isrc -o build/zerotier-sdk-service $(OBJS) zerotierone/service/OneService.cpp src/SDK_EthernetTap.cpp src/SDK_Proxy.cpp zerotierone/one.cpp -x c src/SDK_RPC.c $(LDLIBS) -ldl
# Build liblwip.so which must be placed in ZT home for zerotier-sdk-service to work
# Build liblwip.so which must be placed in ZT home for zerotier-netcon-service to work
make -f make-liblwip.mk
# Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility
cd src ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -I../zerotierone/node -nostdlib -shared -o libztintercept.so SDK_Sockets.c SDK_Intercept.c SDK_Debug.c SDK_RPC.c -ldl
mkdir -p build/osx_shared_lib
cp src/libztintercept.so build/osx_shared_lib/libztintercept.so
cd src ; gcc $(DEFS) -g -O2 -Wall -std=c99 -fPIC -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -I../zerotierone/node -nostdlib -shared -o libztintercept.so SDK_Sockets.c SDK_Intercept.c SDK_Debug.c SDK_RPC.c -ldl
mkdir -p build/linux_shared_lib
cp src/libztintercept.so build/linux_shared_lib/libztintercept.so
ln -sf zerotier-sdk-service zerotier-cli
ln -sf zerotier-sdk-service zerotier-idtool
clean:
rm -rf ${GENERATED_FILES} *.so *.o netcon/*.a node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o ext/miniupnpc/*.o ext/libnatpmp/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-cli zerotier-selftest zerotier-netcon-service build-* ZeroTierOneInstaller-* *.deb *.rpm .depend netcon/.depend
find netcon -type f \( -name '*.o' -o -name '*.so' -o -name '*.1.0' -o -name 'zerotier-one' -o -name 'zerotier-cli' -o -name 'zerotier-netcon-service' \) -delete
find netcon/tests/docker -name "zerotier-intercept" -type f -delete
rm -rf zerotier-cli zerotier-idtool
rm -rf build/*
find . -type f -name '*.o' -delete
@@ -105,13 +108,3 @@ clean:
rm -rf integrations/Android/proj/.gradle
rm -rf integrations/Android/proj/.idea
rm -rf integrations/Android/proj/build
clean: FORCE
rm -rf ${GENERATED_FILES} *.so *.o netcon/*.a node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o ext/json-parser/*.o ext/miniupnpc/*.o ext/libnatpmp/*.o $(OBJS) zerotier-one zerotier-idtool zerotier-cli zerotier-selftest zerotier-netcon-service build-* ZeroTierOneInstaller-* *.deb *.rpm .depend netcon/.depend
find netcon -type f \( -name '*.o' -o -name '*.so' -o -name '*.1.0' -o -name 'zerotier-one' -o -name 'zerotier-cli' -o -name 'zerotier-netcon-service' \) -delete
find netcon/tests/docker -name "zerotier-intercept" -type f -delete
# Includes 'doc' target
include ${DOC_DIR}/module.mk
FORCE:

View File

@@ -29,6 +29,7 @@
#define _ZT_SDK_H 1
#include <sys/socket.h>
#include <stdbool.h>
#include "SDK_Signatures.h"
#ifdef __cplusplus
@@ -77,13 +78,11 @@ ssize_t zt_recvmsg(RECVMSG_SIG);
int zt_set_nonblock(int fd);
#endif
int zt_socket(SOCKET_SIG);
int zt_connect(CONNECT_SIG);
int zt_bind(BIND_SIG);
#if defined(__linux__)
int zt_accept4(ACCEPT_SIG);
int zt_accept4(ACCEPT4_SIG);
#endif
int zt_accept(ACCEPT_SIG);
int zt_listen(LISTEN_SIG);

View File

@@ -449,7 +449,7 @@ const char *get_netpath() {
// ------------------------------------------------------------------------------
// int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags
#if defined(__linux)
#if defined(__linux__)
int zt_accept4(ACCEPT4_SIG)
{
dwr(MSG_DEBUG,"zt_accept4(%d):\n", sockfd);