Skip to content

Examples are failed to built #130

@luadebug

Description

@luadebug

CC: @orange-cpp

Describe the bug
Failed to build examples. There is no m_vertex_array_object.

Log

 [82/87] Building CXX object examples/CMakeFiles/example_projection_matrix_builder.dir/example_proj_mat_builder.cpp.o
[83/87] Building CXX object examples/CMakeFiles/example_glfw3.dir/example_glfw3.cpp.o
FAILED: [code=1] examples/CMakeFiles/example_glfw3.dir/example_glfw3.cpp.o 
/usr/bin/c++ -DGLEW_STATIC -DOMATH_BUILD_TESTS -DOMATH_ENABLE_LEGACY -DOMATH_IMGUI_INTEGRATION -DOMATH_SUPRESS_SAFETY_CHECKS -DOMATH_USE_AVX2 -DOMATH_VERSION=\"4.4.0\" -I/home/runner/work/omath/omath/include -isystem /home/runner/work/omath/omath/cmake-build/vcpkg_installed/x64-linux/include -g -std=gnu++26 -mfma -mavx2 -MD -MT examples/CMakeFiles/example_glfw3.dir/example_glfw3.cpp.o -MF examples/CMakeFiles/example_glfw3.dir/example_glfw3.cpp.o.d -o examples/CMakeFiles/example_glfw3.dir/example_glfw3.cpp.o -c /home/runner/work/omath/omath/examples/example_glfw3.cpp
/home/runner/work/omath/omath/examples/example_glfw3.cpp:242:30: error: no member named 'm_vertex_array_object' in 'omath::primitives::Mesh<omath::Mat<4, 4, float, omath::MatStoreType::COLUMN_MAJOR>, omath::ViewAngles<omath::Angle<float, -9.000000e+01, 9.000000e+01, omath::AngleFlags::Clamped>, omath::Angle<float, -1.800000e+02, 1.800000e+02, omath::AngleFlags::Normalized>, omath::Angle<float, -1.800000e+02, 1.800000e+02, omath::AngleFlags::Normalized>>, omath::opengl_engine::MeshTrait>'
  242 |     flatIndices.reserve(cube.m_vertex_array_object.size() * 3);
      |                         ~~~~ ^
/home/runner/work/omath/omath/examples/example_glfw3.cpp:243:33: error: no member named 'm_vertex_array_object' in 'omath::primitives::Mesh<omath::Mat<4, 4, float, omath::MatStoreType::COLUMN_MAJOR>, omath::ViewAngles<omath::Angle<float, -9.000000e+01, 9.000000e+01, omath::AngleFlags::Clamped>, omath::Angle<float, -1.800000e+02, 1.800000e+02, omath::AngleFlags::Normalized>, omath::Angle<float, -1.800000e+02, 1.800000e+02, omath::AngleFlags::Normalized>>, omath::opengl_engine::MeshTrait>'
  243 |     for (const auto& tri : cube.m_vertex_array_object)
      |                            ~~~~ ^
/home/runner/work/omath/omath/examples/example_glfw3.cpp:255:80: warning: 'offsetof' on non-standard-layout type 'VertexType' (aka 'Vertex<Vector3<float>>') [-Winvalid-offsetof]
  255 |     glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(VertexType), (void*)offsetof(VertexType, position));
      |                                                                                ^                    ~~~~~~~~
/usr/lib/llvm-21/lib/clang/21/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
   16 | #define offsetof(t, d) __builtin_offsetof(t, d)
      |                        ^                     ~
/home/runner/work/omath/omath/examples/example_glfw3.cpp:258:80: warning: 'offsetof' on non-standard-layout type 'VertexType' (aka 'Vertex<Vector3<float>>') [-Winvalid-offsetof]
  258 |     glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(VertexType), (void*)offsetof(VertexType, normal));
      |                                                                                ^                    ~~~~~~
/usr/lib/llvm-21/lib/clang/21/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
   16 | #define offsetof(t, d) __builtin_offsetof(t, d)
      |                        ^                     ~
/home/runner/work/omath/omath/examples/example_glfw3.cpp:261:80: warning: 'offsetof' on non-standard-layout type 'VertexType' (aka 'Vertex<Vector3<float>>') [-Winvalid-offsetof]
  261 |     glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(VertexType), (void*)offsetof(VertexType, uv));
      |                                                                                ^                    ~~
/usr/lib/llvm-21/lib/clang/21/include/__stddef_offsetof.h:16:24: note: expanded from macro 'offsetof'
   16 | #define offsetof(t, d) __builtin_offsetof(t, d)
      |                        ^                     ~
3 warnings and 2 errors generated.
[84/87] Linking CXX executable /home/runner/work/omath/omath/out/Debug/omath_benchmark
[85/87] Linking CXX executable /home/runner/work/omath/omath/out/Debug/example_projection_matrix_builder
ninja: build stopped: subcommand failed.
Error: Process completed with exit code 1.

Reproduce:

  ##############################################################################
  # 9)  Valgrind Memory Check
  ##############################################################################
  valgrind-memory-check:
    name: Valgrind Analysis (All Targets)
    runs-on: ubuntu-latest
    needs: [linux-build-and-test]
    env:
      VCPKG_ROOT: ${{ github.workspace }}/vcpkg
    steps:
      - name: Install toolchain
        shell: bash
        run: |
          wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
          sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"
          sudo apt-get update
          sudo apt-get install -y git build-essential cmake ninja-build \
            zip unzip curl pkg-config ca-certificates \
            clang-21 lld-21 libc++-21-dev libc++abi-21-dev \
            llvm-21 valgrind libxmu-dev libxi-dev libgl-dev libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev
          sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-21 100
          sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-21 100
          sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-21 100
      - name: Checkout repository (with sub-modules)
        uses: actions/checkout@v4
        with:
          submodules: recursive

      - name: Set up vcpkg
        shell: bash
        run: |
          git clone https://github.com/microsoft/vcpkg "$VCPKG_ROOT"
          cd "$VCPKG_ROOT"
          ./bootstrap-vcpkg.sh
      - name: Configure (cmake --preset)
        shell: bash
        run: |
          cmake --preset linux-release-vcpkg \
            -DCMAKE_BUILD_TYPE=Debug \
            -DOMATH_BUILD_EXAMPLES=ON \
            -DOMATH_BUILD_TESTS=ON \
            -DOMATH_BUILD_BENCHMARK=ON \
            -DOMATH_ENABLE_VALGRIND=ON \
            -DVCPKG_MANIFEST_FEATURES="imgui;avx2;tests;benchmark;examples"
      - name: Build All Targets
        shell: bash
        run: cmake --build cmake-build/build/linux-release-vcpkg

      - name: Run Valgrind (All Registered Targets)
        shell: bash
        working-directory: cmake-build/build/linux-release-vcpkg
        run: |
          cmake --build . --target valgrind_all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions