mirror of
https://github.com/monero-project/monero.git
synced 2025-12-09 00:21:28 +09:00
guix: use llvm 18 toolchain for darwin targets
This commit is contained in:
parent
8e7af0806e
commit
574c845090
8
.github/workflows/depends.yml
vendored
8
.github/workflows/depends.yml
vendored
@ -60,11 +60,11 @@ jobs:
|
|||||||
- name: "Cross-Mac x86_64"
|
- name: "Cross-Mac x86_64"
|
||||||
host: "x86_64-apple-darwin"
|
host: "x86_64-apple-darwin"
|
||||||
rust_host: "x86_64-apple-darwin"
|
rust_host: "x86_64-apple-darwin"
|
||||||
packages: "clang libtool"
|
packages: "clang-18 lld-18"
|
||||||
- name: "Cross-Mac aarch64"
|
- name: "Cross-Mac aarch64"
|
||||||
host: "arm64-apple-darwin"
|
host: "arm64-apple-darwin"
|
||||||
rust_host: "aarch64-apple-darwin"
|
rust_host: "aarch64-apple-darwin"
|
||||||
packages: "clang libtool"
|
packages: "clang-18 lld-18"
|
||||||
- name: "x86_64 Freebsd"
|
- name: "x86_64 Freebsd"
|
||||||
host: "x86_64-unknown-freebsd"
|
host: "x86_64-unknown-freebsd"
|
||||||
rust_host: "x86_64-unknown-freebsd"
|
rust_host: "x86_64-unknown-freebsd"
|
||||||
@ -120,6 +120,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
update-alternatives --set ${{ matrix.toolchain.host }}-g++ $(which ${{ matrix.toolchain.host }}-g++-posix)
|
update-alternatives --set ${{ matrix.toolchain.host }}-g++ $(which ${{ matrix.toolchain.host }}-g++-posix)
|
||||||
update-alternatives --set ${{ matrix.toolchain.host }}-gcc $(which ${{ matrix.toolchain.host }}-gcc-posix)
|
update-alternatives --set ${{ matrix.toolchain.host }}-gcc $(which ${{ matrix.toolchain.host }}-gcc-posix)
|
||||||
|
- name: prepare apple-darwin
|
||||||
|
if: ${{ matrix.toolchain.host == 'x86_64-apple-darwin' || matrix.toolchain.host == 'arm64-apple-darwin' }}
|
||||||
|
run: |
|
||||||
|
echo "/usr/lib/llvm-18/bin/" >> $GITHUB_PATH
|
||||||
- uses: ./.github/actions/set-make-job-count
|
- uses: ./.github/actions/set-make-job-count
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@ -467,9 +467,13 @@ You can also cross-compile static binaries on Linux for Windows and macOS with t
|
|||||||
update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix)
|
update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix)
|
||||||
```
|
```
|
||||||
* ```make depends target=x86_64-apple-darwin``` for Intel macOS binaries.
|
* ```make depends target=x86_64-apple-darwin``` for Intel macOS binaries.
|
||||||
* Requires: `clang`
|
* Requires: `clang-18 lld-18`
|
||||||
* ```make depends target=arm64-apple-darwin``` for Apple Silicon macOS binaries.
|
* ```make depends target=arm64-apple-darwin``` for Apple Silicon macOS binaries.
|
||||||
* Requires: `clang`
|
* Requires: `clang-18 lld-18`
|
||||||
|
* You also need to run:
|
||||||
|
```shell
|
||||||
|
export PATH="/usr/lib/llvm-18/bin/:$PATH"
|
||||||
|
```
|
||||||
* ```make depends target=i686-linux-gnu``` for 32-bit linux binaries.
|
* ```make depends target=i686-linux-gnu``` for 32-bit linux binaries.
|
||||||
* Requires: `g++-multilib bc`
|
* Requires: `g++-multilib bc`
|
||||||
* ```make depends target=i686-w64-mingw32``` for 32-bit windows binaries.
|
* ```make depends target=i686-w64-mingw32``` for 32-bit windows binaries.
|
||||||
|
|||||||
@ -1,15 +1,22 @@
|
|||||||
OSX_MIN_VERSION=10.15
|
OSX_MIN_VERSION=11.0
|
||||||
OSX_SDK_VERSION=11.0
|
OSX_SDK_VERSION=11.0
|
||||||
XCODE_VERSION=12.2
|
XCODE_VERSION=12.2
|
||||||
XCODE_BUILD_ID=12B45b
|
XCODE_BUILD_ID=12B45b
|
||||||
LD64_VERSION=609
|
LD64_VERSION=711
|
||||||
|
|
||||||
OSX_SDK=$(host_prefix)/native/SDK
|
OSX_SDK=$(host_prefix)/native/SDK
|
||||||
|
|
||||||
darwin_native_toolchain=darwin_sdk native_cctools
|
darwin_native_toolchain=darwin_sdk
|
||||||
|
|
||||||
clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang")
|
clang_prog=clang
|
||||||
clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
|
clangxx_prog=clang++
|
||||||
|
|
||||||
|
darwin_AR=llvm-ar
|
||||||
|
darwin_DSYMUTIL=dsymutil
|
||||||
|
darwin_NM=llvm-nm
|
||||||
|
darwin_OBJDUMP=llvm-objdump
|
||||||
|
darwin_RANLIB=llvm-ranlib
|
||||||
|
darwin_STRIP=llvm-strip
|
||||||
|
|
||||||
# Flag explanations:
|
# Flag explanations:
|
||||||
#
|
#
|
||||||
@ -18,11 +25,6 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
|
|||||||
# Ensures that modern linker features are enabled. See here for more
|
# Ensures that modern linker features are enabled. See here for more
|
||||||
# details: https://github.com/bitcoin/bitcoin/pull/19407.
|
# details: https://github.com/bitcoin/bitcoin/pull/19407.
|
||||||
#
|
#
|
||||||
# -B$(build_prefix)/bin
|
|
||||||
#
|
|
||||||
# Explicitly point to our binaries (e.g. cctools) so that they are
|
|
||||||
# ensured to be found and preferred over other possibilities.
|
|
||||||
#
|
|
||||||
# -isysroot$(OSX_SDK) -nostdlibinc
|
# -isysroot$(OSX_SDK) -nostdlibinc
|
||||||
#
|
#
|
||||||
# Disable default include paths built into the compiler as well as
|
# Disable default include paths built into the compiler as well as
|
||||||
@ -38,8 +40,7 @@ darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
|||||||
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
||||||
-u LIBRARY_PATH \
|
-u LIBRARY_PATH \
|
||||||
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
||||||
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
-mlinker-version=$(LD64_VERSION) \
|
||||||
-isysroot$(OSX_SDK) \
|
|
||||||
-isysroot$(OSX_SDK) -nostdlibinc \
|
-isysroot$(OSX_SDK) -nostdlibinc \
|
||||||
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
||||||
|
|
||||||
@ -47,13 +48,14 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
|||||||
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
||||||
-u LIBRARY_PATH \
|
-u LIBRARY_PATH \
|
||||||
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
||||||
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
-mlinker-version=$(LD64_VERSION) \
|
||||||
-isysroot$(OSX_SDK) -nostdlibinc \
|
-isysroot$(OSX_SDK) -nostdlibinc \
|
||||||
-iwithsysroot/usr/include/c++/v1 \
|
-iwithsysroot/usr/include/c++/v1 \
|
||||||
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
||||||
|
|
||||||
darwin_CFLAGS=-pipe
|
darwin_CFLAGS=-pipe
|
||||||
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||||
|
darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION) -Wl,-no_adhoc_codesign -fuse-ld=lld
|
||||||
darwin_ARFLAGS=cr
|
darwin_ARFLAGS=cr
|
||||||
|
|
||||||
darwin_release_CFLAGS=-O2
|
darwin_release_CFLAGS=-O2
|
||||||
|
|||||||
@ -11,15 +11,13 @@ $(package)_config_opts+=--layout=system --user-config=user-config.jam
|
|||||||
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
|
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1
|
||||||
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
|
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
|
||||||
$(package)_config_opts_android=threadapi=pthread runtime-link=static target-os=android
|
$(package)_config_opts_android=threadapi=pthread runtime-link=static target-os=android
|
||||||
$(package)_config_opts_darwin=--toolset=darwin runtime-link=shared target-os=darwin
|
$(package)_config_opts_darwin=runtime-link=shared target-os=darwin
|
||||||
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
|
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
|
||||||
$(package)_config_opts_x86_64_mingw32=address-model=64
|
$(package)_config_opts_x86_64_mingw32=address-model=64
|
||||||
$(package)_config_opts_i686_mingw32=address-model=32
|
$(package)_config_opts_i686_mingw32=address-model=32
|
||||||
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
|
$(package)_config_opts_i686_linux=address-model=32 architecture=x86
|
||||||
$(package)_toolset_$(host_os)=gcc
|
$(package)_toolset_$(host_os)=gcc
|
||||||
$(package)_archiver_$(host_os)=$($(package)_ar)
|
$(package)_archiver_$(host_os)=$($(package)_ar)
|
||||||
$(package)_toolset_darwin=darwin
|
|
||||||
$(package)_archiver_darwin=$($(package)_libtool)
|
|
||||||
$(package)_config_libraries_$(host_os)="chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization"
|
$(package)_config_libraries_$(host_os)="chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization"
|
||||||
$(package)_config_libraries_mingw32="chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale"
|
$(package)_config_libraries_mingw32="chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization,locale"
|
||||||
$(package)_cxxflags=-std=c++17
|
$(package)_cxxflags=-std=c++17
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
package=native_cctools
|
|
||||||
$(package)_version=04663295d0425abfac90a42440a7ec02d7155fea
|
|
||||||
$(package)_download_path=https://github.com/tpoechtrager/cctools-port/archive
|
|
||||||
$(package)_download_file=$($(package)_version).tar.gz
|
|
||||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
|
||||||
$(package)_sha256_hash=70a7189418c2086d20c299c5d59250cf5940782c778892ccc899c66516ed240e
|
|
||||||
$(package)_build_subdir=cctools
|
|
||||||
$(package)_patches=no-build-date.patch
|
|
||||||
$(package)_dependencies=native_libtapi
|
|
||||||
|
|
||||||
define $(package)_set_vars
|
|
||||||
$(package)_config_opts=--target=$(host) --disable-lto-support --with-libtapi=$(host_prefix)
|
|
||||||
$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
|
|
||||||
$(package)_cc=$(clang_prog)
|
|
||||||
$(package)_cxx=$(clangxx_prog)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define $(package)_preprocess_cmds
|
|
||||||
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub cctools && \
|
|
||||||
patch -p1 < $($(package)_patch_dir)/no-build-date.patch
|
|
||||||
endef
|
|
||||||
|
|
||||||
define $(package)_config_cmds
|
|
||||||
$($(package)_autoconf)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define $(package)_build_cmds
|
|
||||||
$(MAKE)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
|
||||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install && \
|
|
||||||
cp $($(package)_extract_dir)/cctools/misc/install_name_tool $($(package)_staging_prefix_dir)/bin/
|
|
||||||
endef
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
package=native_libtapi
|
|
||||||
$(package)_version=664b8414f89612f2dfd35a9b679c345aa5389026
|
|
||||||
$(package)_download_path=https://github.com/tpoechtrager/apple-libtapi/archive
|
|
||||||
$(package)_download_file=$($(package)_version).tar.gz
|
|
||||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
|
||||||
$(package)_sha256_hash=62e419c12d1c9fad67cc1cd523132bc00db050998337c734c15bc8d73cc02b61
|
|
||||||
$(package)_patches=no_embed_git_rev.patch
|
|
||||||
|
|
||||||
define $(package)_preprocess_cmds
|
|
||||||
patch -p1 -i $($(package)_patch_dir)/no_embed_git_rev.patch
|
|
||||||
endef
|
|
||||||
|
|
||||||
define $(package)_build_cmds
|
|
||||||
CC=$(clang_prog) CXX=$(clangxx_prog) INSTALLPREFIX=$($(package)_staging_prefix_dir) ./build.sh
|
|
||||||
endef
|
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
|
||||||
./install.sh
|
|
||||||
endef
|
|
||||||
@ -22,7 +22,7 @@ freebsd_native_packages := freebsd_base
|
|||||||
freebsd_packages :=
|
freebsd_packages :=
|
||||||
|
|
||||||
ifneq ($(build_os),darwin)
|
ifneq ($(build_os),darwin)
|
||||||
darwin_native_packages := darwin_sdk native_cctools native_libtapi
|
darwin_native_packages := darwin_sdk
|
||||||
endif
|
endif
|
||||||
darwin_packages :=
|
darwin_packages :=
|
||||||
|
|
||||||
|
|||||||
@ -88,13 +88,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|||||||
split_program("@CC@" CC_DARWIN CC_DARWIN_ARGS)
|
split_program("@CC@" CC_DARWIN CC_DARWIN_ARGS)
|
||||||
SET(CMAKE_C_COMPILER "${CC_DARWIN}" "${CC_DARWIN_ARGS}")
|
SET(CMAKE_C_COMPILER "${CC_DARWIN}" "${CC_DARWIN_ARGS}")
|
||||||
SET(CMAKE_C_COMPILER_TARGET ${CLANG_TARGET})
|
SET(CMAKE_C_COMPILER_TARGET ${CLANG_TARGET})
|
||||||
SET(CMAKE_C_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX})
|
|
||||||
split_program("@CXX@" CXX_DARWIN CXX_DARWIN_ARGS)
|
split_program("@CXX@" CXX_DARWIN CXX_DARWIN_ARGS)
|
||||||
SET(CMAKE_CXX_COMPILER "${CXX_DARWIN}" "${CXX_DARWIN_ARGS}")
|
SET(CMAKE_CXX_COMPILER "${CXX_DARWIN}" "${CXX_DARWIN_ARGS}")
|
||||||
|
SET(CMAKE_C_FLAGS "@CFLAGS@")
|
||||||
SET(CMAKE_CXX_COMPILER_TARGET ${CLANG_TARGET})
|
SET(CMAKE_CXX_COMPILER_TARGET ${CLANG_TARGET})
|
||||||
SET(CMAKE_CXX_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX})
|
SET(CMAKE_CXX_FLAGS "@CXXFLAGS@")
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS "@LDFLAGS@")
|
||||||
|
SET(CMAKE_MODULE_LINKER_FLAGS "@LDFLAGS@")
|
||||||
|
SET(CMAKE_SHARED_LINKER_FLAGS "@LDFLAGS@")
|
||||||
|
SET(CMAKE_INSTALL_NAME_TOOL llvm-install-name-tool)
|
||||||
SET(CMAKE_ASM_COMPILER clang)
|
SET(CMAKE_ASM_COMPILER clang)
|
||||||
SET(CMAKE_ASM-ATT_COMPILER as)
|
SET(CMAKE_ASM-ATT_COMPILER llvm-as)
|
||||||
SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET})
|
SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET})
|
||||||
SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET})
|
SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET})
|
||||||
SET(APPLE True)
|
SET(APPLE True)
|
||||||
@ -102,10 +106,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|||||||
SET(BREW OFF)
|
SET(BREW OFF)
|
||||||
SET(PORT OFF)
|
SET(PORT OFF)
|
||||||
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
|
||||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
|
SET(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
|
||||||
SET(CMAKE_CXX_STANDARD 17)
|
SET(CMAKE_CXX_STANDARD 17)
|
||||||
SET(LLVM_ENABLE_PIC OFF)
|
|
||||||
SET(LLVM_ENABLE_PIE OFF)
|
|
||||||
elseif(TARGET_OS STREQUAL "android")
|
elseif(TARGET_OS STREQUAL "android")
|
||||||
SET(ANDROID TRUE)
|
SET(ANDROID TRUE)
|
||||||
|
|
||||||
|
|||||||
@ -165,15 +165,6 @@ done
|
|||||||
|
|
||||||
# Disable Guix ld auto-rpath behavior
|
# Disable Guix ld auto-rpath behavior
|
||||||
case "$HOST" in
|
case "$HOST" in
|
||||||
*darwin*)
|
|
||||||
# The auto-rpath behavior is necessary for darwin builds as some native
|
|
||||||
# tools built by depends refer to and depend on Guix-built native
|
|
||||||
# libraries
|
|
||||||
#
|
|
||||||
# After the native packages in depends are built, the ld wrapper should
|
|
||||||
# no longer affect our build, as clang would instead reach for
|
|
||||||
# x86_64-apple-darwin-ld from cctools
|
|
||||||
;;
|
|
||||||
*android*)
|
*android*)
|
||||||
;;
|
;;
|
||||||
*) export GUIX_LD_WRAPPER_DISABLE_RPATH=yes ;;
|
*) export GUIX_LD_WRAPPER_DISABLE_RPATH=yes ;;
|
||||||
@ -219,16 +210,6 @@ export GLIBC_DYNAMIC_LINKER=${glibc_dynamic_linker}
|
|||||||
# Environment variables for determinism
|
# Environment variables for determinism
|
||||||
export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name"
|
export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name"
|
||||||
export TZ="UTC"
|
export TZ="UTC"
|
||||||
case "$HOST" in
|
|
||||||
*darwin*)
|
|
||||||
# cctools AR, unlike GNU binutils AR, does not have a deterministic mode
|
|
||||||
# or a configure flag to enable determinism by default, it only
|
|
||||||
# understands if this env-var is set or not. See:
|
|
||||||
#
|
|
||||||
# https://github.com/tpoechtrager/cctools-port/blob/55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/ar/archive.c#L334
|
|
||||||
export ZERO_AR_DATE=yes
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Depends Building #
|
# Depends Building #
|
||||||
|
|||||||
@ -295,7 +295,8 @@ chain for " target " development."))
|
|||||||
(list
|
(list
|
||||||
libtool
|
libtool
|
||||||
python-minimal ; required to build libtapi in depends
|
python-minimal ; required to build libtapi in depends
|
||||||
gcc-toolchain-10
|
gcc-toolchain-12
|
||||||
clang-toolchain-11
|
clang-toolchain-18
|
||||||
binutils))
|
lld-18
|
||||||
|
(make-lld-wrapper lld-18 #:lld-as-ld? #t)))
|
||||||
(else '())))))
|
(else '())))))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user