You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.4下编译Libigl Example 102遇错误求助

Troubleshooting Libigl Example 102 Compilation Errors on Ubuntu 16.04

Hey there, let’s work through this compilation issue step by step—Libigl can be picky with dependencies and setup, so we’ll cover the most common pitfalls first.

First, Verify Core Dependencies

1. Check Eigen Compatibility

Libigl relies heavily on Eigen, and Ubuntu 16.04’s default Eigen version (3.2.x) might be too old for newer Libigl commits. Let’s confirm your installed version:

grep "#define EIGEN_WORLD_VERSION" /usr/local/include/Eigen/src/Core/util/Macros.h

If the output shows EIGEN_MAJOR_VERSION < 3 (or a full version older than 3.3.x), you’ll need to upgrade Eigen. You can download the latest 3.3.x+ release, extract it, and either:

  • Copy the Eigen folder to /usr/local/include (overwriting the old version if safe)
  • Or specify its parent directory explicitly during CMake configuration (we’ll cover this next)

2. Ensure Libigl Submodules Are Fully Initialized

Even with git clone --recursive, network issues can leave submodules like GLFW, ImGui, or TetGen incomplete. Fix this by navigating to your Libigl root directory and running:

git submodule update --init --recursive

This ensures all example-specific dependencies are pulled correctly—critical for Example 102’s viewer component.

Correct Compilation Workflow for Example 102

The official note says examples can be compiled independently, but let’s follow the most reliable out-of-source build workflow:

  1. Navigate to the Example 102 directory:
    cd libigl/examples/102_Viewer
    
  2. Create a dedicated build folder (avoids clutter and build cache conflicts):
    mkdir build && cd build
    
  3. Run CMake with explicit flags to eliminate ambiguity:
    cmake .. -DCMAKE_BUILD_TYPE=Release -DEIGEN_INCLUDE_DIR=/usr/local/include -DCMAKE_CXX_STANDARD=11
    
    • -DEIGEN_INCLUDE_DIR=/usr/local/include: Forces CMake to use your installed Eigen (points to the folder containing the Eigen subdirectory)
    • -DCMAKE_CXX_STANDARD=11: Ensures compatibility with Ubuntu 16.04’s GCC 5.4.0 (which supports C++11 but requires explicit enabling)
  4. Compile with parallel jobs to speed things up:
    make -j$(nproc)
    

Fix Common Linker/Compiler Errors

  • "Undefined reference to GLFW functions": If you hit this, install system-wide GLFW as a fallback:
    sudo apt-get install libglfw3-dev libglfw3
    
    Re-run CMake and make after installation.
  • "Eigen/Core: No such file or directory": Double-check the -DEIGEN_INCLUDE_DIR path—it should point to the parent folder of the Eigen directory (e.g., /usr/local/include, not /usr/local/include/Eigen). If issues persist, add the path to your environment temporarily:
    export CMAKE_PREFIX_PATH=/usr/local/include:$CMAKE_PREFIX_PATH
    source ~/.bashrc
    
    Then re-run CMake.

If you still run into errors, sharing the exact compiler output will help narrow things down—but these steps resolve 90% of common Libigl compilation issues on Ubuntu 16.04.

内容的提问来源于stack exchange,提问作者Allens

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:51:36