Merge bitcoin/bitcoin#31395: build: Set shared linker flags in toolchain file

a8e04704f9 build: Set shared linker flags in toolchain file (TheCharlatan)

Pull request description:

  These are required when cross-compiling shared libraries such as the kernel library.

  This was discovered after attempting to cross-compile the kernel library and running into the following error:
  ```
  [100%] Linking CXX shared library libbitcoinkernel.dylib
  /usr/bin/ld: unrecognised emulation mode: llvm
  Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386pep i386pe
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  gmake[3]: *** [src/kernel/CMakeFiles/bitcoinkernel.dir/build.make:1209: src/kernel/libbitcoinkernel.dylib] Error 1
  gmake[2]: *** [CMakeFiles/Makefile2:1175: src/kernel/CMakeFiles/bitcoinkernel.dir/all] Error 2
  gmake[1]: *** [CMakeFiles/Makefile2:1182: src/kernel/CMakeFiles/bitcoinkernel.dir/rule] Error 2
  gmake: *** [Makefile:569: bitcoinkernel] Error 2
  ```

ACKs for top commit:
  hebasto:
    ACK a8e04704f9, tested on Ubuntu 24.04:
  tdb3:
    ACK a8e04704f9

Tree-SHA512: a896f366348647888085fdbe66ff3d21484ca3b7cba0ba5390adb55bbcfe3ec09d4f81dd514ecf360cd0d31dcc8311108c4b772cecd5ea719d1c07faef285ecf
This commit is contained in:
merge-script 2024-12-02 12:13:05 +00:00
commit 6cd95de2e0
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -55,12 +55,21 @@ set(DEPENDS_COMPILE_DEFINITIONS_DEBUG @CPPFLAGS_DEBUG@)
if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT)
set(CMAKE_EXE_LINKER_FLAGS_INIT "@LDFLAGS@")
endif()
if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_INIT)
set(CMAKE_SHARED_LINKER_FLAGS_INIT "@LDFLAGS@")
endif()
if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT)
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "@LDFLAGS_RELEASE@")
endif()
if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT)
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "@LDFLAGS_RELEASE@")
endif()
if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "@LDFLAGS_DEBUG@")
endif()
if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT)
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "@LDFLAGS_DEBUG@")
endif()
set(CMAKE_AR "@AR@")
set(CMAKE_RANLIB "@RANLIB@")