Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error: "Can't link to the standard math library" with Eigen on Ubuntu 24.04 #8686

Open
TechCraft0 opened this issue Feb 17, 2025 · 7 comments
Assignees

Comments

@TechCraft0
Copy link

TechCraft0 commented Feb 17, 2025

env info

Operating System: Ubuntu 24.04.2 LTS
Kernel Version: 6.11.0-061100-generic
Conda Environment:

Package             Version     Editable project location
------------------- ----------- --------------------------------------------------------
build               1.2.2.post1
carla               0.10.0      /home/only/workspace/wang/carla/CarlaUE5/PythonAPI/carla
certifi             2024.8.30
charset-normalizer  3.4.1
exceptiongroup      1.2.2
idna                3.10
importlib_metadata  8.5.0
importlib_resources 6.4.5
numpy               1.24.4
packaging           24.2
pathspec            0.12.1
pip                 25.0.1
psutil              6.1.1
pygame              2.6.1
pyproject_hooks     1.2.0
requests            2.32.3
scikit_build_core   0.10.7
setuptools          75.1.0
tomli               2.2.1
typing_extensions   4.12.2
urllib3             2.2.3
wheel               0.44.0
zipp                3.20.2

Carla Version: Carla 0.10.0
GPU Driver: NVIDIA GeForce RTX 4060 Ti cuda12.6 Driver Version: 560.35.05
Compiler Version: gcc version 14.2.0
cmake version: 3.28.3

Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.

compile script:

#! /bin/bash

set -e

interactive=0
skip_prerequisites=0
launch=0
python_root=/home/xxx/workspace/anaconda3/envs/carla/bin/

workspace_path="$(dirname $(realpath "${BASH_SOURCE[-1]}"))"
echo "workspace_path=$workspace_path"

options=$(\
    getopt \
    -o "i,p,l,pyroot:" \
    --long "interactive,skip-prerequisites,launch,python-root:" \
    -n 'CarlaSetup.sh' -- "$@")

eval set -- "$options"
while true; do
    case "$1" in
        -i|--interactive)
            interactive=1
            shift
            ;;
        -p|--skip-prerequisites)
            skip_prerequisites=1
            shift
            ;;
        -l|--launch)
            launch=1
            shift
            ;;
        -pyroot|--python-root)
            python_root=$2
            shift 2
            ;;
        --)
            shift
            break
            ;;
        *)
            ;;
    esac
done

# Check for root privileges:
if [ -z "$EUID" ]; then
    EUID=$(id -u)
fi
if [ "$EUID" -ne 0 ]; then
    if [ $interactive -eq 0 ]; then
        if [ $skip_prerequisites -eq 0 ]; then
            echo "Please run this script as root. Otherwise pass --interactive to be prompted whenever root privileges or Git credentials are needed."
            exit 1
        fi
    fi
fi

# Check for Git credentials:
if [ -z "$GIT_LOCAL_CREDENTIALS" ]; then
    if [ $interactive -eq 1 ]; then
        echo "Warning: git credentials are not set. You may be required to manually enter them later."
    else
        echo "Git credentials are not set, can not continue setup in unattended mode."
        exit 1
    fi
else
    echo "Found git credentials."
fi

# -- PREREQUISITES INSTALL STEP --
if [ $skip_prerequisites -eq 0 ]; then
    python_path=python3
    if [ "$python_root" != "" ]; then
        python_path=${python_root}/python3
    fi
    echo "Installing prerequisites..."
    sudo -E bash -x Util/SetupUtils/InstallPrerequisites.sh --python-path=$python_path
else
    echo "Skipping prerequisites install step."
fi

# -- CLONE CONTENT --
if [ -d $workspace_path/Unreal/CarlaUnreal/Content ]; then
    echo "Found CARLA content."
else
    echo "Could not find CARLA content. Downloading..."
    mkdir -p $workspace_path/Unreal/CarlaUnreal/Content
    git \
        -C $workspace_path/Unreal/CarlaUnreal/Content \
        clone \
        -b ue5-dev \
        https://bitbucket.org/carla-simulator/carla-content.git \
        Carla
fi

# -- DOWNLOAD + BUILD UNREAL ENGINE --
# if [ ! -z $CARLA_UNREAL_ENGINE_PATH ] && [ -d $CARLA_UNREAL_ENGINE_PATH ]; then
#     echo "Found CARLA Unreal Engine at $CARLA_UNREAL_ENGINE_PATH"
# elif [ -d ../UnrealEngine5_carla ]; then
#     echo "Found CARLA Unreal Engine at $workspace_path/UnrealEngine5_carla. Assuming already built..."
# else
echo "Could not find CARLA Unreal Engine, downloading..."
pushd ..
# if [ -z "$GIT_LOCAL_CREDENTIALS" ]
# then
#     UE5_URL=https://github.com/CarlaUnreal/UnrealEngine.git
# else
#     GIT_CREDENTIALS_INFO=(${GIT_LOCAL_CREDENTIALS//@/ })
#     GIT_LOCAL_USER=${GIT_CREDENTIALS_INFO[0]}
#     GIT_LOCAL_TOKEN=${GIT_CREDENTIALS_INFO[1]}
#     UE5_URL=https://$GIT_LOCAL_USER:[email protected]/CarlaUnreal/UnrealEngine.git
# fi
# git clone -b ue5-dev-carla $UE5_URL UnrealEngine5_carla
pushd UnrealEngine5_carla
echo -e '\n#CARLA UnrealEngine5\nexport CARLA_UNREAL_ENGINE_PATH='$PWD >> ~/.bashrc
export CARLA_UNREAL_ENGINE_PATH=$PWD
echo "Running Unreal Engine pre-build steps..."
bash -x Setup.sh
bash -x GenerateProjectFiles.sh
echo "Building Unreal Engine 5..."
make
popd
popd
# fi

export CARLA_UNREAL_ENGINE_PATH=/home/xxx/workspace/wang/carla/UnrealEngine5_carla


# -- BUILD CARLA --
echo "Configuring the CARLA CMake project..."
cmake -G Ninja -S . -B Build \
    --toolchain=$PWD/CMake/Toolchain.cmake \
    -DLAUNCH_ARGS="-prefernvidia" \
    -DCMAKE_BUILD_TYPE=Release \
    -DENABLE_ROS2=ON \
    -DPython_ROOT_DIR=${python_root} \
    -DPython3_ROOT_DIR=${python_root} \
    -DCARLA_UNREAL_ENGINE_PATH=$CARLA_UNREAL_ENGINE_PATH
echo "Building CARLA..."
cmake --build Build
echo "Installing Python API..."
cmake --build Build --target carla-python-api-install
echo "CARLA Python API build+install succeeded."

# -- POST-BUILD STEPS --
if [ $launch -eq 1 ]; then
    echo "Launching Carla - Unreal Editor..."
    cmake --build Build --target launch
fi

Reproduction Steps

Create a conda environment: conda create -n carla python=3.8 
Activate the environment: conda activate carla
Clone the repository: git clone -b ue5-dev https://github.com/carla-simulator/carla.git CarlaUE5
Run the compilation command:  bash -x  CarlaSetup.sh --interactive
Observe compilation failure and the error described above

Full Error Log

Building UBT...
find: ‘../Restricted/**/Source/Programs/Shared’: No such file or directory
find: ‘../Platforms/*/Source/Programs/Shared’: No such file or directory
find: ‘../Restricted/**/Source/Programs/UnrealBuildTool’: No such file or directory
UnrealBuildTool.dll is up to date
Log file: /home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Programs/UnrealBuildTool/Log.txt
Using 'git status' to determine working set for adaptive non-unity build (/home/only/workspace/wang/carla/UnrealEngine5_carla).
Target is up to date
Total execution time: 0.62 seconds
"/home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Build/BatchFiles/RunUBT.sh" UnrealFrontend Linux Development  
Setting up bundled DotNet SDK
Building UBT...
find: ‘../Restricted/**/Source/Programs/Shared’: No such file or directory
find: ‘../Platforms/*/Source/Programs/Shared’: No such file or directory
find: ‘../Restricted/**/Source/Programs/UnrealBuildTool’: No such file or directory
UnrealBuildTool.dll is up to date
Log file: /home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Programs/UnrealBuildTool/Log.txt
Using 'git status' to determine working set for adaptive non-unity build (/home/only/workspace/wang/carla/UnrealEngine5_carla).
Target is up to date
Total execution time: 0.66 seconds
"/home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Build/BatchFiles/RunUBT.sh" UnrealEditor Linux Development  
Setting up bundled DotNet SDK
Building UBT...
find: ‘../Restricted/**/Source/Programs/Shared’: No such file or directory
find: ‘../Platforms/*/Source/Programs/Shared’: No such file or directory
find: ‘../Restricted/**/Source/Programs/UnrealBuildTool’: No such file or directory
UnrealBuildTool.dll is up to date
Log file: /home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Programs/UnrealBuildTool/Log.txt
Using 'git status' to determine working set for adaptive non-unity build (/home/only/workspace/wang/carla/UnrealEngine5_carla).
Target is up to date
Total execution time: 3.28 seconds
"/home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Build/BatchFiles/RunUBT.sh" UnrealInsights Linux Development  
Setting up bundled DotNet SDK
Building UBT...
find: ‘../Restricted/**/Source/Programs/Shared’: No such file or directory
find: ‘../Platforms/*/Source/Programs/Shared’: No such file or directory
find: ‘../Restricted/**/Source/Programs/UnrealBuildTool’: No such file or directory
UnrealBuildTool.dll is up to date
Log file: /home/only/workspace/wang/carla/UnrealEngine5_carla/Engine/Programs/UnrealBuildTool/Log.txt
Using 'git status' to determine working set for adaptive non-unity build (/home/only/workspace/wang/carla/UnrealEngine5_carla).
Target is up to date
Total execution time: 0.92 seconds
+ popd
~/workspace/wang/carla ~/workspace/wang/carla/CarlaUE5
+ popd
~/workspace/wang/carla/CarlaUE5
+ export CARLA_UNREAL_ENGINE_PATH=/home/only/workspace/wang/carla/UnrealEngine5_carla
+ CARLA_UNREAL_ENGINE_PATH=/home/only/workspace/wang/carla/UnrealEngine5_carla
+ echo 'Configuring the CARLA CMake project...'
Configuring the CARLA CMake project...
+ cmake -G Ninja -S . -B Build --toolchain=/home/only/workspace/wang/carla/CarlaUE5/CMake/Toolchain.cmake -DLAUNCH_ARGS=-prefernvidia -DCMAKE_BUILD_TYPE=Release -DENABLE_ROS2=ON -DPython_ROOT_DIR=/home/only/workspace/anaconda3/envs/carla/bin/ -DPython3_ROOT_DIR=/home/only/workspace/anaconda3/envs/carla/bin/ -DCARLA_UNREAL_ENGINE_PATH=/home/only/workspace/wang/carla/UnrealEngine5_carla
-- CARLA: Using /home/only/workspace/wang/carla/UnrealEngine5_carla as Unreal Engine root path.
-- CARLA: Checking for -fexceptions support
-- CARLA: Checking for -frtti support
-- CARLA: Downloading sqlite3...
-- CARLA: Downloading zlib...
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
--     /home/only/workspace/wang/carla/CarlaUE5/Build/_deps/zlib-src/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- CARLA: Downloading libpng...
CMake Deprecation Warning at Build/_deps/libpng-src/CMakeLists.txt:33 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at Build/_deps/libpng-src/CMakeLists.txt:34 (cmake_policy):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Performing Test HAVE_LD_VERSION_SCRIPT
-- Performing Test HAVE_LD_VERSION_SCRIPT - Success
-- Symbol prefix: 
-- CARLA: Downloading boost...
-- CARLA: Downloading eigen...
-- CARLA: Downloading rpclib...
-- CARLA: Downloading recastnavigation...
-- Boost: Release build, static libraries, MPI OFF, Python ON, testing OFF
-- Boost: libraries included: asio;iterator;python;date_time;geometry;container;variant2;gil
-- Performing Test BOOST_ATOMIC_TARGET_X86
-- Performing Test BOOST_ATOMIC_TARGET_X86 - Success
-- Performing Test BOOST_ATOMIC_COMPILER_HAS_SSE2
-- Performing Test BOOST_ATOMIC_COMPILER_HAS_SSE2 - Failed
-- Performing Test BOOST_ATOMIC_COMPILER_HAS_SSE41
-- Performing Test BOOST_ATOMIC_COMPILER_HAS_SSE41 - Failed
-- Boost.Context: architecture x86_64, binary format elf, ABI sysv, assembler gas, suffix .S, implementation fcontext
-- Performing Test BOOST_FILESYSTEM_HAS_INIT_PRIORITY
-- Performing Test BOOST_FILESYSTEM_HAS_INIT_PRIORITY - Success
-- Performing Test BOOST_FILESYSTEM_HAS_CXX20_ATOMIC_REF
-- Performing Test BOOST_FILESYSTEM_HAS_CXX20_ATOMIC_REF - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_MTIM
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_MTIM - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_MTIMENSEC - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_MTIMESPEC - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMENSEC
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMENSEC - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMESPEC
-- Performing Test BOOST_FILESYSTEM_HAS_STAT_ST_BIRTHTIMESPEC - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STATX
-- Performing Test BOOST_FILESYSTEM_HAS_STATX - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_STATX_SYSCALL
-- Performing Test BOOST_FILESYSTEM_HAS_STATX_SYSCALL - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW
-- Performing Test BOOST_FILESYSTEM_HAS_FDOPENDIR_NOFOLLOW - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_DIRENT_D_TYPE
-- Performing Test BOOST_FILESYSTEM_HAS_DIRENT_D_TYPE - Failed
-- Performing Test BOOST_FILESYSTEM_HAS_POSIX_AT_APIS
-- Performing Test BOOST_FILESYSTEM_HAS_POSIX_AT_APIS - Failed
-- Boost.Math: standalone mode OFF
-- Boost.Multiprecision: standalone mode OFF
-- Found Python: /home/only/workspace/anaconda3/envs/carla/include/python3.8 (found version "3.8.20") found components: Development NumPy Interpreter Development.Module Development.Embed 
-- Boost.Python: using Python 3.8.20 with NumPy at /home/only/workspace/anaconda3/envs/carla/lib/python3.8/site-packages/numpy/core/include
-- Found the following ICU libraries:
--   data (required): /usr/lib/x86_64-linux-gnu/libicudata.so
--   i18n (required): /usr/lib/x86_64-linux-gnu/libicui18n.so
--   uc (required): /usr/lib/x86_64-linux-gnu/libicuuc.so
-- Found ICU: /usr/include (found version "74.2") 
-- Boost.Thread: threading API is pthread
-- Performing Test EIGEN_COMPILER_SUPPORT_CPP11
-- Performing Test EIGEN_COMPILER_SUPPORT_CPP11 - Success
-- Performing Test COMPILER_SUPPORT_std=cpp03
-- Performing Test COMPILER_SUPPORT_std=cpp03 - Success
-- Performing Test standard_math_library_linked_to_automatically
-- Performing Test standard_math_library_linked_to_automatically - Failed
-- Performing Test standard_math_library_linked_to_as_m
-- Performing Test standard_math_library_linked_to_as_m - Failed
CMake Error at Build/_deps/eigen-src/CMakeLists.txt:108 (message):
  Can't link to the standard math library.  Please report to the Eigen
  developers, telling them about your platform.


