Skip to content

Fix build with onnxruntime_DISABLE_ABSEIL=ON#14309

Closed
jf99 wants to merge 4 commits into
microsoft:mainfrom
jf99:fix-abseilfree-build
Closed

Fix build with onnxruntime_DISABLE_ABSEIL=ON#14309
jf99 wants to merge 4 commits into
microsoft:mainfrom
jf99:fix-abseilfree-build

Conversation

@jf99
Copy link
Copy Markdown

@jf99 jf99 commented Jan 16, 2023

Description

Just add some missing includes that made the build fail if abseil was disabled (see #14264 ).

Motivation and Context

Fixes #14264 which is actually still an open issue.

@jf99
Copy link
Copy Markdown
Author

jf99 commented Jan 16, 2023

@microsoft-github-policy-service agree

snnn
snnn previously approved these changes Jan 16, 2023
Copy link
Copy Markdown
Contributor

@snnn snnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@jf99
Copy link
Copy Markdown
Author

jf99 commented Jan 17, 2023

Sorry, I noticed that I modified the wrong file. Now it actually fixes the build issue.

@snnn
Copy link
Copy Markdown
Contributor

snnn commented Jan 18, 2023

It has a merge conflict now.

@jf99 jf99 force-pushed the fix-abseilfree-build branch from ced357e to 187f145 Compare January 18, 2023 08:10
@jf99
Copy link
Copy Markdown
Author

jf99 commented Jan 18, 2023

Rebased it.

@yuslepukhin
Copy link
Copy Markdown
Member

This PR does not cover the entire code base. Most of the issues with no Abseil build comes from ORT Training.

I have fixed the compilation issues here on this branch: microsoft/onnxruntime at yuslepukhin/no_abseil_fixes (github.com)

However, there is still a couple of link errors remain.

19>onnxruntime_session.lib(inference_session.obj) : error LNK2019: unresolved external symbol "void __cdecl onnxruntime::LoadInterOp(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,class std::vector<struct Ort::CustomOpDomain,class std::allocator > &,class std::function<void __cdecl(char const *)> const &)" (?LoadInterOp@onnxruntime@@YAXAEBV?$basic_string@_WU?$char_traits@_W@std@@v?$allocator@_W@2@@std@@aeav?$vector@UCustomOpDomain@Ort@@v?$allocator@UCustomOpDomain@Ort@@@std@@@3@AEBV?$function@$$A6AXPEBD@Z@3@@z) referenced in function "public: __cdecl <lambda_3e9c2ff73ea889894212b0fad2d40f6c>::operator()(class std::shared_ptr &)const " (??R<lambda_3e9c2ff73ea889894212b0fad2d40f6c>@@qeba@AEAV?$shared_ptr@VModel@onnxruntime@@@std@@@z)
19>onnxruntime_session.lib(inference_session.obj) : error LNK2019: unresolved external symbol "void __cdecl onnxruntime::LoadInterOp(class onnx::ModelProto const &,class std::vector<struct Ort::CustomOpDomain,class std::allocator > &,class std::function<void __cdecl(char const *)> const &)" (?LoadInterOp@onnxruntime@@YAXAEBVModelProto@onnx@@aeav?$vector@UCustomOpDomain@Ort@@v?$allocator@UCustomOpDomain@Ort@@@std@@@std@@aebv?$function@$$A6AXPEBD@Z@5@@z) referenced in function "public: __cdecl <lambda_27f4223cc2042b8bc17704d0b3c7370c>::operator()(class std::shared_ptr &)const " (??R<lambda_27f4223cc2042b8bc17704d0b3c7370c>@@qeba@AEAV?$shared_ptr@VModel@onnxruntime@@@std@@@z)
19>D:\dev\ort_work\training_noabseil\RelWithDebInfo\Debug\onnxruntime_test_trainer.exe : fatal error LNK1120: 2 unresolved externals

My build command line:

.\build.bat --config RelWithDebInfo --build_dir .\training_noabseil --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 17 2022" --parallel --build_shared_lib --enable_pybind --enable_language_interop_ops --enable_training --use_cuda --cuda_home c:\cuda\cuda --cudnn_home c:\cuda\cudnn --cuda_version 11.6 --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=52 onnxruntime_DISABLE_ABSEIL=ON

@snnn
Copy link
Copy Markdown
Contributor

snnn commented Jan 19, 2023

@yuslepukhin, the no absl build option was added for a customer who didn't use training. So we didn't look at the training case. If needed, we can add a daily pipeline to cover that. And thanks for your fixes!

@edgchen1
Copy link
Copy Markdown
Contributor

@jf99 thanks for the PR.

This particular fix (including <deque> in allocation_planner.cc) is in another PR which has been merged.

#14324

@jf99
Copy link
Copy Markdown
Author

jf99 commented Jan 19, 2023

@edgchen1 I see, but this does not lead to any conflict since my rebase, does it? Now the only change of this PR to allocation_planner.cc is that the STL includes are cleanly sorted alphabetically :) Or do I hurt anybody by doing that?

@jf99
Copy link
Copy Markdown
Author

jf99 commented Jan 19, 2023

@yuslepukhin So should we close this PR in favor of yours? That would be fine for me, as long as the issue gets fixed.

@yuslepukhin
Copy link
Copy Markdown
Member

@yuslepukhin So should we close this PR in favor of yours? That would be fine for me, as long as the issue gets fixed.

I do not have a PR. Feel free to pick my changes.

@edgchen1
Copy link
Copy Markdown
Contributor

