While testing bitcoin-core/secp256k1#1022 I’ve noticed a linker error when cross compiling with --host=x86_64-w64-mingw32
in particular circumstances.
I cannot recall my building environment then, but currently, on Ubuntu 22.04 with gcc 11.2, this error raises unconditionally:
0$ ./autogen.sh && ./configure --host=x86_64-w64-mingw32 && make clean
1$ make
2make all-am
3make[1]: Entering directory '/home/hebasto/git/secp256k1'
4 CC src/bench.o
5 CC src/libsecp256k1_la-secp256k1.lo
6 CC src/libsecp256k1_precomputed_la-precomputed_ecmult.lo
7 CC src/libsecp256k1_precomputed_la-precomputed_ecmult_gen.lo
8 CCLD libsecp256k1_precomputed.la
9 CCLD libsecp256k1.la
10 CCLD bench.exe
11libtool: error: Could not determine the host path corresponding to
12libtool: error: '/home/hebasto/git/secp256k1/.libs'
13libtool: error: Continuing, but uninstalled executables may not work.
14libtool: error: Could not determine the host path corresponding to
15libtool: error: '/home/hebasto/git/secp256k1/.libs:/usr/local/lib:/usr/local/bin'
16libtool: error: Continuing, but uninstalled executables may not work.
17 CC src/bench_internal-bench_internal.o
18 CCLD bench_internal.exe
19 CC src/bench_ecmult-bench_ecmult.o
20 CCLD bench_ecmult.exe
21 CC src/tests-tests.o
22 CCLD tests.exe
23 CC src/exhaustive_tests-tests_exhaustive.o
24 CCLD exhaustive_tests.exe
25make[1]: Leaving directory '/home/hebasto/git/secp256k1'
This PR prevents linker errors when cross compiling with --host=x86_64-w64-mingw32
.
Please note that the same linker flag is used for all of the tests and examples. Moreover, it was used in the initial Autotools commit:https://github.com/bitcoin-core/secp256k1/blob/78cd96b15153e209cf4829a511f9efdfdcf7e4d0/Makefile.am#L45