-- Configuring incomplete, errors occurred
@quanting-xie
Copy link

Same error when trying to run on Ubuntu 24.04

@TechCraft0
Copy link
Author

Same error when trying to run on Ubuntu 24.04
I tried creating a build folder in the eigen source code under the Carla's Build/_deps directory, and running cmake .. inside the build folder to compile, and it passed completely without any errors. So, I suspect the issue lies in the build command for eigen in Carla, but I haven't been able to find exactly where the eigen compilation is triggered.

@MarcelPiNacy-CVC
Copy link
Contributor

Hi,
This looks like a UE5 build issue rather than an incorrect CMake command. Try building UE5 manually first.

@MarcelPiNacy-CVC
Copy link
Contributor

Btw please share logs using markdown or as separate files. Otherwise formatting breaks and you could also potentially mass ping random users, which has happened a couple of times.

@MarcelPiNacy-CVC MarcelPiNacy-CVC self-assigned this Feb 20, 2025
@TechCraft0
Copy link
Author

Hi, This looks like a UE5 build issue rather than an incorrect CMake command. Try building UE5 manually first.

Regarding the UE5 compilation issue you mentioned, I plan to attempt a manual compilation again tonight according to your guidance and will pay attention to any situations that may arise.
At the same time, I will make corresponding adjustments to the log format to ensure compliance with the recommendation of using markdown or separate files. This will help in clearly presenting the information and avoiding formatting issues. Thank you again for your help!

