diff options
author | fanquake <fanquake@gmail.com> | 2021-03-03 19:58:09 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-03-03 19:58:25 +0800 |
commit | 97a35f3ae5bff7f4a25d37d8961191fdbc8c5b67 (patch) | |
tree | 1c09a517265239fdecfc96535a093976c3ff9c75 | |
parent | b1a457ab1d5abbdd9ff77f2a7a5eb48ec8b4584b (diff) | |
parent | bd49ac416881ede3e5132789defd3fec4c6f8685 (diff) | |
download | bitcoin-97a35f3ae5bff7f4a25d37d8961191fdbc8c5b67.tar.xz |
Merge #21320: build: fix libnatpmp macos cross compile
bd49ac416881ede3e5132789defd3fec4c6f8685 build: fix libnatpmp macos cross compile (fanquake)
Pull request description:
Currently, our cross-compile of libnatpmp for macOS doesn't work at all.
The wrong archiver is used, which produces an archive the linker doesn't like.
This becomes clear when configuring:
```bash
configure:25722: checking for initnatpmp in -lnatpmp
configure:25747: env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH -u LIBRARY_PATH /home/ubuntu/bitcoin/depends/x86_64-apple-darwin18/native/bin/clang++ --target=x86_64-apple-darwin18 <trim> -Wl,-headerpad_max_install_names -Wl,-dead_strip -Wl,-dead_strip_dylibs conftest.cpp -lnatpmp >&5
ld: archive has no table of contents for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
Fix this by using the right `ar` (we do the same for upnp).
While we're at it, fix the build so that we are using our c/ppflags.
In practice this basically means building with `-O2` rather than `-Os`.
Note that this fixes an issue that is also fixed by #21209. However, given there are reservations about updating to use a newer libnatpmp source, we should just fix this for now.
ACKs for top commit:
hebasto:
ACK bd49ac416881ede3e5132789defd3fec4c6f8685, tested:
Tree-SHA512: 2efc2c788ef3ebebfbf564ef07b6cf63a72d8a0bccc22b0ba36537216aa575436b7e87088477e85f6d9191ad34f0b13f1c22cf88c90e1cb81641bfee5dc3058a
-rw-r--r-- | depends/packages/libnatpmp.mk | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/depends/packages/libnatpmp.mk b/depends/packages/libnatpmp.mk index a24f201859..391b9337b7 100644 --- a/depends/packages/libnatpmp.mk +++ b/depends/packages/libnatpmp.mk @@ -6,6 +6,7 @@ $(package)_sha256_hash=e1aa9c4c4219bc06943d6b2130f664daee213fb262fcb94dd355815b8 define $(package)_set_vars $(package)_build_opts=CC="$($(package)_cc)" + $(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)" endef define $(package)_build_cmds |