This will allow us to use the existing machinery for filtering by
arch, os, debug/release, etc.
For example, the following becomes possible for libevent:
$(package)_config_opts_release=-DEVENT__DISABLE_DEBUG_MODE
Now the define is only set when not building depends with DEBUG=1
Compiling bdb with clang-16 on aarch64 (hardware) currently fails:
```bash
make -C depends/ bdb CC=clang CXX=clang++
...
checking for mutexes... UNIX/fcntl
configure: WARNING: NO SHARED LATCH IMPLEMENTATION FOUND FOR THIS PLATFORM.
configure: error: Unable to find a mutex implementation
```
Looking at config.log we've got:
```bash
configure:18704: checking for mutexes
configure:18815: clang -o conftest -pipe -std=c11 -O2 -Wno-error=implicit-function-declaration -Wno-error=format-security -I/bitcoin/depends/aarch64-unknown-linux-gnu/include -D_GNU_SOURCE -D_REENTRANT -L/bitcoin/depends/aarch64-unknown-linux-gnu/lib conftest.c -lpthread >&5
conftest.c:45:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
main() {
^
int
conftest.c:50:2: warning: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
exit (
^
conftest.c:50:2: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning and 1 error generated.
```
Clang-16 changed `-Wimplicit-function-declaration` and `-Wimplicit-int`
warnings into errors, see:
https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes.
> The -Wimplicit-function-declaration and -Wimplicit-int warnings now
> default to an error in C99, C11, and C17. As of C2x, support for implicit
> function declarations and implicit int has been removed, and the
> warning options will have no effect. Specifying -Wimplicit-int in
> C89 mode will now issue warnings instead of being a noop.
Add an option that when passed, will disable hardening options, and
pass `--disable-hardening` through to configure. Due to the way
we link libssp for Windows builds, they now fail (after #27118),
if building with depends, and configuring with --disable-hardening.
See:
https://github.com/bitcoin/bitcoin/pull/27118#issuecomment-1492606272.
This change would add a depends opiton such that, if someone wants to
build with, for windows, without hardening, they can do so. This may
also be useful when building for debugging.
Use the same workaround we've applied to qrencode, and other packages.
Fontconfig not building is currently a blocker for fuzz/sanitizer infra
upgrades.
For now, this is also more straightforward than bumping the package,
which introduces more complexity/usage of gperf.
0e02f72548 depends: define `__BSD_VISIBLE` for FreeBSD bdb build (fanquake)
Pull request description:
Required for additional definitions (`IPC_R` & friends), to be available, when compiling under C11, which would otherwise cause compile fails.
See: https://github.com/MarcoFalke/btc_nightly/pull/4.
ACKs for top commit:
hebasto:
ACK 0e02f72548, tested on FreeBSD 13.1:
Tree-SHA512: 885d4aa341d9668da360cf6dfafb97ce816803c54e76c0a06e448db39a723666d42cd14b3e713d17ecbe33163f5af69924567cf449d679a2db95b36357005d43
1914e470e3 build: copy config.{guess,sub} post autogen in zmq package (fanquake)
Pull request description:
Otherwise our config.guess and config.sub will be copied over. This problem has been masked by the fact that modern systems ship with versions that recognise all the triplets we use (namely arm64-apple-darwin). However building on ubuntu 20.04 surfaces the issue.
Fixes#26420.
ACKs for top commit:
hebasto:
ACK 1914e470e3, tested on Ubuntu 18.04.
Tree-SHA512: dff64c3c62d9f8fc205e5a4dffe8befd58838418d073a15dfe304a0f64b182dfffd9dcf98b53df44bfab905c12a62d03cd5c0f91fa7c4b246ac21ae5f20540fd
See https://www.sqlite.org/compile.html.
DSQLITE_DQS
> This setting disables the double-quoted string literal misfeature.
DSQLITE_DEFAULT_MEMSTATUS
> This setting causes the sqlite3_status() interfaces that track
> memory usage to be disabled.
> This helps the sqlite3_malloc() routines run much faster, and since
> SQLite uses sqlite3_malloc() internally, this helps to make the
> entire library faster.
DSQLITE_OMIT_DEPRECATED
> Omitting deprecated interfaces and features will not help SQLite
> to run any faster.
> It will reduce the library footprint, however. And it is the
> right thing to do.
DSQLITE_OMIT_SHARED_CACHE
> Omitting the possibility of using shared cache allows many
> conditionals in performance-critical sections of the code to be
> eliminated. This can give a noticeable improvement in performance.
Also: https://www.sqlite.org/sharedcache.html
> Shared-cache mode is an obsolete feature.
> The use of shared-cache mode is discouraged.
> Most use cases for shared-cache are better served by WAL mode.
> Applications that build their own copy of SQLite from source code
> are encouraged to use the -DSQLITE_OMIT_SHARED_CACHE compile-time
> option, as the resulting binary will be both smaller and faster.
DSQLITE_OMIT_JSON
Starting with sqlite 3.38.0 the JSON extension became opt-out rather
than opt-in, so we disable it here.
--disable-rtree
> An R-Tree is a special index that is designed for doing range queries.
> R-Trees are most commonly used in geospatial systems...
https://www.sqlite.org/rtree.html
--disable-fts4 --disable-fts5
> FTS5 is an SQLite virtual table module that provides full-text
> search functionality to database applications.
DSQLITE_LIKE_DOESNT_MATCH_BLOBS
> simplifies the implementation of the LIKE optimization and allows
> queries that use the LIKE optimization to run faster.
DSQLITE_OMIT_DECLTYPE
> By omitting the (seldom-needed) ability to return the declared type of
> columns from the result set of query, prepared statements can be made
> to consume less memory.
DSQLITE_OMIT_PROGRESS_CALLBACK
> By omitting this interface, a single conditional is removed from the
> inner loop of the bytecode engine, helping SQL statements to run slightly
> faster.
DSQLITE_OMIT_AUTOINIT
> with the SQLITE_OMIT_AUTOINIT option, the automatic initialization is omitted.
> This helps many API calls to run a little faster
> it also means that the application must call sqlite3_initialize()
manually.
Replacing `install` with `install-lib` and `install-bin` is not strictly
necessary just to update the library, but it takes advantage of recent
changes in the new version, and makes the build more minimal.
Otherwise our config.guess and config.sub will be copied over. This
problem has been masked by the fact that modern systems ship with
versions that recognise all the triplets we use (namely
arm64-apple-darwin). However building on ubuntu 20.04 surfaces the
issue.
Fixes#26420.
859644b3c8 build: set D_WIN32_WINNT=0x0601 for mingw miniupnpc (fanquake)
8e2d93ff0f build: fix cflags passing for mingw miniupnpc (fanquake)
Pull request description:
Pulls in a patch I've upstreamed to miniupnpc so that we properly pass our cflags when building it for mingw. See https://github.com/miniupnp/miniupnp/pull/619. Also set `D_WIN32_WINNT` to `0x0601` to match libevent, configure etc. Previously it was being set to `0X501`.
Guix Build (x86_64 / arm64):
```bash
39a66c473a45b83ca85500b32ccf8f30d4ae80f965ca064566ee9fd84a51964b guix-build-859644b3c855/output/aarch64-linux-gnu/SHA256SUMS.part
7b0515e422f350cb23f4f0b2f87eaa1b30d1c80389da6f1cbe700794902c88e9 guix-build-859644b3c855/output/aarch64-linux-gnu/bitcoin-859644b3c855-aarch64-linux-gnu-debug.tar.gz
192253fb387a2216b6d63d47a18e34bfa284874488d7ebc6ba656ca76a905519 guix-build-859644b3c855/output/aarch64-linux-gnu/bitcoin-859644b3c855-aarch64-linux-gnu.tar.gz
0a8b5c77928a46e62dff85cf73ca9e932560533b99ef1ec374be00516f9e1183 guix-build-859644b3c855/output/arm-linux-gnueabihf/SHA256SUMS.part
d1b01b36d7092d63ab84877e05a973d915d177dbc618fe00eeaff86295032750 guix-build-859644b3c855/output/arm-linux-gnueabihf/bitcoin-859644b3c855-arm-linux-gnueabihf-debug.tar.gz
50d9cd81a4a37fbd5c22ee8f1b8398a836879bda1b514a9ed3d0bcd6fd3de41f guix-build-859644b3c855/output/arm-linux-gnueabihf/bitcoin-859644b3c855-arm-linux-gnueabihf.tar.gz
e590d6dc6687c744b4067af330a7fe44110da4972c46f0262c39ce03e2aa6ac5 guix-build-859644b3c855/output/arm64-apple-darwin/SHA256SUMS.part
6b9b97a1f6ead6d2b70d706ba39b11f36c2929962afc0d52404f2341d412d4e7 guix-build-859644b3c855/output/arm64-apple-darwin/bitcoin-859644b3c855-arm64-apple-darwin-unsigned.dmg
de6be985a4e1b11c6450c388b54be4fff3dc3a78e528cb628623ee4a8ea249f4 guix-build-859644b3c855/output/arm64-apple-darwin/bitcoin-859644b3c855-arm64-apple-darwin-unsigned.tar.gz
940024658b9387040ceb26535dbd1ed7edb3709106f6e25d5d3720ed90bbbb2e guix-build-859644b3c855/output/arm64-apple-darwin/bitcoin-859644b3c855-arm64-apple-darwin.tar.gz
67c8fcdd31dca595e5c6b72e597a135718dd50ce1f062cb18d181520c13d3013 guix-build-859644b3c855/output/dist-archive/bitcoin-859644b3c855.tar.gz
4b1954953913d1387589873a8e9dc9765f0f300c125270046da95a23c43aa069 guix-build-859644b3c855/output/powerpc64-linux-gnu/SHA256SUMS.part
5b12ab7e3a7fc162912e67e026646ee5d4c92ef804525504f188d9a569af7d67 guix-build-859644b3c855/output/powerpc64-linux-gnu/bitcoin-859644b3c855-powerpc64-linux-gnu-debug.tar.gz
fa4debb24dbb4c9c515ad3bfa2e5cb9bd686f1062157bd4480d076ef35d7ea9d guix-build-859644b3c855/output/powerpc64-linux-gnu/bitcoin-859644b3c855-powerpc64-linux-gnu.tar.gz
bafad2f56aad4edd25e49e4cc658811cf87f32a2a2e013672659d410d7a8cac8 guix-build-859644b3c855/output/powerpc64le-linux-gnu/SHA256SUMS.part
96318cac800dc7ee86229754a76047dececd62ecd962362e6dbd1d694bc8c17a guix-build-859644b3c855/output/powerpc64le-linux-gnu/bitcoin-859644b3c855-powerpc64le-linux-gnu-debug.tar.gz
461415ee7bf67e2c59bfce3a09736b3b0ecdc7c81751ce2bed19369237450154 guix-build-859644b3c855/output/powerpc64le-linux-gnu/bitcoin-859644b3c855-powerpc64le-linux-gnu.tar.gz
5c9d19f6af5d1fab7de7496bbdcd1cd266abd6c0e2c226b362dab2582c94a33a guix-build-859644b3c855/output/riscv64-linux-gnu/SHA256SUMS.part
04492f5ce121ba09672119cc8861ee30ecdb814b34726c9c5d7971c528209a55 guix-build-859644b3c855/output/riscv64-linux-gnu/bitcoin-859644b3c855-riscv64-linux-gnu-debug.tar.gz
5fb28111b49e73fc53db2805500c275a2e6321c3e180695eb813675629dcd64c guix-build-859644b3c855/output/riscv64-linux-gnu/bitcoin-859644b3c855-riscv64-linux-gnu.tar.gz
3f48c1c2ba77d4fda725225f6c9b5ab7f3aae244c8abb354407cc73d6547d983 guix-build-859644b3c855/output/x86_64-apple-darwin/SHA256SUMS.part
6dcfb5a4af350466fb7f9319e02fd4bcef66e015116c9eda8aff03b3ac53d109 guix-build-859644b3c855/output/x86_64-apple-darwin/bitcoin-859644b3c855-x86_64-apple-darwin-unsigned.dmg
87112cc5f2d02c16614f6d8df41af6f3ea3c765eb6d196d68d2b514b6bd317bc guix-build-859644b3c855/output/x86_64-apple-darwin/bitcoin-859644b3c855-x86_64-apple-darwin-unsigned.tar.gz
b245a4d4881a679f2c91e0c7fd5466d6b93313289e609dbce4e1009b7591332e guix-build-859644b3c855/output/x86_64-apple-darwin/bitcoin-859644b3c855-x86_64-apple-darwin.tar.gz
a4c3449aa9d8a8e1c8b0532f6e74845c40f90ad4186f480d5bb2750e184efc10 guix-build-859644b3c855/output/x86_64-linux-gnu/SHA256SUMS.part
12a32f25d6ef7f60023dd3053b21e31131350b6afa01aeab25e53d1928b1a0f5 guix-build-859644b3c855/output/x86_64-linux-gnu/bitcoin-859644b3c855-x86_64-linux-gnu-debug.tar.gz
93d603d89c9251e93992e3c0e176b094d981b020ef1d4bbfbff21806e50b962d guix-build-859644b3c855/output/x86_64-linux-gnu/bitcoin-859644b3c855-x86_64-linux-gnu.tar.gz
79df55f4ca8f972665fd55b43550b2ab9ffafa8fc8de1335b324f4af047c6788 guix-build-859644b3c855/output/x86_64-w64-mingw32/SHA256SUMS.part
8d837e96595ab7337736da334d940ffc9d15215141f176804a528fe9e21f490a guix-build-859644b3c855/output/x86_64-w64-mingw32/bitcoin-859644b3c855-win64-debug.zip
6c9541524f1d54eceb3265c6e79d62502fdc0c2e5263719a0ca357988d7ed718 guix-build-859644b3c855/output/x86_64-w64-mingw32/bitcoin-859644b3c855-win64-setup-unsigned.exe
7566ab4ee53092e81c3079db955d85c8d574cbde2be21526d45619076ffcd264 guix-build-859644b3c855/output/x86_64-w64-mingw32/bitcoin-859644b3c855-win64-unsigned.tar.gz
32164cfa7c06ead63305485653f37d74c6ada82d28b79f58e66faf6e72e130bb guix-build-859644b3c855/output/x86_64-w64-mingw32/bitcoin-859644b3c855-win64.zip
```
ACKs for top commit:
jarolrod:
re-ACK 859644b
hebasto:
ACK 859644b3c8, I've verified introduced changes in compiler flags, including the case with `DEBUG=1`.
Tree-SHA512: 6e181ced7e474a80aa191663b08dc594179a0593b8e2d1e4b7c8683794fd7de8d37faedb9a36997645ce6a2a6151e1461678b4db95170fc9b1fcadd6e1bddbe5
8b8edc25c1 build: Specify native binaries explicitly when building `capnp` package (Hennadii Stepanov)
a413595c37 build: Fix `capnp` package build for Android (Hennadii Stepanov)
Pull request description:
On master (e3c08eb620):
```
$ make -C depends capnp MULTIPROCESS=1 HOST=aarch64-linux-android ANDROID_SDK=$ANDROID_HOME ANDROID_NDK=$ANDROID_HOME/ndk/23.2.8568313 ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=$ANDROID_HOME/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/bin
...
ld: error: unable to find library -lkj
...
```
This PR fixes this error, and also improves configuring according to the docs.
ACKs for top commit:
ryanofsky:
Code review ACK 8b8edc25c1. I'd be a little curious to know what causes the error and how `--disable-shared` fixes it, but these changes all look good
Tree-SHA512: 1b07b75f2a83932d8dc1f007e42a67d8327bd5fe4566f554dab4599e2a1e04b0144648790a1fd2ab1c295dba728586035aa0ebdbe5cf49df048ec87736895aaf
The *_compat headers are the deprecated / non-threadsafe versions of the
current headers. There's no need for us to ship them in depends. Prune
them are save the safe / nuke the possibility of them being used.
This is causing build failures in some build environments, like NixOS.
I don't think we are going to patch bdb at this point, and this warning
has existed for as long as we've used bdb.
Fixes#25211.
Tested (in Docker) with:
```bash
docker run -it nixos/nix
nix-shell -p gitMinimal gcc12 libtool pkg-config curl gnumake patch autoconf automake
git clone https://github.com/bitcoin/bitcoin
make -C bitcoin/depends bdb
```
Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
Use lto.h from clang+llvm not libtapi. The later is older,
and comes bundled with the libtapi repo.
Copy libLTO.so when building with FORCE_USE_SYSTEM_CLANG.
e838a98475 depends: re-enable using -flto when building expat (fanquake)
304452558c depends: expat 2.4.8 (fanquake)
Pull request description:
Currently, when building the expat package in depends, using `-flto` (`LTO=1`), the configure check can fail, because it cannot determine the system endianess:
```bash
configure:18718: result: unknown
configure:18733: error: unknown endianness
presetting ac_cv_c_bigendian=no (or yes) will help
```
Fix that by defining `_DEFAULT_SOURCE`, which in turn defines `__USE_MISC` (`features.h`):
```c
#if defined _DEFAULT_SOURCE
# define __USE_MISC1
#endif
```
which exposes additional definitions in `endian.h`:
```c
#include <features.h>
/* Get the definitions of __*_ENDIAN, __BYTE_ORDER, and __FLOAT_WORD_ORDER. */
#include <bits/endian.h>
#ifdef __USE_MISC
# define LITTLE_ENDIAN__LITTLE_ENDIAN
# define BIG_ENDIAN__BIG_ENDIAN
# define PDP_ENDIAN__PDP_ENDIAN
# define BYTE_ORDER__BYTE_ORDER
#endif
```
and gives us a working configure.
You could test building this change with Guix + LTO with [this branch](https://github.com/fanquake/bitcoin/tree/lto_in_guix). Note that that build may fail for other reasons (on x86_64), unrelated to this change.
Some related upstream discussion:
https://bugs.gentoo.org/757681https://forums.gentoo.org/viewtopic-t-1013786.html
ACKs for top commit:
hebasto:
re-ACK e838a98475, only [suggested](https://github.com/bitcoin/bitcoin/pull/25697#discussion_r929735675) changes since my recent [review](https://github.com/bitcoin/bitcoin/pull/25697#pullrequestreview-1050657421).
jarolrod:
code review ACK e838a98475
Tree-SHA512: 9dbf64c9bd1fd995a4d1addc011ffeff83d50df736030012346c97605e63aed4b5bac390a81abe646c1be28ad6fd600f64560dcb26bbc2edf5d513ca3b180bfa