@TechCraft0
Copy link
Author

Hi, This looks like a UE5 build issue rather than an incorrect CMake command. Try building UE5 manually first.

I manually executed the UE5 build, but the error still occurs when I try again.

@HDA-DeepCells
Copy link

I'm also using Ubuntu 24.04 and I arrived at the same issue. First attempt simply running CarlaSetup.sh got to the "make" stage of the build where it tries to compile UnrealEngine_carla. It fails to compile around these Modules:

[156/4247] Compile Module.SignalProcessing.1.cpp
[202/4247] Compile Module.Chaos.10.cpp
[203/4247] Compile Module.Chaos.1.cpp
[207/4247] Compile Module.Chaos.12.cpp
[210/4247] Compile Module.Chaos.14.cpp
[211/4247] Compile Module.Chaos.13.cpp
[212/4247] Compile Module.Chaos.16.cpp
[213/4247] Compile Module.Chaos.17.cpp
[214/4247] Compile Module.Chaos.15.cpp
[217/4247] Compile Module.Chaos.11.cpp
[222/4247] Compile Module.Chaos.5.cpp
[225/4247] Compile Module.Chaos.7.cpp
[451/4247] Compile Module.Engine.27.cpp
[455/4247] Compile Module.Engine.26.cpp
[456/4247] Compile Module.Engine.29.cpp
[459/4247] Compile Module.Engine.33.cpp
[465/4247] Compile Module.Engine.42.cpp
[493/4247] Compile Module.Engine.65.cpp
[636/4247] Compile Module.GeometryCollectionEngine.cpp
[775/4247] Compile Module.Niagara.10.cpp
[896/4247] Compile Module.GeometryCache.cpp
[1107/4247] Compile Module.ChaosCloth.cpp
[1141/4247] Compile Module.ChaosClothAssetEngine.cpp
[1339/4247] Compile Module.NNERuntimeBasicCpu.cpp
[1437/4247] Compile Module.AnimNextAnimGraph.cpp
[1609/4247] Compile Module.Learning.cpp

Until it crashed around [2895/4247].

After a while I tried building UnrealEngine_carla separately and got the same error again (surprise) but this time I read somewhere that that I should just rerun the .../UnrealEngine_carla: "make" and magically it seemed to have resolved itself.

Of course I have no idea if this is related to the issue - however when trying to run .../CarlaUE5: CarlaSetup.sh afterwards it fails at:

-- Performing Test standard_math_library_linked_to_as_m - Failed
CMake Error at Build/_deps/eigen-src/CMakeLists.txt:108 (message):
  Can't link to the standard math library.  Please report to the Eigen
  developers, telling them about your platform.


-- Configuring incomplete, errors occurred

And trying to manually run:

cmake -G Ninja -S . -B Build --toolchain=$PWD/CMake/LinuxToolchain.cmake \
-DLAUNCH_ARGS="-prefernvidia" -DCMAKE_BUILD_TYPE=Release -DENABLE_ROS2=ON

Lands me in the same error.

I'd much appreciate some help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants