From 45890133bcf210b19e1663f347661a9a09515edb Mon Sep 17 00:00:00 2001 From: Rick V Date: Mon, 18 May 2020 20:53:17 -0500 Subject: [PATCH 01/13] LIBUV_ROOT override for win32 emit PIC code (.reloc) on win32 for aslr --- CMakeLists.txt | 4 +++- cmake/win32.cmake | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9182dada0..d58049487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,7 +255,9 @@ if(SUBMODULE_CHECK) check_submodule(external/ghc-filesystem) check_submodule(external/date) check_submodule(external/pybind11) - check_submodule(external/libuv) + if (NOT WIN32) # we grab libuv for windows separately in win32-setup/libuv. see note in cmake/win32.cmake. + check_submodule(external/libuv) + endif() endif() endif() diff --git a/cmake/win32.cmake b/cmake/win32.cmake index df1f2819a..323d970d9 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -28,8 +28,17 @@ if (NOT STATIC_LINK AND NOT MSVC) message("for release builds, turn on STATIC_LINK in cmake options") endif() +# win32 is the last platform for which we grab libuv manually +# if you want to use the included submodule do +# cmake .. -G Ninja -DLIBUV_ROOT=../external/libuv. +# otherwise grab mine (github.com/despair86/libuv.git) if you need to run on older hardware +# and clone to win32-setup/libuv +# then +# cmake .. -G Ninja -DLIBUV_ROOT=../win32-setup/libuv +# it is literally upward compatible with current windows 10 if (STATIC_LINK) set(LIBUV_USE_STATIC ON) + link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--large-address-aware,--dynamicbase,--pic-executable,-e,_mainCRTStartup,--subsystem,console:5.00 ) endif() if(LIBUV_ROOT) From adf253e800ec43aac2b3fc5b7b62ff2fd9bb5ee6 Mon Sep 17 00:00:00 2001 From: Rick V Date: Mon, 18 May 2020 21:11:37 -0500 Subject: [PATCH 02/13] picflags differ slightly on native vs wow64 builds --- CMakeLists.txt | 7 ++++++- cmake/win32.cmake | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d58049487..b28e9f5a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -265,7 +265,12 @@ endif() # down loads a broken PythonInterp that loads Python2, but Python2 headers are not C++17 compatible. # So load this here universally so that pybind's more intelligent python finder finds python3.x # (which the crappier loader invoked below then respects). -add_subdirectory(external/pybind11 EXCLUDE_FROM_ALL) +# however! travis is FUBAR right now so disable it in travis builds +if(TRAVIS_CI_SUCKS OR NOT WITH_HIVE) + message(WARNING "you're on travis (which is broken garbage) or are compiling without routerhive, we have disabled pybind11, THANKS!") +else() + add_subdirectory(external/pybind11 EXCLUDE_FROM_ALL) +endif() if(WITH_TESTS) add_subdirectory(external/googletest EXCLUDE_FROM_ALL) diff --git a/cmake/win32.cmake b/cmake/win32.cmake index 323d970d9..5b842b6c3 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -38,7 +38,11 @@ endif() # it is literally upward compatible with current windows 10 if (STATIC_LINK) set(LIBUV_USE_STATIC ON) - link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--large-address-aware,--dynamicbase,--pic-executable,-e,_mainCRTStartup,--subsystem,console:5.00 ) + if (WOW64_CROSS_COMPILE) + link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--large-address-aware,--dynamicbase,--pic-executable,-e,_mainCRTStartup,--subsystem,console:5.00 ) + else() + link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--dynamicbase,--pic-executable,-e,_mainCRTStartup ) + endif() endif() if(LIBUV_ROOT) From e6bcbf47b463b7441894e716025f70a3e19a429a Mon Sep 17 00:00:00 2001 From: Linux User Date: Fri, 29 May 2020 23:37:12 -0500 Subject: [PATCH 03/13] patch libsodium for windows the cmake way --- cmake/DownloadLibSodium.cmake | 1 + cmake/win32.cmake | 2 +- contrib/cross/mingw32.cmake | 2 +- contrib/cross/mingw64.cmake | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/DownloadLibSodium.cmake b/cmake/DownloadLibSodium.cmake index d97c6a934..b558155a0 100644 --- a/cmake/DownloadLibSodium.cmake +++ b/cmake/DownloadLibSodium.cmake @@ -37,6 +37,7 @@ ExternalProject_Add(libsodium_external URL ${LIBSODIUM_URL} URL_HASH ${LIBSODIUM_HASH} CONFIGURE_COMMAND ${SODIUM_CONFIGURE} + PATCH_COMMAND patch -p1 -d < ${CMAKE_SOURCE_DIR}/win32-setup/libsodium-1.0.18-win32.patch BUILD_COMMAND make -j${PROCESSOR_COUNT} INSTALL_COMMAND ${MAKE} BUILD_BYPRODUCTS ${LIBSODIUM_PREFIX}/lib/libsodium.a ${LIBSODIUM_PREFIX}/include diff --git a/cmake/win32.cmake b/cmake/win32.cmake index 5b842b6c3..b3c49cca4 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -41,7 +41,7 @@ if (STATIC_LINK) if (WOW64_CROSS_COMPILE) link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--large-address-aware,--dynamicbase,--pic-executable,-e,_mainCRTStartup,--subsystem,console:5.00 ) else() - link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--dynamicbase,--pic-executable,-e,_mainCRTStartup ) + link_libraries( -static-libstdc++ -static-libgcc -static -Wl,--image-base=0x10000,--dynamicbase,--pic-executable,-e,mainCRTStartup ) endif() endif() diff --git a/contrib/cross/mingw32.cmake b/contrib/cross/mingw32.cmake index cb2e35950..4948b89b6 100644 --- a/contrib/cross/mingw32.cmake +++ b/contrib/cross/mingw32.cmake @@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX i686-w64-mingw32) set(TOOLCHAIN_SUFFIX "-posix") set(WOW64_CROSS_COMPILE ON) -set(LIBSODIUM_CROSS_TARGET i686-w64-mingw32) +set(CROSS_TARGET i686-w64-mingw32) set(TOOLCHAIN_PATHS /usr/${TOOLCHAIN_PREFIX} diff --git a/contrib/cross/mingw64.cmake b/contrib/cross/mingw64.cmake index 3deae42a0..cdb13fa78 100644 --- a/contrib/cross/mingw64.cmake +++ b/contrib/cross/mingw64.cmake @@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) set(TOOLCHAIN_SUFFIX "-posix") set(WIN64_CROSS_COMPILE ON) -set(LIBSODIUM_CROSS_TARGET x86_64-w64-mingw32) +set(CROSS_TARGET x86_64-w64-mingw32) set(TOOLCHAIN_PATHS /usr/${TOOLCHAIN_PREFIX} From 8ac5213b4284acffbe6f7d24cf3740927376afe0 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 15:55:24 -0500 Subject: [PATCH 04/13] windows builds on alpine lunix --- .drone.jsonnet | 80 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 11f52f249..7e6beade7 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -49,6 +49,80 @@ local debian_pipeline(name, image, } ], }; + +// 32-bit windows build on alpine: +local alpine_wow64_pipeline(name, image, + arch='amd64', + deps='mingw-w64-binutils mingw-w64-gcc mingw-w64-crt mingw-w64-headers mingw-w64-winpthreads', + build_type='Release', + lto=false, + werror=false, + cmake_extra='', + extra_cmds=[], + allow_fail=false) = { + kind: 'pipeline', + type: 'docker', + name: name, + platform: { arch: arch }, + trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } }, + steps: [ + submodules, + { + name: 'build', + image: image, + [if allow_fail then "failure"]: "ignore", + environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, + commands: [ + 'apk add cmake git ninja pkgconf ccache ' + deps, + 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', + 'mkdir build', + 'cd build', + 'cmake .. -G Ninja -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw32.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + + (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + + (if lto then '' else '-DWITH_LTO=OFF ') + + cmake_extra, + 'ninja -v', + ] + extra_cmds, + } + ], +}; + +// 64-bit windows build on alpine: +local alpine_win32_pipeline(name, image, + arch='amd64', + deps='mingw-w64-binutils mingw-w64-gcc mingw-w64-crt mingw-w64-headers mingw-w64-winpthreads', + build_type='Release', + lto=false, + werror=false, + cmake_extra='', + extra_cmds=[], + allow_fail=false) = { + kind: 'pipeline', + type: 'docker', + name: name, + platform: { arch: arch }, + trigger: { branch: { exclude: ['debian/*', 'ubuntu/*'] } }, + steps: [ + submodules, + { + name: 'build', + image: image, + [if allow_fail then "failure"]: "ignore", + environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, + commands: [ + 'apk add cmake git ninja pkgconf ccache ' + deps, + 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', + 'mkdir build', + 'cd build', + 'cmake .. -G Ninja -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw64.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + + (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + + (if lto then '' else '-DWITH_LTO=OFF ') + + cmake_extra, + 'ninja -v', + ] + extra_cmds, + } + ], +}; // Builds a snapshot .deb on a debian-like system by merging into the debian/* or ubuntu/* branch local deb_builder(image, distro, distro_branch, arch='amd64', imaginary_repo=false) = { @@ -153,7 +227,11 @@ local mac_builder(name, build_type='Release', werror=true, cmake_extra='', extra debian_pipeline("Ubuntu bionic (ARM64)", "ubuntu:bionic", arch="arm64", deps='g++-8 ' + default_deps_base, cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DDOWNLOAD_SODIUM=ON'), debian_pipeline("Debian sid (ARM64)", "debian:sid", arch="arm64"), - debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64", cmake_extra='-DDOWNLOAD_SODIUM=ON'), + debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64", cmake_extra='-DDOWNLOAD_SODIUM=ON'), + + // Windows builds (WOW64 and native) + alpine_win32_pipeline("win32 on alpine (amd64)", "alpine:edge", cmake_extra="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=true), + alpine_wow64_pipeline("win32 on alpine (i386)", "i386/alpine:edge", cmake_extra="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=true), // Static build (on bionic) which gets uploaded to builds.lokinet.dev: debian_pipeline("Static (bionic amd64)", "ubuntu:bionic", deps='g++-8 python3-dev', lto=true, From e43869d9a2114f091778b2ae74101f158f0c6d85 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 16:03:45 -0500 Subject: [PATCH 05/13] FUWAS --- contrib/cross/mingw32.cmake | 1 - contrib/cross/mingw64.cmake | 1 - 2 files changed, 2 deletions(-) diff --git a/contrib/cross/mingw32.cmake b/contrib/cross/mingw32.cmake index 4948b89b6..22c4b4649 100644 --- a/contrib/cross/mingw32.cmake +++ b/contrib/cross/mingw32.cmake @@ -1,6 +1,5 @@ set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX i686-w64-mingw32) -set(TOOLCHAIN_SUFFIX "-posix") set(WOW64_CROSS_COMPILE ON) set(CROSS_TARGET i686-w64-mingw32) diff --git a/contrib/cross/mingw64.cmake b/contrib/cross/mingw64.cmake index cdb13fa78..d3a642138 100644 --- a/contrib/cross/mingw64.cmake +++ b/contrib/cross/mingw64.cmake @@ -1,6 +1,5 @@ set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) -set(TOOLCHAIN_SUFFIX "-posix") set(WIN64_CROSS_COMPILE ON) set(CROSS_TARGET x86_64-w64-mingw32) From 1f5df55443fc7f257539a61b26005b461f7299cf Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 16:41:30 -0500 Subject: [PATCH 06/13] don't use builtin patch --- .drone.jsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 7e6beade7..e736b0083 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -73,7 +73,7 @@ local alpine_wow64_pipeline(name, image, [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, commands: [ - 'apk add cmake git ninja pkgconf ccache ' + deps, + 'apk add cmake git ninja pkgconf ccache patch ' + deps, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', @@ -110,7 +110,7 @@ local alpine_win32_pipeline(name, image, [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, commands: [ - 'apk add cmake git ninja pkgconf ccache ' + deps, + 'apk add cmake git ninja pkgconf ccache patch ' + deps, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', From 052bc25c4f9b46aa76391b846bba5fc5316559df Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 16:51:41 -0500 Subject: [PATCH 07/13] install make --- .drone.jsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index e736b0083..f87cfe359 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -73,7 +73,7 @@ local alpine_wow64_pipeline(name, image, [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, commands: [ - 'apk add cmake git ninja pkgconf ccache patch ' + deps, + 'apk add cmake git ninja pkgconf ccache patch make ' + deps, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', @@ -110,7 +110,7 @@ local alpine_win32_pipeline(name, image, [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, commands: [ - 'apk add cmake git ninja pkgconf ccache patch ' + deps, + 'apk add cmake git ninja pkgconf ccache patch make ' + deps, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', From 6d5155def4bec2452f770308ee447f7fcb2f84f1 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 17:03:05 -0500 Subject: [PATCH 08/13] jeff pls --- llarp/service/endpoint_state.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llarp/service/endpoint_state.cpp b/llarp/service/endpoint_state.cpp index c2496a605..4e1384bee 100644 --- a/llarp/service/endpoint_state.cpp +++ b/llarp/service/endpoint_state.cpp @@ -14,7 +14,7 @@ namespace llarp EndpointState::Configure(const NetworkConfig& conf) { if (conf.m_keyfile.has_value()) - m_Keyfile = *conf.m_keyfile; + m_Keyfile = conf.m_keyfile->string(); m_SnodeBlacklist = conf.m_snodeBlacklist; m_ExitEnabled = conf.m_AllowExit; m_ExitNode = conf.m_exitNode; From a787db9b3547be1d182e09d9258ce33013b864b7 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 17:34:53 -0500 Subject: [PATCH 09/13] fix ipv4_hdr --- llarp/ev/ev_win32.cpp | 1 - llarp/ev/ev_win32.hpp | 4 ---- llarp/net/ip_packet.hpp | 4 +++- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/llarp/ev/ev_win32.cpp b/llarp/ev/ev_win32.cpp index 2aae5dd1f..d163f4963 100644 --- a/llarp/ev/ev_win32.cpp +++ b/llarp/ev/ev_win32.cpp @@ -116,7 +116,6 @@ win32_tun_io::flush_write() void win32_tun_io::read(byte_t* buf, size_t sz) { - DWORD code; asio_evt_pkt* pkt = new asio_evt_pkt; pkt->buf = buf; memset(&pkt->pkt, '\0', sizeof(OVERLAPPED)); diff --git a/llarp/ev/ev_win32.hpp b/llarp/ev/ev_win32.hpp index 33b50905d..ef933c726 100644 --- a/llarp/ev/ev_win32.hpp +++ b/llarp/ev/ev_win32.hpp @@ -36,7 +36,6 @@ namespace llarp struct udp_listener : public ev_io { llarp_udp_io* udp; - llarp_pkt_list m_RecvPackets; udp_listener(int fd, llarp_udp_io* u) : ev_io(fd), udp(u){}; @@ -44,9 +43,6 @@ namespace llarp { } - bool - RecvMany(llarp_pkt_list*); - bool tick(); diff --git a/llarp/net/ip_packet.hpp b/llarp/net/ip_packet.hpp index 138657f61..e5831d3e9 100644 --- a/llarp/net/ip_packet.hpp +++ b/llarp/net/ip_packet.hpp @@ -70,7 +70,9 @@ typedef struct ip_hdr #define ihl ip_header_len #define protocol ip_protocol #define frag_off ip_frag_offset - +#define tos ip_tos +#define ttl ip_ttl +#define tot_len ip_total_length #endif struct ipv6_header From 2efc884acf67418fa768a53bf4047612d8c1ce84 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 17:48:49 -0500 Subject: [PATCH 10/13] 64-bit LTO cursed for ages --- .drone.jsonnet | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index f87cfe359..361e4e1ff 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -49,7 +49,7 @@ local debian_pipeline(name, image, } ], }; - + // 32-bit windows build on alpine: local alpine_wow64_pipeline(name, image, arch='amd64', @@ -73,7 +73,7 @@ local alpine_wow64_pipeline(name, image, [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, commands: [ - 'apk add cmake git ninja pkgconf ccache patch make ' + deps, + 'apk add cmake git ninja pkgconf ccache patch make ' + deps, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', @@ -85,8 +85,8 @@ local alpine_wow64_pipeline(name, image, ] + extra_cmds, } ], -}; - +}; + // 64-bit windows build on alpine: local alpine_win32_pipeline(name, image, arch='amd64', @@ -110,7 +110,7 @@ local alpine_win32_pipeline(name, image, [if allow_fail then "failure"]: "ignore", environment: { SSH_KEY: { from_secret: "SSH_KEY" } }, commands: [ - 'apk add cmake git ninja pkgconf ccache patch make ' + deps, + 'apk add cmake git ninja pkgconf ccache patch make ' + deps, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', @@ -122,7 +122,7 @@ local alpine_win32_pipeline(name, image, ] + extra_cmds, } ], -}; +}; // Builds a snapshot .deb on a debian-like system by merging into the debian/* or ubuntu/* branch local deb_builder(image, distro, distro_branch, arch='amd64', imaginary_repo=false) = { @@ -227,11 +227,11 @@ local mac_builder(name, build_type='Release', werror=true, cmake_extra='', extra debian_pipeline("Ubuntu bionic (ARM64)", "ubuntu:bionic", arch="arm64", deps='g++-8 ' + default_deps_base, cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DDOWNLOAD_SODIUM=ON'), debian_pipeline("Debian sid (ARM64)", "debian:sid", arch="arm64"), - debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64", cmake_extra='-DDOWNLOAD_SODIUM=ON'), - - // Windows builds (WOW64 and native) - alpine_win32_pipeline("win32 on alpine (amd64)", "alpine:edge", cmake_extra="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=true), - alpine_wow64_pipeline("win32 on alpine (i386)", "i386/alpine:edge", cmake_extra="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=true), + debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64", cmake_extra='-DDOWNLOAD_SODIUM=ON'), + + // Windows builds (WOW64 and native) + alpine_win32_pipeline("win32 on alpine (amd64)", "alpine:edge", cmake_extra="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=false), + alpine_wow64_pipeline("win32 on alpine (i386)", "i386/alpine:edge", cmake_extra="-DDOWNLOAD_SODIUM=ON -DBUILD_PACKAGE=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DNATIVE_BUILD=OFF -DSTATIC_LINK=ON", lto=false), // Static build (on bionic) which gets uploaded to builds.lokinet.dev: debian_pipeline("Static (bionic amd64)", "ubuntu:bionic", deps='g++-8 python3-dev', lto=true, From 2fe4c1579236b3e572092d2f77c08d857f733e66 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 18:00:39 -0500 Subject: [PATCH 11/13] why jeff why --- llarp/util/aligned.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/llarp/util/aligned.hpp b/llarp/util/aligned.hpp index 5e866396b..ac6904343 100644 --- a/llarp/util/aligned.hpp +++ b/llarp/util/aligned.hpp @@ -28,7 +28,12 @@ namespace llarp { /// aligned buffer that is sz bytes long and aligns to the nearest Alignment template + // Microsoft C malloc(3C) cannot return pointers aligned wider than 8 ffs +#ifdef _WIN32 + struct alignas(uint64_t) AlignedBuffer +#else struct alignas(std::max_align_t) AlignedBuffer +#endif { static_assert(alignof(std::max_align_t) <= 16, "insane alignment"); static_assert( From b2fcf6c8967c979ac01d6cfe8e5f8b68d3cb85a5 Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 18:17:07 -0500 Subject: [PATCH 12/13] sodium requires stack protection on windows (-D_FORTIFY_SOURCE works now!) --- .drone.jsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 361e4e1ff..58ca7ae6e 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -77,7 +77,7 @@ local alpine_wow64_pipeline(name, image, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', - 'cmake .. -G Ninja -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw32.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + + 'cmake .. -G Ninja -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw32.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + (if lto then '' else '-DWITH_LTO=OFF ') + cmake_extra, @@ -114,7 +114,7 @@ local alpine_win32_pipeline(name, image, 'git clone https://github.com/despair86/libuv.git win32-setup/libuv', 'mkdir build', 'cd build', - 'cmake .. -G Ninja -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw64.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + + 'cmake .. -G Ninja -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector -DLIBUV_ROOT=$PWD/../win32-setup/libuv -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../contrib/cross/mingw64.cmake -DCMAKE_BUILD_TYPE='+build_type+' ' + (if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') + (if lto then '' else '-DWITH_LTO=OFF ') + cmake_extra, From dc52f8c2fed45c2efed58c75b611e855e8f5e2db Mon Sep 17 00:00:00 2001 From: Rick V Date: Fri, 12 Jun 2020 20:50:00 -0500 Subject: [PATCH 13/13] remove stray path separator --- llarp/constants/files.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llarp/constants/files.hpp b/llarp/constants/files.hpp index 292cc8239..0b8bc8092 100644 --- a/llarp/constants/files.hpp +++ b/llarp/constants/files.hpp @@ -21,7 +21,7 @@ namespace llarp #else const fs::path homedir = getenv("HOME"); #endif - return homedir / ".lokinet/"; + return homedir / ".lokinet"; } inline fs::path