Skip to content

[Build] Build failed when --use_tensorrt #24826

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

Open
FredYakumo opened this issue May 20, 2025 · 0 comments
Open

[Build] Build failed when --use_tensorrt #24826

FredYakumo opened this issue May 20, 2025 · 0 comments
Labels
build build issues; typically submitted using template

Comments

@FredYakumo
Copy link

Describe the issue

System: Arch Linux
--use_cuda
Build comand is, and the related path are right at all:

./build.sh --config Release --update --build --use_cuda --use_tensorrt --cuda_home=/usr/local/cuda/ --cudnn_home=/usr --tensorrt_home=/usr/local/TensorRT/  --use_tensorrt_oss_parser --parallel --cmake_generator Ninja

Get error:
NVCC_OUT = 1
-- CMAKE_CUDA_COMPILER_VERSION: 12.9.41
-- Enable flash attention for CUDA EP
-- Enable lean attention for CUDA EP
-- Enable memory efficient attention for CUDA EP
-- CMAKE_CXX_COMPILER_ID: GNU
-- CMAKE_CXX_COMPILER_VERSION: 11.4.0
-- Using -mavx2 -mfma -mavxvnni flags
CMake Warning (dev) at /usr/local/share/cmake-4.0/Modules/FetchContent.cmake:1953 (message):
Calling FetchContent_Populate(cutlass) is deprecated, call
FetchContent_MakeAvailable(cutlass) instead. Policy CMP0169 can be set to
OLD to allow FetchContent_Populate(cutlass) to be called directly for now,
but the ability to call it with declared details will be removed completely
in a future version.
Call Stack (most recent call first):
external/cutlass.cmake:11 (FetchContent_Populate)
onnxruntime_providers_cuda.cmake:256 (include)
onnxruntime_providers_cuda.cmake:320 (config_cuda_provider_shared_module)
onnxruntime_providers.cmake:124 (include)
CMakeLists.txt:1865 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at onnxruntime_providers_tensorrt.cmake:42 (math):
math cannot parse the expression: "": syntax error, unexpected end of file
(0).
Call Stack (most recent call first):
onnxruntime_providers.cmake:132 (include)
CMakeLists.txt:1865 (include)

CMake Error at onnxruntime_providers_tensorrt.cmake:43 (math):
math cannot parse the expression: "": syntax error, unexpected end of file
(0).
Call Stack (most recent call first):
onnxruntime_providers.cmake:132 (include)
CMakeLists.txt:1865 (include)

CMake Error at onnxruntime_providers_tensorrt.cmake:44 (math):
math cannot parse the expression: "": syntax error, unexpected end of file
(0).
Call Stack (most recent call first):
onnxruntime_providers.cmake:132 (include)

CMakeLists.txt:1865 (include)

-- Can't find NV_TENSORRT_MAJOR macro
-- Looking for nvinfer and nvinfer_plugin
-- Found CUDA headers at /usr/local/cuda/targets/x86_64-linux/include
-- Found TensorRT headers at /usr/local/TensorRT/include

Image

Troubleshooting and Fix:
After exploring various build option adjustments, I discovered that the root cause was an improperly matched regex pattern. By modifying the regex string match in onnxruntime_providers_tensorrt.cmake, I resolved the parsing issue and achieved a successful build.

You can review my proposed fix here:6a1b4e6

Image

Urgency

No response

Target platform

Arch Linux on WSL2

Build script

./build.sh --config Release --update --build --use_cuda --use_tensorrt --cuda_home=/usr/local/cuda/ --cudnn_home=/usr --tensorrt_home=/usr/local/TensorRT/ --use_tensorrt_oss_parser --parallel --cmake_generator Ninja

Error / output

NVCC_OUT = 1
-- CMAKE_CUDA_COMPILER_VERSION: 12.9.41
-- Enable flash attention for CUDA EP
-- Enable lean attention for CUDA EP
-- Enable memory efficient attention for CUDA EP
-- CMAKE_CXX_COMPILER_ID: GNU
-- CMAKE_CXX_COMPILER_VERSION: 11.4.0
-- Using -mavx2 -mfma -mavxvnni flags
CMake Warning (dev) at /usr/local/share/cmake-4.0/Modules/FetchContent.cmake:1953 (message):
Calling FetchContent_Populate(cutlass) is deprecated, call
FetchContent_MakeAvailable(cutlass) instead. Policy CMP0169 can be set to
OLD to allow FetchContent_Populate(cutlass) to be called directly for now,
but the ability to call it with declared details will be removed completely
in a future version.
Call Stack (most recent call first):
external/cutlass.cmake:11 (FetchContent_Populate)
onnxruntime_providers_cuda.cmake:256 (include)
onnxruntime_providers_cuda.cmake:320 (config_cuda_provider_shared_module)
onnxruntime_providers.cmake:124 (include)
CMakeLists.txt:1865 (include)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at onnxruntime_providers_tensorrt.cmake:42 (math):
math cannot parse the expression: "": syntax error, unexpected end of file
(0).
Call Stack (most recent call first):
onnxruntime_providers.cmake:132 (include)
CMakeLists.txt:1865 (include)

CMake Error at onnxruntime_providers_tensorrt.cmake:43 (math):
math cannot parse the expression: "": syntax error, unexpected end of file
(0).
Call Stack (most recent call first):
onnxruntime_providers.cmake:132 (include)
CMakeLists.txt:1865 (include)

CMake Error at onnxruntime_providers_tensorrt.cmake:44 (math):
math cannot parse the expression: "": syntax error, unexpected end of file
(0).
Call Stack (most recent call first):
onnxruntime_providers.cmake:132 (include)

CMakeLists.txt:1865 (include)

-- Can't find NV_TENSORRT_MAJOR macro
-- Looking for nvinfer and nvinfer_plugin
-- Found CUDA headers at /usr/local/cuda/targets/x86_64-linux/include
-- Found TensorRT headers at /usr/local/TensorRT/include

Visual Studio Version

No response

GCC / Compiler Version

No response

@FredYakumo FredYakumo added the build build issues; typically submitted using template label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

1 participant