Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use native clang as darwin compiler #618

Merged
merged 57 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e4afcbd
darwin builder gcc/g++ -> clang/clang++ default
DeckerSU Mar 8, 2024
59872f9
fix bdb build on native darwin (TODO: refactor bdb.mk)
DeckerSU Feb 8, 2021
31fad79
build: remove -Wno-builtin-declaration-mismatch for Mac
DeckerSU Mar 8, 2024
41636e8
build: remove gcc related flags from Mac build
DeckerSU Mar 8, 2024
398c1b2
build: mac, remove linker options -Wl,-undefined -Wl,dynamic_lookup
DeckerSU Mar 8, 2024
f02a180
Support serialization of std::vector<bool>
DeckerSU Feb 7, 2021
e6cd777
ccutils: explicitly handle remaining enumerations in switch
DeckerSU Mar 8, 2024
7b64e7c
payments: using correct format specifiers for logging
DeckerSU Mar 8, 2024
3a33476
komodo_utils: fix format specifiers
DeckerSU Mar 8, 2024
1c4d1b6
metrics: get rid of incorrect std::max usage
DeckerSU Mar 8, 2024
bb7094c
test eval bet: avoid of adding int to a string
DeckerSU Mar 8, 2024
56182f9
test parse notarisation data: avoid of using std::ios_base::openmode …
DeckerSU Mar 8, 2024
b646f20
build: mac, remove gcc specific linker flag -static-libgcc
DeckerSU Mar 8, 2024
c777bb1
build: fix libcurl linkage under darwin
DeckerSU Mar 8, 2024
79b2f33
build: libsodium, fix MACOSX_DEPLOYMENT_TARGET
DeckerSU Mar 8, 2024
a3defc2
tests: avoid dangling pointer after KomodoFeatures test
DeckerSU Mar 8, 2024
a90b0dc
build: remove gcc from mac ci workflow and from README
DeckerSU Mar 8, 2024
728f74a
build: bump boost to 1.78.0, fix placeholders, remove patches
DeckerSU Mar 9, 2024
11a0138
ci: explicitly use macos-12 instead of latest, try to use Xcode 13.2.1
DeckerSU Mar 9, 2024
771743d
ci: mac try to remove cpath
DeckerSU Mar 9, 2024
2422583
ci: mac try to not upgrade all formulaes
DeckerSU Mar 9, 2024
e31f899
Revert "build: bump boost to 1.78.0, fix placeholders, remove patches"
DeckerSU Mar 9, 2024
eedfc49
depends: try disable HTTP/2 in curl for Mac
DeckerSU Mar 9, 2024
ae9e1b8
depends: libcurl, fix mac build
DeckerSU Mar 9, 2024
b4bad46
ci: mac try to select needed Xcode version
DeckerSU Mar 9, 2024
a2d038c
build: mac bump macOS SDK to 10.15.6 (12.1)
DeckerSU Mar 9, 2024
0c0954c
build: mac add -fvisibility=hidden -fvisibility-inlines-hidden
DeckerSU Mar 9, 2024
ec83438
ci: disable explicit select XCode version
DeckerSU Mar 9, 2024
33f48c4
ci: mac run on macos-13
DeckerSU Mar 9, 2024
3ce0a0f
build: add -Wno-deprecated-builtins -Wno-enum-constexpr-conversion to…
DeckerSU Mar 10, 2024
2d1f5a4
build: consider libcc.a as static library, not lt-library
DeckerSU Mar 10, 2024
bfc87c0
ci: Update to actions/checkout@v3
DeckerSU Mar 10, 2024
43b30d0
build: mac add -Wno-unknown-warning-option
DeckerSU Mar 10, 2024
86480ba
ci: mac add wallet-utility and komodo-tx to artifacts
DeckerSU Mar 10, 2024
19c5d1a
build: mac add --enable-static --disable-shared
DeckerSU Mar 10, 2024
349e5e4
ci: mac revert runner to macos-latest
DeckerSU Mar 10, 2024
05b8395
build: revert darwin_debug_CFLAGS to -g -O0
DeckerSU Mar 10, 2024
82823cd
build: add test-linkage app to test on which library linkage will break
DeckerSU Mar 10, 2024
4452a97
test linkage: add libcjson
DeckerSU Mar 10, 2024
db21ec8
test linkage: add bitcoin common
DeckerSU Mar 10, 2024
a822a5d
test linkage: add zmq libs
DeckerSU Mar 10, 2024
33a8ced
test linkage: add leveldb + memenv
DeckerSU Mar 10, 2024
6fb0952
test linkage: add bitcoin server and others
DeckerSU Mar 10, 2024
41e231d
linkage test: add extra lib calls for linkage
DeckerSU Mar 10, 2024
04c1edf
linkage test: add libcryptocondition, libcjson, boost thread and sodi…
DeckerSU Mar 10, 2024
dfd0e2b
build: add logging debug info into mac build script
DeckerSU Mar 10, 2024
324040a
test linkage: add sodium, librustzcash calls
DeckerSU Mar 10, 2024
8a14d86
ci: mac get rid of using tar for archive artifacts, upload binaries d…
DeckerSU Mar 10, 2024
d9f516b
ci: mac revert .tar.gz archive creation and upload to artifacts
DeckerSU Mar 10, 2024
9004098
ci: use gtar on macos runner to avoid corrupting tar file contents
DeckerSU Mar 10, 2024
81fd9af
ci: mac bump actions versions
DeckerSU Mar 10, 2024
d86c8fc
ci: mac remove separate files upload, remove test-linkage
DeckerSU Mar 10, 2024
f313d5f
ci: mac remove gmp installation
DeckerSU Mar 10, 2024
b8ae49c
remove test-linkage experiment(s)
DeckerSU Mar 10, 2024
9994db0
remove logging debug info after build on mac
DeckerSU Mar 10, 2024
6b8683a
build: mac remove -enable-static --disable-shared from scripts
DeckerSU Mar 10, 2024
9a79ff0
ci: mac add / fix workflow comments
DeckerSU Mar 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/komodo_linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install deps (Linux)

Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
needs: linux-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install deps (Dice, Token, Faucet, Rewards CC)
run: |
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
needs: linux-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install deps (OraclesCC)
run: |
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
needs: linux-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install deps (BasicRPC)
run: |
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
needs: linux-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install deps (ChannelsCC)
run: |
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
needs: linux-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install deps (HeirCC)
run: |
Expand Down
39 changes: 20 additions & 19 deletions .github/workflows/komodo_mac_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Workaround for https://github.com/actions/setup-python/issues/577
- name: Clean up binaries and links (macOS)
Expand All @@ -31,29 +31,30 @@ jobs:
- name: Install deps (macOS)
run: |
brew update
brew upgrade || true
brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake
brew install gcc@8
brew install binutils
brew install protobuf
brew install coreutils
brew install wget
brew install python3
brew install gmp

