diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index efecd76..766280a 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,4 +1,4 @@ -name: Build Wownero LWS (Final Repair) +name: Build Wownero LWS (Systematic Fix) on: push: branches: [ master, main ] @@ -47,17 +47,22 @@ jobs: mkdir -p /opt/wownero-sdk tar -xf sdk.tar.gz -C /opt/wownero-sdk - - name: Normalize SDK (Critical Fix) + - name: Normalize SDK (Debug & Fix) run: | cd /opt/wownero-sdk/lib - # Copy files to standard names so CMake can find them easily - # Linux builds often name them libz.a (or similar), ensure strict match - find . -name "libzstd*.a" -exec cp -v {} libzstd.a \; || true - find . -name "libz*.a" -exec cp -v {} libz.a \; || true - find . -name "libhidapi*.a" -exec cp -v {} libhidapi.a \; || true + # Force copy zstd to standard name + cp -v libzstd.a libzstd_static.a || true + # If libzstd.a doesn't exist, try to find a variant + if [ ! -f libzstd.a ]; then + find . -name "libzstd*.a" -exec cp -v {} libzstd.a \; + fi - echo "Listing /opt/wownero-sdk/lib:" - ls -la /opt/wownero-sdk/lib + # Same for HIDAPI and Zlib + find . -name "libhidapi*.a" -exec cp -v {} libhidapi.a \; || true + find . -name "libz*.a" -exec cp -v {} libz.a \; || true + + echo "=== SDK LIBRARY DEBUG LIST ===" + ls -lh *.a - name: Install Modern CMake run: | @@ -111,6 +116,130 @@ jobs: name: wownero-lws-x86_64-linux-gnu path: release/*.tar.gz + # ================================================================== + # JOB 2: LINUX CROSS (ARM64 / RISCV64) + # ================================================================== + linux-cross: + runs-on: ubuntu-latest + container: + image: wownero-builder-base:latest + options: --user root + strategy: + fail-fast: false + matrix: + include: + - target: aarch64-linux-gnu + proc: aarch64 + sysroot: /usr/aarch64-linux-gnu + - target: riscv64-linux-gnu + proc: riscv64 + sysroot: /usr/riscv64-linux-gnu + steps: + - name: Fix DNS + run: echo "192.168.88.230 git.such.software" >> /etc/hosts + - name: Checkout + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + rm -rf * + git config --global --add safe.directory '*' + git config --global url."http://oauth2:${GITHUB_TOKEN}@git.such.software:3000/Builds/RandomWOW.git".insteadOf "https://codeberg.org/wownero/RandomWOW" + git config --global url."http://oauth2:${GITHUB_TOKEN}@git.such.software:3000/Builds/wownero.git".insteadOf "https://codeberg.org/wownero/wownero.git" + git clone http://oauth2:$GITHUB_TOKEN@git.such.software:3000/${{ github.repository }}.git . + git submodule update --init --recursive + + - name: Patch Source + run: | + perl -pi -e 's/handler_loop\s+final/handler_loop/g' src/rest_server.cpp + perl -pi -e 's/find_library\(ICU/# find_library(ICU/g' external/monero/CMakeLists.txt + perl -pi -e 's/-Werror//g' CMakeLists.txt + perl -pi -e 's/-Werror//g' external/monero/CMakeLists.txt + + - name: Download SDK + run: | + curl -L -k -o sdk.tar.gz "https://git.such.software/Builds/wownero/releases/download/${{ env.CORE_TAG }}/wownero-core-${{ matrix.target }}.tar.gz" + mkdir -p /opt/wownero-sdk + tar -xf sdk.tar.gz -C /opt/wownero-sdk + + - name: Normalize SDK + run: | + cd /opt/wownero-sdk/lib + find . -name "libhidapi*.a" -exec cp -v {} libhidapi.a \; || true + find . -name "libzstd*.a" -exec cp -v {} libzstd.a \; || true + find . -name "libz*.a" -exec cp -v {} libz.a \; || true + + - name: Install Modern CMake + run: | + curl -L -o cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-linux-x86_64.tar.gz + tar -xf cmake.tar.gz + echo "$(pwd)/cmake-3.28.1-linux-x86_64/bin" >> $GITHUB_PATH + + - name: Generate Toolchain + run: | + cat < cross.cmake + set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_SYSTEM_PROCESSOR ${{ matrix.proc }}) + set(CMAKE_C_COMPILER ${{ matrix.target }}-gcc) + set(CMAKE_CXX_COMPILER ${{ matrix.target }}-g++) + + # Fix strptime on ARM + set(CMAKE_C_FLAGS "-D_GNU_SOURCE") + set(CMAKE_CXX_FLAGS "-D_GNU_SOURCE") + + set(CMAKE_FIND_ROOT_PATH /opt/wownero-sdk) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + EOF + + - name: Build + run: | + mkdir build && cd build + SDK_DIR="/opt/wownero-sdk" + + cmake .. -DCMAKE_TOOLCHAIN_FILE=../cross.cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_STATIC=ON \ + -DCMAKE_PREFIX_PATH="$SDK_DIR" \ + -DBOOST_ROOT="$SDK_DIR" \ + -DBoost_NO_SYSTEM_PATHS=ON \ + -DBoost_NO_BOOST_CMAKE=ON \ + -DBoost_USE_STATIC_RUNTIME=ON \ + -DOPENSSL_ROOT_DIR="$SDK_DIR" \ + -DOPENSSL_USE_STATIC_LIBS=TRUE \ + -DUNBOUND_INCLUDE_DIR="$SDK_DIR/include" \ + -DUNBOUND_LIBRARY="$SDK_DIR/lib/libunbound.a" \ + -DZMQ_INCLUDE_DIR="$SDK_DIR/include" \ + -DZMQ_LIBRARY="$SDK_DIR/lib/libzmq.a" \ + -DSodium_INCLUDE_DIR="$SDK_DIR/include" \ + -DSodium_LIBRARY_RELEASE="$SDK_DIR/lib/libsodium.a" \ + -DLIBUSB_INCLUDE_DIR="$SDK_DIR/include" \ + -DLIBUSB_LIBRARY="$SDK_DIR/lib/libusb-1.0.a" \ + -DHIDAPI_INCLUDE_DIR="$SDK_DIR/include" \ + -DHIDAPI_LIBRARY="$SDK_DIR/lib/libhidapi.a" \ + -DZSTD_LIBRARY="$SDK_DIR/lib/libzstd.a" \ + -DZSTD_INCLUDE_DIR="$SDK_DIR/include" \ + -DZLIB_LIBRARY="$SDK_DIR/lib/libz.a" \ + -DZLIB_INCLUDE_DIR="$SDK_DIR/include" \ + -DLIBEVENT_LIBRARY=$SDK_DIR/lib/libevent.a \ + -DLIBEVENT_INCLUDE_DIR=$SDK_DIR/include \ + -DRT_LIBRARY=rt \ + -DUSE_READLINE=OFF + + make -j$(nproc) + + - name: Package + run: | + mkdir release + tar -czf release/wownero-lws-${{ matrix.target }}.tar.gz -C build/src wownero-lws-daemon wownero-lws-admin + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: wownero-lws-${{ matrix.target }} + path: release/*.tar.gz + # ================================================================== # JOB 3: WINDOWS (x86_64) # ================================================================== @@ -132,7 +261,7 @@ jobs: git clone http://oauth2:$GITHUB_TOKEN@git.such.software:3000/${{ github.repository }}.git . git submodule update --init --recursive - - name: Patch Source (Windows Fixes) + - name: Patch Source run: | perl -pi -e 's/handler_loop\s+final/handler_loop/g' src/rest_server.cpp perl -pi -e 's/find_library\(ICU/# find_library(ICU/g' external/monero/CMakeLists.txt @@ -144,21 +273,12 @@ jobs: HEADER="external/monero/contrib/epee/include/storages/portable_storage_val_converters.h" sed -i '1i #include \n#ifdef _WIN32\nchar* strptime(const char* s, const char* f, struct tm* tm) { return 0; }\n#endif' $HEADER - # FIX ZMQ_ASYNC POSIX ERROR: - # We stub out the 'adescriptor' and related usages on Windows if needed. - # A safer hack is to include Boost ASIO Windows headers OR just define a dummy for compilation. - # Since fixing the code is hard in sed, we'll try to just bypass the problematic lines if possible, - # but really we need to map posix::stream_descriptor to windows::stream_handle or similar. - # FOR NOW: Let's try to simply COMMENT OUT the offending file from compilation in CMakeLists if possible? - # No, LWS needs it. - # Better Patch: Replace boost::asio::posix with a generic or windows equivalent? - # Actually, Boost.Asio has `assign` for generic descriptors. - # Let's try hacking `src/net/zmq_async.h` to include windows headers. - + # FIX ZMQ ASYNC FOR WINDOWS + # We need to inject the proper Windows header for 'stream_handle' sed -i 's/boost::asio::posix::stream_descriptor/boost::asio::windows::stream_handle/g' src/net/zmq_async.h - # Note: stream_handle might not have the exact same API (async_read_some vs async_read), but it's the closest analogue. - # Ideally, the code should be using a generic `socket` type if possible. - # If this fails, we might have to disable ZMQ on Windows entirely. + + # Inject the header at the top of the file + sed -i '1i #ifdef _WIN32\n#include \n#endif' src/net/zmq_async.h - name: Download SDK run: | @@ -301,6 +421,7 @@ jobs: mkdir build && cd build SDK_DIR="$(pwd)/../wownero-sdk" + # CRITICAL: We set Boost_USE_STATIC_RUNTIME=OFF because our Mac artifacts use shared runtime cmake .. -DCMAKE_BUILD_TYPE=Release \ -DBUILD_STATIC=ON \ -DBoost_USE_STATIC_RUNTIME=OFF \