Build fixes
This commit is contained in:
@@ -433,8 +433,8 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- {c: "gcc", cxx: "g++", flags: "-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes"}
|
||||
- {c: "clang", cxx: "clang++", flags: "-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled"}
|
||||
- {c: "gcc", cxx: "g++", flags: "-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-unknown-attributes"}
|
||||
- {c: "clang", cxx: "clang++", flags: "-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-unknown-attributes"}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
@@ -452,6 +452,10 @@ jobs:
|
||||
update: true
|
||||
install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make git
|
||||
|
||||
- name: Apply patch
|
||||
run: |
|
||||
git apply --verbose --ignore-whitespace --directory=external/src/grpc/third_party/protobuf patches/protobuf/protobuf.patch
|
||||
|
||||
- name: Build libcurl
|
||||
run: |
|
||||
cd external/src/curl
|
||||
|
||||
@@ -9,4 +9,6 @@
|
||||
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) __asan_unpoison_memory_region((addr), (size))
|
||||
#endif
|
||||
|
||||
#define __asan_address_is_poisoned(addr) false
|
||||
|
||||
#endif // P2POOL_EXTERNAL_SRC_COMMON_SANITIZER_ASAN_INTERFACE_H
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
diff --git a/src/crypto/rand_extra/windows.c b/src/crypto/rand_extra/windows.c
|
||||
index a44774d23..09cf10942 100644
|
||||
--- a/src/crypto/rand_extra/windows.c
|
||||
+++ b/src/crypto/rand_extra/windows.c
|
||||
@@ -26,6 +26,7 @@
|
||||
OPENSSL_MSVC_PRAGMA(warning(push, 3))
|
||||
diff --git a/src/crypto/rand/windows.cc b/src/crypto/rand/windows.cc
|
||||
index 59df467e7..aa5ac076c 100644
|
||||
--- a/src/crypto/rand/windows.cc
|
||||
+++ b/src/crypto/rand/windows.cc
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <windows.h>
|
||||
+#include <wincrypt.h>
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
@@ -61,16 +62,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
|
||||
@@ -57,16 +58,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
|
||||
// See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng
|
||||
typedef BOOL (WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData);
|
||||
static ProcessPrngFunction g_processprng_fn = NULL;
|
||||
@@ -25,21 +25,22 @@ index a44774d23..09cf10942 100644
|
||||
HMODULE hmod = LoadLibraryW(L"bcryptprimitives");
|
||||
- if (hmod == NULL) {
|
||||
- abort();
|
||||
- }
|
||||
- g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
|
||||
- if (g_processprng_fn == NULL) {
|
||||
- abort();
|
||||
+
|
||||
+ if (hmod) {
|
||||
+ g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
|
||||
+ if (g_processprng_fn) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
- g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
|
||||
- if (g_processprng_fn == NULL) {
|
||||
- abort();
|
||||
+ }
|
||||
+
|
||||
+ if (CryptAcquireContext(&g_hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
|
||||
+ g_processprng_fn = &wrapper_CryptGenRandom;
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ DWORD err = GetLastError();
|
||||
+ if (err == NTE_BAD_KEYSET) {
|
||||
@@ -50,7 +51,7 @@ index a44774d23..09cf10942 100644
|
||||
+ else {
|
||||
+ err = GetLastError();
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ abort();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc
|
||||
index 5758c1602..e425d6715 100644
|
||||
--- a/src/google/protobuf/generated_message_tctable_lite.cc
|
||||
+++ b/src/google/protobuf/generated_message_tctable_lite.cc
|
||||
@@ -406,7 +406,7 @@ PROTOBUF_ALWAYS_INLINE const char* TcParser::MiniParse(PROTOBUF_TC_PARAM_DECL) {
|
||||
if (entry == nullptr) {
|
||||
if (export_called_function) *test_out = {table->fallback, tag};
|
||||
data.data = tag;
|
||||
- PROTOBUF_MUSTTAIL return table->fallback(PROTOBUF_TC_PARAM_PASS);
|
||||
+ return table->fallback(PROTOBUF_TC_PARAM_PASS);
|
||||
}
|
||||
|
||||
// The handler may need the tag and the entry to resolve fallback logic. Both
|
||||
@@ -468,7 +468,7 @@ PROTOBUF_ALWAYS_INLINE const char* TcParser::MiniParse(PROTOBUF_TC_PARAM_DECL) {
|
||||
TailCallParseFunc parse_fn = kMiniParseTable[field_type];
|
||||
if (export_called_function) *test_out = {parse_fn, tag, entry};
|
||||
|
||||
- PROTOBUF_MUSTTAIL return parse_fn(PROTOBUF_TC_PARAM_PASS);
|
||||
+ return parse_fn(PROTOBUF_TC_PARAM_PASS);
|
||||
}
|
||||
|
||||
PROTOBUF_NOINLINE const char* TcParser::MiniParse(
|
||||
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
|
||||
index edd6d5122..da894d384 100644
|
||||
--- a/src/google/protobuf/port_def.inc
|
||||
+++ b/src/google/protobuf/port_def.inc
|
||||
@@ -506,7 +506,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
|
||||
#error PROTOBUF_ATTRIBUTE_WEAK was previously defined
|
||||
#endif
|
||||
#if ABSL_HAVE_ATTRIBUTE(weak) && !defined(__APPLE__) && \
|
||||
- (!defined(_WIN32) || __clang_major__ < 9) && !defined(__MINGW32__)
|
||||
+ (!defined(_WIN32) || (defined(__clang_major__) && (__clang_major__ < 9))) && !defined(__MINGW32__)
|
||||
#define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak))
|
||||
#define PROTOBUF_HAVE_ATTRIBUTE_WEAK 1
|
||||
#else
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM p2pool_build_ubuntu
|
||||
ARG P2POOL_VERSION
|
||||
ADD p2pool_macos_aarch64.sh zutil.patch /p2pool/
|
||||
ADD p2pool_macos_aarch64.sh /p2pool/
|
||||
RUN /p2pool/p2pool_macos_aarch64.sh p2pool-${P2POOL_VERSION}-macos-aarch64 ${P2POOL_VERSION}
|
||||
|
||||
@@ -19,8 +19,6 @@ flags_datetime="-D__DATE__=\"\\\"$CURRENT_DATE\\\"\" -D__TIME__=\"\\\"$CURRENT_T
|
||||
flags_libs="-Os -flto -w $flags_size $flags_datetime"
|
||||
flags_p2pool="$flags_size $flags_datetime"
|
||||
|
||||
patch -u /p2pool/external/src/grpc/third_party/zlib/zutil.h -i /p2pool/zutil.patch
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- zutil.h
|
||||
+++ zutil.h
|
||||
@@ -144,7 +144,6 @@
|
||||
# include <unix.h> /* for fdopen */
|
||||
# else
|
||||
# ifndef fdopen
|
||||
-# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM p2pool_build_ubuntu
|
||||
ARG P2POOL_VERSION
|
||||
ADD p2pool_macos_x64.sh zutil.patch /p2pool/
|
||||
ADD p2pool_macos_x64.sh /p2pool/
|
||||
RUN /p2pool/p2pool_macos_x64.sh p2pool-${P2POOL_VERSION}-macos-x64 ${P2POOL_VERSION}
|
||||
|
||||
@@ -19,8 +19,6 @@ flags_datetime="-D__DATE__=\"\\\"$CURRENT_DATE\\\"\" -D__TIME__=\"\\\"$CURRENT_T
|
||||
flags_libs="-Os -flto -w $flags_size $flags_datetime"
|
||||
flags_p2pool="$flags_size $flags_datetime"
|
||||
|
||||
patch -u /p2pool/external/src/grpc/third_party/zlib/zutil.h -i /p2pool/zutil.patch
|
||||
|
||||
cd /p2pool/external/src/curl
|
||||
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/src/include
|
||||
make -j$(nproc)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- zutil.h
|
||||
+++ zutil.h
|
||||
@@ -144,7 +144,6 @@
|
||||
# include <unix.h> /* for fdopen */
|
||||
# else
|
||||
# ifndef fdopen
|
||||
-# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
@@ -18,7 +18,7 @@ flags_datetime="-D__DATE__=\"\\\"$CURRENT_DATE\\\"\" -D__TIME__=\"\\\"$CURRENT_T
|
||||
|
||||
flags_libs="--target=x86_64-pc-windows-gnu -Os -flto -Wl,/timestamp:$BUILD_TIMESTAMP -fuse-ld=lld -w $flags_size $flags_datetime"
|
||||
|
||||
flags_p2pool="--target=x86_64-pc-windows-gnu -Wl,/timestamp:$BUILD_TIMESTAMP -fuse-ld=lld -femulated-tls -Wno-unused-command-line-argument $flags_size $flags_datetime"
|
||||
flags_p2pool="--target=x86_64-pc-windows-gnu -Wl,/timestamp:$BUILD_TIMESTAMP -fuse-ld=lld -femulated-tls -Wno-unused-command-line-argument -Wno-unknown-attributes $flags_size $flags_datetime"
|
||||
flags_cxx_headers="-isystem /usr/local/x86_64-w64-mingw32/include/c++ -isystem /usr/local/x86_64-w64-mingw32/include/c++/15.1.0 -isystem /usr/local/x86_64-w64-mingw32/include"
|
||||
|
||||
cd /p2pool
|
||||
|
||||
@@ -299,6 +299,8 @@ allowedAPIs = {
|
||||
"GetUserProfileDirectoryW",
|
||||
"GetUserNameW",
|
||||
"GetEnvironmentVariableW",
|
||||
"RtlCaptureStackBackTrace",
|
||||
"GetDynamicTimeZoneInformation",
|
||||
}
|
||||
|
||||
f = open(sys.argv[1], 'r')
|
||||
|
||||
Reference in New Issue
Block a user