microsoft / microsoft/onnxruntime

[Build] TRT CUDA minimal build fails with a link error

Open
#32,154 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build ep:CUDA ep:TensorRT
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the issue

As the titles suggests, building ORT with TensorRT and a CUDA minimal build fails since v1.29.0.
It also fails in the main branch.

### Urgency

Not urgent as we can still use ORT 1.28.

### Target platform

Windows x64

### Build script

build.bat --cmake_generator "Visual Studio 17 2022" --config Release --build_shared_lib --parallel --skip_tests --compile_no_warning_as_error --use_cuda --cuda_version 12.8 --cuda_home "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" --enable_cuda_minimal_build --use_tensorrt --tensorrt_home "C:\Program Files\TensorRT\10.4.0"

### Error / output

```
cuda_execution_provider.obj : error LNK2019: unresolved external symbol "class std::optional __cdecl onnxruntime::contrib::cuda::EstimateMatMulNBitsWorkspace(struct onnxruntime::Node const &,struct cudaDeviceProp const &)" (?EstimateMatMulNBitsWorkspace@cuda@contrib@onnxruntime@@YA?AV?$optional@_K@std@@AEBUNode@3@AEBUcudaDeviceProp@@@Z) referenced in function "public: virtual class std::vector >,class std::allocator > > > __cdecl onnxruntime::CUDAExecutionProvider::GetCapability(class onnxruntime::GraphViewer const &,class onnxruntime::IExecutionProvider::IKernelLookup const &,class onnxruntime::GraphOptimizerRegistry const &,class onnxruntime::IResourceAccountant *)const " (?GetCapability@CUDAExecutionProvider@onnxruntime@@UEBA?AV?$vector@V?$unique_ptr@UComputeCapability@onnxruntime@@U?$default_delete@UComputeCapability@onnxruntime@@@std@@@std@@V?$allocator@V?$unique_ptr@UComputeCapability@onnxruntime@@U?$default_delete@UComputeCapability@onnxruntime@@@std@@@std@@@2@@std@@AEBVGraphViewer@2@AEBVIKernelLookup@IExecutionProvider@2@AEBVGraphOptimizerRegistry@2@PEAVIResourceAccountant@2@@Z) [C:\Dev\onnxruntime\build\Windows\Release\onnxruntime_providers_cuda.vcxproj]
cuda_execution_provider.obj : error LNK2019: unresolved external symbol "class std::optional __cdecl onnxruntime::contrib::cuda::EstimateMatMulNBitsWorkspace(struct onnxruntime::Node const &,class gsl::span<__int64 const ,-1>,struct cudaDeviceProp const &)" (?EstimateMatMulNBitsWorkspace@cuda@contrib@onnxruntime@@YA?AV?$optional@_K@std@@AEBUNode@3@V?$span@$$CB_J$0?0@gsl@@AEBUcudaDeviceProp@@@Z) referenced in function "public: virtual class std::vector >,class std::allocator > > > __cdecl onnxruntime::CUDAExecutionProvider::GetCapability(class onnxruntime::GraphViewer const &,class onnxruntime::IExecutionProvider::IKernelLookup const &,class onnxruntime::GraphOptimizerRegistry const &,class onnxruntime::IResourceAccountant *)const " (?GetCapability@CUDAExecutionProvider@onnxruntime@@UEBA?AV?$vector@V?$unique_ptr@UComputeCapability@onnxruntime@@U?$default_delete@UComputeCapability@onnxruntime@@@std@@@std@@V?$allocator@V?$unique_ptr@UComputeCapability@onnxruntime@@U?$default_delete@UComputeCapability@onnxruntime@@@std@@@std@@@2@@std@@AEBVGraphViewer@2@AEBVIKernelLookup@IExecutionProvider@2@AEBVGraphOptimizerRegistry@2@PEAVIResourceAccountant@2@@Z) [C:\Dev\onnxruntime\build\Windows\Release\onnxruntime_providers_cuda.vcxproj]
C:\Dev\onnxruntime\build\Windows\Release\Release\onnxruntime_providers_cuda.dll : fatal error LNK1120: 2 unresolved externals [C:\Dev\onnxruntime\build\Windows\Release\onnxruntime_providers_cuda.vcxproj]
```

### Visual Studio Version

17.14.37

### GCC / Compiler Version

19.44.35228.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows x64 failure with the provided build.bat command and inspect the CUDA execution provider references to EstimateMatMulNBitsWorkspace under the minimal-build configuration. Trace where the referenced symbols are defined and built, then verify that the TensorRT and CUDA minimal build completes without the two unresolved externals.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.