From 1f457327002b874afc08a7e27de2e3003ffcd850 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 14 Oct 2022 23:36:47 -0700 Subject: [PATCH] [build] Update to 2023.2.4 native-utils and new dependencies (#4473) * Disable class-memaccess warning in Eigen * Shim NiFpga_OpenHostMemoryBuffer * Don't deploy .debug files in integration tests --- .github/workflows/cmake.yml | 9 +++- .github/workflows/gazebo.yml | 2 +- .github/workflows/gradle.yml | 8 +-- .github/workflows/lint-format.yml | 4 +- .github/workflows/sanitizers.yml | 15 +----- azure-pipelines-testbench.yaml | 2 +- buildSrc/build.gradle | 2 +- hal/src/main/native/athena/AddressableLED.cpp | 49 ++++++++++++++++++- shared/config.gradle | 8 +-- shared/opencv.gradle | 8 +-- .../eigen_patches/0001-Disable-warnings.patch | 13 +++-- wpilibcIntegrationTests/build.gradle | 3 ++ .../src/Core/util/DisableStupidWarnings.h | 3 ++ 13 files changed, 87 insertions(+), 39 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 62196cebab..3e90e12faf 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,7 +14,7 @@ jobs: include: - os: ubuntu-latest name: Linux - container: wpilib/roborio-cross-ubuntu:2022-20.04 + container: wpilib/roborio-cross-ubuntu:2023-22.04 flags: "" - os: macOS-11 name: macOS @@ -27,11 +27,16 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java python-is-python3 + - name: Install opencv (macOS) run: brew install opencv if: runner.os == 'macOS' - - name: Set up Python 3.8 + - name: Set up Python 3.8 (macOS) + if: runner.os == 'macOS' uses: actions/setup-python@v2 with: python-version: 3.8 diff --git a/.github/workflows/gazebo.yml b/.github/workflows/gazebo.yml index 40ffcab9c3..f7a44acf64 100644 --- a/.github/workflows/gazebo.yml +++ b/.github/workflows/gazebo.yml @@ -10,7 +10,7 @@ jobs: build: name: "Build" runs-on: ubuntu-latest - container: wpilib/gazebo-ubuntu:20.04 + container: wpilib/gazebo-ubuntu:22.04 steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 356c288bd6..e22c616c3b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -12,16 +12,16 @@ jobs: fail-fast: false matrix: include: - - container: wpilib/roborio-cross-ubuntu:2022-20.04 + - container: wpilib/roborio-cross-ubuntu:2023-22.04 artifact-name: Athena build-options: "-Ponlylinuxathena" - - container: wpilib/raspbian-cross-ubuntu:10-20.04 + - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 artifact-name: Arm32 build-options: "-Ponlylinuxarm32" - - container: wpilib/aarch64-cross-ubuntu:bionic-20.04 + - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 artifact-name: Arm64 build-options: "-Ponlylinuxarm64" - - container: wpilib/ubuntu-base:20.04 + - container: wpilib/ubuntu-base:22.04 artifact-name: Linux build-options: "-Ponlylinuxx86-64" name: "Build - ${{ matrix.artifact-name }}" diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 5eee98c3e0..9ce9b837ba 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -49,7 +49,7 @@ jobs: tidy: name: "clang-tidy" runs-on: ubuntu-latest - container: wpilib/roborio-cross-ubuntu:2022-20.04 + container: wpilib/roborio-cross-ubuntu:2023-22.04 steps: - uses: actions/checkout@v3 - name: Fetch all history and metadata @@ -79,7 +79,7 @@ jobs: javaformat: name: "Java format" runs-on: ubuntu-latest - container: wpilib/ubuntu-base:20.04 + container: wpilib/ubuntu-base:22.04 steps: - uses: actions/checkout@v3 - name: Fetch all history and metadata diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index d8f1a0cfc4..f4214dbabb 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -26,23 +26,12 @@ jobs: ctest-flags: "" name: "${{ matrix.name }}" runs-on: ubuntu-latest - container: wpilib/roborio-cross-ubuntu:2022-20.04 + container: wpilib/roborio-cross-ubuntu:2023-22.04 steps: - uses: actions/checkout@v3 - name: Install Dependencies - run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt install -y gcc-11 g++-11 - sudo update-alternatives \ - --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-11 - sudo update-alternatives --set gcc /usr/bin/gcc-11 - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 + run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java python-is-python3 - name: Install jinja run: python -m pip install jinja2 diff --git a/azure-pipelines-testbench.yaml b/azure-pipelines-testbench.yaml index 2fc5252f79..42052026d5 100644 --- a/azure-pipelines-testbench.yaml +++ b/azure-pipelines-testbench.yaml @@ -15,7 +15,7 @@ stages: vmImage: 'ubuntu-latest' container: - image: wpilib/roborio-cross-ubuntu:2022-18.04 + image: wpilib/roborio-cross-ubuntu:2023-22.04 timeoutInMinutes: 0 diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index bf5264d9e5..4cacc507a0 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -5,5 +5,5 @@ repositories { } } dependencies { - implementation "edu.wpi.first:native-utils:2023.1.0" + implementation "edu.wpi.first:native-utils:2023.2.4" } diff --git a/hal/src/main/native/athena/AddressableLED.cpp b/hal/src/main/native/athena/AddressableLED.cpp index 74a323a46d..ba446901e5 100644 --- a/hal/src/main/native/athena/AddressableLED.cpp +++ b/hal/src/main/native/athena/AddressableLED.cpp @@ -21,6 +21,51 @@ using namespace hal; +extern "C" { +NiFpga_Status NiFpga_ClientFunctionCall(NiFpga_Session session, uint32_t group, + uint32_t functionId, + const void* inBuffer, + size_t inBufferSize, void* outBuffer, + size_t outBufferSize); +} // extern "C" + +// Shim for broken ChipObject function +static const uint32_t clientFeature_hostMemoryBuffer = 0; +static const uint32_t hostMemoryBufferFunction_open = 2; + +// Input arguments for HMB open +struct AtomicHMBOpenInputs { + const char* memoryName; +}; + +// Output arguments for HMB open +struct AtomicHMBOpenOutputs { + size_t size; + void* virtualAddress; +}; + +static NiFpga_Status OpenHostMemoryBuffer(NiFpga_Session session, + const char* memoryName, + void** virtualAddress, size_t* size) { + struct AtomicHMBOpenOutputs outputs; + + struct AtomicHMBOpenInputs inputs; + inputs.memoryName = memoryName; + + NiFpga_Status retval = NiFpga_ClientFunctionCall( + session, clientFeature_hostMemoryBuffer, hostMemoryBufferFunction_open, + &inputs, sizeof(struct AtomicHMBOpenInputs), &outputs, + sizeof(struct AtomicHMBOpenOutputs)); + if (NiFpga_IsError(retval)) { + return retval; + } + *virtualAddress = outputs.virtualAddress; + if (size) { + *size = outputs.size; + } + return retval; +} + namespace { struct AddressableLED { std::unique_ptr led; @@ -101,8 +146,8 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED( uint32_t session = led->led->getSystemInterface()->getHandle(); - *status = NiFpga_OpenHostMemoryBuffer(session, "HMB_0_LED", &led->ledBuffer, - &led->ledBufferSize); + *status = OpenHostMemoryBuffer(session, "HMB_0_LED", &led->ledBuffer, + &led->ledBufferSize); if (*status != 0) { addressableLEDHandles->Free(handle); diff --git a/shared/config.gradle b/shared/config.gradle index 02597458bf..2af4c76194 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -14,10 +14,10 @@ nativeUtils { wpi { configureDependencies { wpiVersion = "-1" - niLibVersion = "2022.4.0" - opencvVersion = "4.5.5-3" - googleTestVersion = "1.11.0-2" - imguiVersion = "1.88-4" + niLibVersion = "2023.1.0" + opencvVersion = "4.6.0-2" + googleTestVersion = "1.11.0-3" + imguiVersion = "1.88-5" wpimathVersion = "-1" } } diff --git a/shared/opencv.gradle b/shared/opencv.gradle index ef7715d4a6..40d3c34a09 100644 --- a/shared/opencv.gradle +++ b/shared/opencv.gradle @@ -1,4 +1,4 @@ -def opencvVersion = '4.5.2-1' +def opencvVersion = '4.6.0-2' if (project.hasProperty('useCpp') && project.useCpp) { model { @@ -22,12 +22,12 @@ if (project.hasProperty('useCpp') && project.useCpp) { if (project.hasProperty('useJava') && project.useJava) { dependencies { - implementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-java:${opencvVersion}" + implementation "edu.wpi.first.thirdparty.frc2023.opencv:opencv-java:${opencvVersion}" if (!project.hasProperty('skipDev') || !project.skipDev) { - devImplementation "edu.wpi.first.thirdparty.frc2022.opencv:opencv-java:${opencvVersion}" + devImplementation "edu.wpi.first.thirdparty.frc2023.opencv:opencv-java:${opencvVersion}" } if (project.hasProperty('useDocumentation') && project.useDocumentation) { - javaSource "edu.wpi.first.thirdparty.frc2022.opencv:opencv-java:${opencvVersion}:sources" + javaSource "edu.wpi.first.thirdparty.frc2023.opencv:opencv-java:${opencvVersion}:sources" } } } diff --git a/upstream_utils/eigen_patches/0001-Disable-warnings.patch b/upstream_utils/eigen_patches/0001-Disable-warnings.patch index d875fb30c1..78a592251e 100644 --- a/upstream_utils/eigen_patches/0001-Disable-warnings.patch +++ b/upstream_utils/eigen_patches/0001-Disable-warnings.patch @@ -1,20 +1,23 @@ -From bfd3aa822ff70908c44ad2880b91d9a8dbc1ce7e Mon Sep 17 00:00:00 2001 +From 3bfc3d1e3cbc9d7032446cc4aa6246d1c7750901 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Wed, 18 May 2022 09:14:24 -0700 Subject: [PATCH] Disable warnings --- - Eigen/src/Core/util/DisableStupidWarnings.h | 8 ++++++++ - 1 file changed, 8 insertions(+) + Eigen/src/Core/util/DisableStupidWarnings.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) diff --git a/Eigen/src/Core/util/DisableStupidWarnings.h b/Eigen/src/Core/util/DisableStupidWarnings.h -index fe0cfec0b..9e8a0e7a9 100755 +index fe0cfec..d973255 100755 --- a/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/Eigen/src/Core/util/DisableStupidWarnings.h -@@ -71,6 +71,14 @@ +@@ -71,6 +71,17 @@ // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325 #pragma GCC diagnostic ignored "-Wattributes" #endif ++ #if __GNUC__>=8 ++ #pragma GCC diagnostic ignored "-Wclass-memaccess" ++ #endif + #if __GNUC__>=11 + // This warning is a false positive + #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" diff --git a/wpilibcIntegrationTests/build.gradle b/wpilibcIntegrationTests/build.gradle index 9cd75f849c..38fbe824d9 100644 --- a/wpilibcIntegrationTests/build.gradle +++ b/wpilibcIntegrationTests/build.gradle @@ -85,6 +85,9 @@ model { into '/cpp' } installTask.libs.each { + if (it.absolutePath.endsWith('.debug')) { + return + } task.from(it) { into '/libs' } diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h index 9e8a0e7a92..d973255943 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/Core/util/DisableStupidWarnings.h @@ -71,6 +71,9 @@ // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325 #pragma GCC diagnostic ignored "-Wattributes" #endif + #if __GNUC__>=8 + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif #if __GNUC__>=11 // This warning is a false positive #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"