From 9ab292c6c98a214fae256858c561f1ac634589b0 Mon Sep 17 00:00:00 2001 From: neodiX Date: Mon, 7 Apr 2025 21:46:37 +0400 Subject: [PATCH 1/4] not always gh mac runners have nproc utility --- assembly/native/build-macos-portable.sh | 10 +++++----- assembly/native/build-macos-shared.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assembly/native/build-macos-portable.sh b/assembly/native/build-macos-portable.sh index 81ac507b7..277973088 100644 --- a/assembly/native/build-macos-portable.sh +++ b/assembly/native/build-macos-portable.sh @@ -55,7 +55,7 @@ git clone https://github.com/lz4/lz4.git ../3pp/lz4 cd ../3pp/lz4 lz4Path=`pwd` git checkout v1.9.4 -make -j$(nproc) +make -j4 test $? -eq 0 || { echo "Can't compile lz4"; exit 1; } cd ../../build # ./lib/liblz4.a @@ -73,7 +73,7 @@ if [ ! -d "../3pp/libsodium" ]; then git checkout 1.0.18 ./autogen.sh ./configure --with-pic --enable-static - make -j$(nproc) + make -j4 test $? -eq 0 || { echo "Can't compile libsodium"; exit 1; } cd ../../build else @@ -87,7 +87,7 @@ if [ ! -d "../3pp/openssl_3" ]; then opensslPath=`pwd` git checkout openssl-3.1.4 ./config - make build_libs -j$(nproc) + make build_libs -j4 test $? -eq 0 || { echo "Can't compile openssl_3"; exit 1; } cd ../../build else @@ -100,7 +100,7 @@ if [ ! -d "../3pp/zlib" ]; then cd ../3pp/zlib zlibPath=`pwd` ./configure --static - make -j$(nproc) + make -j4 test $? -eq 0 || { echo "Can't compile zlib"; exit 1; } cd ../../build else @@ -116,7 +116,7 @@ if [ ! -d "../3pp/libmicrohttpd" ]; then cd libmicrohttpd-1.0.1 libmicrohttpdPath=`pwd` ./configure --enable-static --disable-tests --disable-benchmark --disable-shared --disable-https --with-pic - make -j$(nproc) + make -j4 test $? -eq 0 || { echo "Can't compile libmicrohttpd"; exit 1; } cd ../../../build else diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh index dbb4e7d29..595c44e3e 100644 --- a/assembly/native/build-macos-shared.sh +++ b/assembly/native/build-macos-shared.sh @@ -53,7 +53,7 @@ if [ ! -d "lz4" ]; then cd lz4 lz4Path=`pwd` git checkout v1.9.4 - make -j$(nproc) + make -j4 test $? -eq 0 || { echo "Can't compile lz4"; exit 1; } cd .. else From 2f3b2de3cf7d06bdc94bcd93adb8739257294e25 Mon Sep 17 00:00:00 2001 From: neodiX Date: Sun, 27 Apr 2025 19:40:51 +0400 Subject: [PATCH 2/4] deprecate Ubuntu 20.04 --- .../build-ton-linux-arm64-appimage.yml | 14 ++++++------- .../build-ton-linux-x86-64-appimage.yml | 20 +++++++------------ .../build-ton-linux-x86-64-shared.yml | 9 +-------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-ton-linux-arm64-appimage.yml b/.github/workflows/build-ton-linux-arm64-appimage.yml index 289cd2a7e..a0ba4a022 100644 --- a/.github/workflows/build-ton-linux-arm64-appimage.yml +++ b/.github/workflows/build-ton-linux-arm64-appimage.yml @@ -36,21 +36,21 @@ jobs: uses: actions/cache@v4 with: path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-3pp-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-3pp-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - name: Cache OpenSSL id: cache-openssl uses: actions/cache@v4 with: path: openssl_3 - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - name: Restore cache TON uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-portable-ccache + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-portable-ccache - name: Build TON run: | @@ -65,7 +65,7 @@ jobs: uses: actions/cache/save@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} - name: Make AppImages run: | @@ -80,8 +80,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-portable-libs-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-arm-portable-libs-ccache + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-portable-libs-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-arm-portable-libs-ccache - name: Build TON libs run: | diff --git a/.github/workflows/build-ton-linux-x86-64-appimage.yml b/.github/workflows/build-ton-linux-x86-64-appimage.yml index 0f5645a3a..43d989243 100644 --- a/.github/workflows/build-ton-linux-x86-64-appimage.yml +++ b/.github/workflows/build-ton-linux-x86-64-appimage.yml @@ -4,7 +4,7 @@ on: [push,workflow_dispatch,workflow_call] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out repository @@ -25,12 +25,6 @@ jobs: sudo apt remove libgsl-dev mkdir ~/.ccache 3pp - - name: Install gcc-11 g++-11 - run: | - sudo apt install -y manpages-dev software-properties-common - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt update && sudo apt install gcc-11 g++-11 - - name: Install clang-16 run: | wget https://apt.llvm.org/llvm.sh @@ -42,20 +36,20 @@ jobs: uses: actions/cache@v4 with: path: 3pp - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-3pp-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-3pp-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - name: Cache OpenSSL id: cache-openssl uses: actions/cache@v4 with: path: openssl_3 - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-openssl_3-${{ hashFiles('**/assembly/native/build-ubuntu-appimages.sh') }} - name: Restore cache TON uses: actions/cache/restore@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-portable-ccache + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-portable-ccache - name: Build TON run: | @@ -70,7 +64,7 @@ jobs: uses: actions/cache/save@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-portable-ccache-${{ steps.date-stamp.outputs.timestamp }} - name: Make AppImages run: | @@ -85,8 +79,8 @@ jobs: uses: actions/cache@v4 with: path: ~/.ccache - key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-portable-libs-ccache-${{ steps.date-stamp.outputs.timestamp }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-ubuntu-20.04-portable-libs-ccache + key: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-portable-libs-ccache-${{ steps.date-stamp.outputs.timestamp }} + restore-keys: ${{ runner.os }}-${{ runner.arch }}-ubuntu-22.04-portable-libs-ccache - name: Build TON libs run: | diff --git a/.github/workflows/build-ton-linux-x86-64-shared.yml b/.github/workflows/build-ton-linux-x86-64-shared.yml index 37eddf369..ed05d18aa 100644 --- a/.github/workflows/build-ton-linux-x86-64-shared.yml +++ b/.github/workflows/build-ton-linux-x86-64-shared.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] + os: [ubuntu-22.04, ubuntu-24.04] runs-on: ${{ matrix.os }} steps: @@ -28,13 +28,6 @@ jobs: sudo apt-get install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev libjemalloc-dev ccache mkdir ~/.ccache - - if: matrix.os == 'ubuntu-20.04' - name: Install gcc-11 - run: | - sudo apt install -y manpages-dev software-properties-common - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt update && sudo apt install gcc-11 g++-11 - - if: matrix.os != 'ubuntu-24.04' run: | wget https://apt.llvm.org/llvm.sh From ff641fdede1a29cc4c5341f8f231a10dbfb0ae34 Mon Sep 17 00:00:00 2001 From: neodix Date: Sun, 27 Apr 2025 21:19:21 +0400 Subject: [PATCH 3/4] fix linking issues of portable tonlibjson.dylib --- assembly/native/build-macos-portable.sh | 1 - assembly/native/build-macos-shared.sh | 1 - tonlib/CMakeLists.txt | 11 +++++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/assembly/native/build-macos-portable.sh b/assembly/native/build-macos-portable.sh index 277973088..c46ea416e 100644 --- a/assembly/native/build-macos-portable.sh +++ b/assembly/native/build-macos-portable.sh @@ -127,7 +127,6 @@ fi cmake -GNinja .. \ -DPORTABLE=1 \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=$OSX_TARGET \ --DCMAKE_CXX_FLAGS="-stdlib=libc++" \ -DCMAKE_BUILD_TYPE=Release \ -DOPENSSL_FOUND=1 \ -DOPENSSL_INCLUDE_DIR=$opensslPath/include \ diff --git a/assembly/native/build-macos-shared.sh b/assembly/native/build-macos-shared.sh index 595c44e3e..a32669490 100644 --- a/assembly/native/build-macos-shared.sh +++ b/assembly/native/build-macos-shared.sh @@ -66,7 +66,6 @@ brew install openssl@3 brew unlink openssl@3 && brew link --overwrite openssl@3 cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. \ --DCMAKE_CXX_FLAGS="-stdlib=libc++" \ -DLZ4_FOUND=1 \ -DLZ4_LIBRARIES=$lz4Path/lib/liblz4.a \ -DLZ4_INCLUDE_DIRS=$lz4Path/lib diff --git a/tonlib/CMakeLists.txt b/tonlib/CMakeLists.txt index 2e3c583d4..f86364411 100644 --- a/tonlib/CMakeLists.txt +++ b/tonlib/CMakeLists.txt @@ -102,6 +102,17 @@ else() target_link_libraries(tonlibjson PRIVATE tonlibjson_private) endif() +if (APPLE) + set(CMAKE_MACOSX_RPATH ON) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) +endif() + +if (APPLE AND PORTABLE) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++") +endif() + generate_export_header(tonlibjson EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/tonlib/tonlibjson_export.h) if (TONLIBJSON_STATIC OR USE_EMSCRIPTEN) target_compile_definitions(tonlibjson PUBLIC TONLIBJSON_STATIC_DEFINE) From bc848c9374bcef3dcf185de85778db9530b2baba Mon Sep 17 00:00:00 2001 From: neodix Date: Wed, 28 May 2025 11:37:10 +0400 Subject: [PATCH 4/4] bind libgsl and libblas into portable binaries --- .github/workflows/build-ton-linux-x86-64-appimage.yml | 3 +-- assembly/appimage/create-appimages.sh | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-ton-linux-x86-64-appimage.yml b/.github/workflows/build-ton-linux-x86-64-appimage.yml index 43d989243..7ad873d22 100644 --- a/.github/workflows/build-ton-linux-x86-64-appimage.yml +++ b/.github/workflows/build-ton-linux-x86-64-appimage.yml @@ -21,8 +21,7 @@ jobs: - name: Install system libraries run: | sudo apt update - sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache - sudo apt remove libgsl-dev + sudo apt install -y build-essential git cmake ninja-build zlib1g-dev libsecp256k1-dev libmicrohttpd-dev libsodium-dev liblz4-dev ccache libgsl-dev libblas-dev mkdir ~/.ccache 3pp - name: Install clang-16 diff --git a/assembly/appimage/create-appimages.sh b/assembly/appimage/create-appimages.sh index 2a8cd0ec6..7bd68b6fb 100644 --- a/assembly/appimage/create-appimages.sh +++ b/assembly/appimage/create-appimages.sh @@ -35,6 +35,8 @@ for file in ../artifacts/*; do /lib/$ARCH-linux-gnu/libmicrohttpd.so.12 \ /lib/$ARCH-linux-gnu/libreadline.so.8 \ /lib/$ARCH-linux-gnu/libstdc++.so.6 \ + /lib/$ARCH-linux-gnu/libgsl.so.27 \ + /lib/$ARCH-linux-gnu/libblas.so.3 \ $appName.AppDir/usr/lib/ chmod +x ./$appName.AppDir/usr/bin/$appName