@edgchen1 I see, but this does not lead to any conflict since my rebase, does it? Now the only change of this PR to allocation_planner.cc is that the STL includes are cleanly sorted alphabetically :) Or do I hurt anybody by doing that?

Right, just an FYI that a fix for the original issue was merged.

…nxruntime into fix-abseilfree-build-yuslepukhin
@snnn
Copy link
Copy Markdown
Contributor

snnn commented Jan 30, 2023

/azp run Windows GPU TensorRT CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, onnxruntime-python-checks-ci-pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed

@snnn
Copy link
Copy Markdown
Contributor

snnn commented Jan 30, 2023

/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, MacOS CI Pipeline, ONNX Runtime Web CI Pipeline, Windows CPU CI Pipeline, Windows GPU CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 6 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 9 pipeline(s).

pengwa added a commit that referenced this pull request Jan 31, 2023
### Fix build error on Windows when building with "
--enable_language_interop_ops -cmake_extra_defines
onnxruntime_DISABLE_ABSEIL=ON"

This is a subsequent fix after
#14309, which fixed build
for onnxruntime_DISABLE_ABSEIL=ON build.

Going furthur, if we enable --enable_language_interop_ops, there are
following two errors:

```
 test_symm_qgemm.cpp
  test_transpose.cpp
onnxruntime_session.lib(inference_session.obj) : error LNK2019: unresolved external symbol "void __cdecl onnxruntime::L
oadInterOp(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,cla
ss std::vector<struct Ort::CustomOpDomain,class std::allocator<struct Ort::CustomOpDomain> > &,class std::function<void
 __cdecl(char const *)> const &)" (?LoadInterOp@onnxruntime@@YAXAEBV?$basic_string@_WU?$char_traits@_W@std@@v?$allocato
r@_W@2@@std@@aeav?$vector@UCustomOpDomain@Ort@@v?$allocator@UCustomOpDomain@Ort@@@std@@@3@AEBV?$function@$$A6AXPEBD@Z@3
@@z) referenced in function "public: __cdecl <lambda_f3a907e0b0a0e11d80d305605215cce8>::operator()(class std::shared_pt
r<class onnxruntime::Model> &)const " (??R<lambda_f3a907e0b0a0e11d80d305605215cce8>@@qeba@AEAV?$shared_ptr@VModel@onnxr
untime@@@std@@@z) [C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\onnxruntime_test_trainer.vcxproj]
onnxruntime_session.lib(inference_session.obj) : error LNK2019: unresolved external symbol "void __cdecl onnxruntime::L
oadInterOp(class onnx::ModelProto const &,class std::vector<struct Ort::CustomOpDomain,class std::allocator<struct Ort:
:CustomOpDomain> > &,class std::function<void __cdecl(char const *)> const &)" (?LoadInterOp@onnxruntime@@YAXAEBVModelP
roto@onnx@@aeav?$vector@UCustomOpDomain@Ort@@v?$allocator@UCustomOpDomain@Ort@@@std@@@std@@aebv?$function@$$A6AXPEBD@Z@
5@@z) referenced in function "public: __cdecl <lambda_340b7b787b9c0f81848d348e60fe6c91>::operator()(class std::shared_p
tr<class onnxruntime::Model> &)const " (??R<lambda_340b7b787b9c0f81848d348e60fe6c91>@@qeba@AEAV?$shared_ptr@VModel@onnx
runtime@@@std@@@z) [C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\onnxruntime_test_trainer.vcxproj]
C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\onnxruntime_test_trainer.exe : fatal error
LNK1120: 2 unresolved externals [C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\onnxruntime_test_trainer.
vcxproj]
  onnxruntime.vcxproj -> C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\onnxruntime.dll
  onnxruntime_test_utils.vcxproj -> C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\onnxrun
  time_test_utils.lib
CUDACOMPILE : nvcc warning : The 'compute_35', 'compute_37', 'sm_35', and 'sm_37' architectures are deprecated, and may
 be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). [C:\Users\pengwa\dev\onnxruntime
\build\Windows\RelWithDebInfo\custom_op_library.vcxproj]
  cuda_ops.cu
CUDACOMPILE : nvcc warning : The 'compute_35', 'compute_37', 'sm_35', and 'sm_37' architectures are deprecated, and may
 be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). [C:\Users\pengwa\dev\onnxruntime
\build\Windows\RelWithDebInfo\onnxruntime_test_cuda_ops_lib.vcxproj]
```



```
  kernel_type_str_resolver_utils_test.cc
  local_kernel_registry_test.cc
C:\Users\pengwa\dev\onnxruntime\onnxruntime\test\framework\allocation_planner_test.cc(1388,9): error C2220: the followin
g warning is treated as an error [C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebInfo\onnxruntime_test_all.vcxp
roj]
C:\Users\pengwa\dev\onnxruntime\onnxruntime\test\framework\allocation_planner_test.cc(1388,9): warning C4067: unexpected
 tokens following preprocessor directive - expected a newline [C:\Users\pengwa\dev\onnxruntime\build\Windows\RelWithDebI
nfo\onnxruntime_test_all.vcxproj]
```


### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
@snnn
Copy link
Copy Markdown
Contributor

snnn commented Jul 3, 2025

This pull request has been automatically closed because it has merge conflicts and has been inactive for more than 30 days. Please rebase on the target branch and open a new PR.

@snnn snnn closed this Jul 3, 2025
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

Successfully merging this pull request may close these issues.

[Build] fails with onnxruntime_DISABLE_ABSEIL=ON

5 participants