diff --git a/CMakeLists.txt b/CMakeLists.txt index 3882731db..8842f0ded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,6 +108,9 @@ endif(WITH_SHELLHOOKS) add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS}) +# Always build PIC +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + set(ABSEIL_DIR vendor/abseil-cpp) add_subdirectory(vendor/gtest) @@ -117,9 +120,6 @@ add_subdirectory(vendor/cxxopts) add_subdirectory(vendor/nlohmann) include_directories(SYSTEM vendor/cxxopts/include) -# Always build PIC -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wno-unknown-warning-option) endif() diff --git a/Makefile b/Makefile index 274d530e0..f82077ddb 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,8 @@ CXX ?= c++ BUILD_TYPE ?= Debug -PYTHON ?= python3 +PYTHON ?= python +PYTHON3 ?= python3 SETCAP ?= which setcap && setcap cap_net_admin,cap_net_bind_service=+eip @@ -165,7 +166,7 @@ shadow-build: shadow-configure $(MAKE) -C $(BUILD_ROOT) shadow-run: shadow-build - $(PYTHON) $(REPO)/contrib/shadow/genconf.py $(SHADOW_CONFIG) + $(PYTHON3) $(REPO)/contrib/shadow/genconf.py $(SHADOW_CONFIG) cp $(SHADOW_PLUGIN) $(REPO)/libshadow-plugin-lokinet.so $(SHADOW_BIN) $(SHADOW_OPTS) $(SHADOW_CONFIG) | $(SHADOW_PARSE) @@ -187,7 +188,7 @@ testnet-build: testnet-configure testnet: cp $(EXE) $(TESTNET_EXE) mkdir -p $(TESTNET_ROOT) - $(PYTHON) $(REPO)/contrib/testnet/genconf.py --bin=$(TESTNET_EXE) --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF) --ifname=$(TESTNET_IFNAME) --baseport=$(TESTNET_BASEPORT) --ip=$(TESTNET_IP) --netid=$(TESTNET_NETID) + $(PYTHON3) $(REPO)/contrib/testnet/genconf.py --bin=$(TESTNET_EXE) --svc=$(TESTNET_SERVERS) --clients=$(TESTNET_CLIENTS) --dir=$(TESTNET_ROOT) --out $(TESTNET_CONF) --ifname=$(TESTNET_IFNAME) --baseport=$(TESTNET_BASEPORT) --ip=$(TESTNET_IP) --netid=$(TESTNET_NETID) LLARP_DEBUG=$(TESTNET_DEBUG) supervisord -n -d $(TESTNET_ROOT) -l $(TESTNET_LOG) -c $(TESTNET_CONF) $(TEST_EXE): debug @@ -279,7 +280,7 @@ docker-kubernetes: docker build -f docker/loki-svc-kubernetes.Dockerfile . install-pylokinet: - cd $(REPO)/contrib/py/pylokinet && $(PYTHON) setup.py install + cd $(REPO)/contrib/py/pylokinet && $(PYTHON3) setup.py install kubernetes-install: install install-pylokinet diff --git a/cmake/shadow.cmake b/cmake/shadow.cmake index 6bdd95bb1..deed362b1 100644 --- a/cmake/shadow.cmake +++ b/cmake/shadow.cmake @@ -14,5 +14,5 @@ include_directories(${CMAKE_MODULE_PATH}) include(ShadowTools) add_compile_options(-fno-inline -fno-strict-aliasing ) add_definitions(-DTESTNET=1) -add_definitions(-DSHADOW_TESTNET) +add_definitions(-DLOKINET_SHADOW) include_directories(${SHADOW_ROOT}/include) diff --git a/contrib/shadow/genconf.py b/contrib/shadow/genconf.py index 8cc6bf3b2..0a4c0794a 100644 --- a/contrib/shadow/genconf.py +++ b/contrib/shadow/genconf.py @@ -13,7 +13,7 @@ def getSetting(s, name, fallback): return name in s and s[name] or fallback shadowRoot = getSetting(os.environ, "SHADOW_ROOT", os.path.join(os.environ['HOME'], '.shadow')) -libpath = 'libshadow-plugin-lokinet-shared.so' +libpath = 'libshadow-plugin-lokinet.so' def nodeconf(conf, baseDir, name, ifname=None, port=None): diff --git a/llarp/testnet.c b/llarp/testnet.c index 60f501489..7825445be 100644 --- a/llarp/testnet.c +++ b/llarp/testnet.c @@ -1,4 +1,4 @@ -#ifdef SHADOW_TESTNET +#ifdef LOKINET_SHADOW #include /** insert shadow test network specific code here */ diff --git a/vendor/abseil-cpp/absl/debugging/internal/vdso_support.cc b/vendor/abseil-cpp/absl/debugging/internal/vdso_support.cc index 85b52bc8f..29162622f 100644 --- a/vendor/abseil-cpp/absl/debugging/internal/vdso_support.cc +++ b/vendor/abseil-cpp/absl/debugging/internal/vdso_support.cc @@ -184,7 +184,11 @@ int GetCPU() { // global constructors. static class VDSOInitHelper { public: - VDSOInitHelper() { VDSOSupport::Init(); } + VDSOInitHelper() { +#ifndef LOKINET_SHADOW + VDSOSupport::Init(); +#endif + } } vdso_init_helper; } // namespace debugging_internal