Fix a build error when CUDA is enabled and onnxruntime_DISABLE_CONTRIB_OPS is ON (#21285)

Resolve #21204

To reproduce the issue, build the code with 
```
python3 tools/ci_build/build.py --build_dir /tmp/build13  --config Debug --skip_submodule_sync --build_shared_lib --parallel --use_binskim_compliant_compile_flags --build_csharp --enable_onnx_tests --update --build --build_wheel --use_cuda --cuda_home /usr/local/cuda --cudnn_home /usr/local/cuda --cmake_extra_defines onnxruntime_DISABLE_CONTRIB_OPS=ON onnxruntime_BUILD_UNIT_TESTS=OFF --skip_tests
```
Then run the following python script:

```python
#!/usr/bin/python3

import onnxruntime as ort
providers = [("CUDAExecutionProvider")]
ort_sess = ort.InferenceSession('/data/onnx/opset17/test_gemm_default_no_bias/model.onnx', providers=providers)
```

Without this fix, you will see an error:

Failed to load library libonnxruntime_providers_cuda.so with error:
/tmp/build18/Debug/onnxruntime/capi/libonnxruntime_providers_cuda.so:
undefined symbol:
_ZN11onnxruntime4cuda21BuildKernelCreateInfoINS0_57kCudaExecutionProvider_GridSample_kOnnxDomain_ver16_floatEEENS_16KernelCreateInfoEv
This commit is contained in:
Changming Sun 2024-07-16 10:05:33 -07:00 committed by GitHub
parent 218301403d
commit 8568a67673
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 0 additions and 0 deletions