# https://www.jessesquires.com/blog/2020/01/06/selecting-an-xcode-version-on-github-ci/
# https://github.com/actions/runner-images/issues/2619 (bsdtar issues)
# flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!!
- name: Build (macOS)
run: |
# flag for some CC tests transactions - so DO NOT USE THIS CI ARTIFACTS IN PRODUCTION!!!
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/
./zcutil/build-mac-dtest.sh -j4
tar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli
gtar -czvf komodo-macos.tar.gz src/komodod src/komodo-cli src/wallet-utility src/komodo-tx
# env:
# DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer

- name: Upload komodo-macos.tar.gz as artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: komodo-macos
path: ./komodo-macos.tar.gz
path: |
./komodo-macos.tar.gz

macos-test-dice-token-reards-faucet-cc:
if: ${{ false }}
Expand All @@ -63,7 +64,7 @@ jobs:
needs: macos-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install deps (Dice, Token, Faucet, Rewards CC)
run: |
Expand All @@ -72,7 +73,7 @@ jobs:
python3 -m pip install slick-bitcoinrpc pytest wget jsonschema

- name: Download komodo-macos.tar.gz
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: komodo-macos

Expand All @@ -93,15 +94,15 @@ jobs:
needs: macos-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install deps (OraclesCC)
run: |
brew install python3 curl
python3 -m pip install setuptools wheel
python3 -m pip install slick-bitcoinrpc pytest wget jsonschema
- name: Download komodo-macos.tar.gz
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: komodo-macos

Expand All @@ -122,15 +123,15 @@ jobs:
needs: macos-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install deps (BasicRPC)
run: |
brew install python3 curl
python3 -m pip install setuptools wheel
python3 -m pip install slick-bitcoinrpc pytest wget jsonschema
- name: Download komodo-macos.tar.gz
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: komodo-macos

Expand All @@ -151,15 +152,15 @@ jobs:
needs: macos-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install deps (ChannelsCC)
run: |
brew install python3 curl
python3 -m pip install setuptools wheel
python3 -m pip install slick-bitcoinrpc pytest wget jsonschema
- name: Download komodo-macos.tar.gz
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: komodo-macos

Expand All @@ -180,15 +181,15 @@ jobs:
needs: macos-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install deps (HeirCC)
run: |
brew install python3 curl
python3 -m pip install setuptools wheel
python3 -m pip install slick-bitcoinrpc pytest wget jsonschema
- name: Download komodo-macos.tar.gz
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: komodo-macos

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/komodo_win_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install deps(mingw)
env:
DEBIAN_FRONTEND: noninteractive
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download komodo_win.zip
uses: actions/download-artifact@v1
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
needs: windows-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download komodo_win.zip
uses: actions/download-artifact@v1
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
needs: windows-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download komodo_win.zip
uses: actions/download-artifact@v1
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
needs: windows-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download komodo_win.zip
uses: actions/download-artifact@v1
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
needs: windows-build

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Download komodo_win.zip
uses: actions/download-artifact@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/komodod_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
id: shortify_commit

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install deps (Linux)
env:
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
name: OSX Build
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install deps (macOS)
run: |
rm '/usr/local/bin/2to3'
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install deps (Windows)
env:
DEBIAN_FRONTEND: noninteractive
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ brew update
brew upgrade
brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake
brew update && brew install gcc@8
brew update
brew install binutils
brew install protobuf
brew install coreutils
Expand Down
11 changes: 6 additions & 5 deletions depends/builders/darwin.mk
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
build_darwin_CC = gcc-8
build_darwin_CXX = g++-8
build_darwin_CC:=$(shell xcrun -f clang) --sysroot $(shell xcrun --show-sdk-path)
build_darwin_CXX:=$(shell xcrun -f clang++) --sysroot $(shell xcrun --show-sdk-path)
build_darwin_AR: = $(shell xcrun -f ar)
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
build_darwin_STRIP: = $(shell xcrun -f strip)
build_darwin_OTOOL: = $(shell xcrun -f otool)
build_darwin_NM: = $(shell xcrun -f nm)
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
build_darwin_SHA256SUM = shasum -a 256
build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o

#darwin host on darwin builder. overrides darwin host preferences.
darwin_CC= gcc-8
darwin_CXX= g++-8
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -fvisibility=hidden -fvisibility-inlines-hidden --sysroot $(shell xcrun --show-sdk-path)
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -fvisibility=hidden -fvisibility-inlines-hidden -stdlib=libc++ --sysroot $(shell xcrun --show-sdk-path)
darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip)
darwin_LIBTOOL:=$(shell xcrun -f libtool)
darwin_OTOOL:=$(shell xcrun -f otool)
darwin_NM:=$(shell xcrun -f nm)
darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
darwin_native_binutils=
darwin_native_toolchain=
47 changes: 40 additions & 7 deletions depends/hosts/darwin.mk
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
OSX_MIN_VERSION=10.12
OSX_SDK_VERSION=10.12
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=253.9
darwin_CC=gcc-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=g++-8 -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
OSX_MIN_VERSION=10.15
OSX_SDK_VERSION=10.15.6
XCODE_VERSION=12.1
XCODE_BUILD_ID=12A7403
LD64_VERSION=609

OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers

# Flag explanations:
#
# -mlinker-version
#
# Ensures that modern linker features are enabled. See here for more
# 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.
#
# -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
#
# Forces clang to use the libc++ headers from our SDK and completely
# forget about the libc++ headers from the standard directories
#
# TODO: Once we start requiring a clang version that has the
# -stdlib++-isystem<directory> flag first introduced here:
# https://reviews.llvm.org/D64089, we should use that instead. Read the
# differential summary there for more details.
#
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1

darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)

darwin_release_CFLAGS=-g -O2
darwin_release_CFLAGS=-O2
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)

darwin_debug_CFLAGS=-g -O0
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)

darwin_native_binutils=native_cctools
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
darwin_native_toolchain=native_cctools
else
darwin_native_toolchain=
endif

darwin_cmake_system=Darwin
4 changes: 3 additions & 1 deletion depends/packages/bdb.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ endef

ifeq ($(build_os),darwin)
define $(package)_preprocess_cmds
sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h && \
sed -i.old 's/__atomic_compare_exchange\\(/__atomic_compare_exchange_db(/' src/dbinc/atomic.h && \
sed -i.old 's/atomic_init/atomic_init_db/' src/dbinc/atomic.h src/mp/mp_region.c src/mp/mp_mvcc.c src/mp/mp_fget.c src/mutex/mut_method.c src/mutex/mut_tas.c
endef
else ifeq ($(host_os),mingw32)
define $(package)_preprocess_cmds
Expand Down
1 change: 1 addition & 0 deletions depends/packages/libcurl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ $(package)_sha256_hash=816e41809c043ff285e8c0f06a75a1fa250211bbfb2dc0a037eeef39f
$(package)_config_opts=--with-openssl --disable-shared --enable-static --prefix=$(host_prefix)
$(package)_config_opts_linux=--host=x86_64-unknown-linux-gnu
$(package)_config_opts_mingw32=--enable-mingw --host=x86_64-w64-mingw32
$(package)_config_opts_darwin=--without-libidn2 --without-zstd --without-nghttp2 --without-librtmp --without-brotli
$(package)_cflags_darwin=-mmacosx-version-min=$(OSX_MIN_VERSION)
$(package)_conf_tool=./configure

Expand Down
2 changes: 1 addition & 1 deletion depends/packages/libsodium.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $(package)_config_opts=
define $(package)_set_vars
$(package)_build_env=DO_NOT_UPDATE_CONFIG_SCRIPTS=1
ifeq ($(build_os),darwin)
$(package)_build_env+=MACOSX_DEPLOYMENT_TARGET="10.11"
$(package)_build_env+=MACOSX_DEPLOYMENT_TARGET="$(OSX_MIN_VERSION)"
$(package)_cc=clang
$(package)_cxx=clang++
endif
Expand Down
Loading
Loading