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

[Build]: After building a static library in window, LINK fails. #27927

Open
2 tasks done
runNing4354 opened this issue Dec 5, 2024 · 2 comments
Open
2 tasks done

[Build]: After building a static library in window, LINK fails. #27927

runNing4354 opened this issue Dec 5, 2024 · 2 comments
Assignees
Labels
category: build OpenVINO cmake script / infra support_request

Comments

@runNing4354
Copy link

runNing4354 commented Dec 5, 2024

OpenVINO Version

tag 2024.5.0

Operating System

Windows System

Hardware Architecture

x86 (64 bits)

Target Platform

No response

Build issue description

After building with static libraries, the visual studio project link failed.

Here's the process I went through

git clone --branch 2024.5.0 https://github.com/openvinotoolkit/openvino.git

git submodule update --init --recursive

mkdir build

cd build

cmake -G "Visual Studio 17 2022" -A x64 -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release - \ 
DCMAKE_TOOLCHAIN_FILE=C:/Users/tam/Desktop/openvino/cmake/toolchains/mt.runtime.win32.toolchain.cmake ..

cmake --build . --config Release --target install

Then link the include and lib located in "C:\Program Files\OpenVINO\runtime" in the project properties,

Then, Properties page > Linker > Command Line and added the following commands.

 /WHOLEARCHIVE:libprotobuf.lib /WHOLEARCHIVE:mlas.lib /WHOLEARCHIVE:onnx.lib /WHOLEARCHIVE:onnx_proto.lib /WHOLEARCHIVE:OpenCL.lib /WHOLEARCHIVE:openvino.lib /WHOLEARCHIVE:openvino_auto_batch_plugin.lib /WHOLEARCHIVE:openvino_auto_plugin.lib /WHOLEARCHIVE:openvino_c.lib /WHOLEARCHIVE:openvino_hetero_plugin.lib /WHOLEARCHIVE:openvino_intel_cpu_plugin.lib /WHOLEARCHIVE:openvino_intel_gpu_graph.lib /WHOLEARCHIVE:openvino_intel_gpu_kernels.lib /WHOLEARCHIVE:openvino_intel_gpu_plugin.lib /WHOLEARCHIVE:openvino_intel_gpu_runtime.lib /WHOLEARCHIVE:openvino_intel_npu_plugin.lib /WHOLEARCHIVE:openvino_interpreter_backend.lib /WHOLEARCHIVE:openvino_ir_frontend.lib /WHOLEARCHIVE:openvino_itt.lib /WHOLEARCHIVE:openvino_jax_frontend.lib /WHOLEARCHIVE:openvino_npu_al.lib /WHOLEARCHIVE:openvino_npu_common.lib /WHOLEARCHIVE:openvino_npu_driver_compiler_adapter.lib /WHOLEARCHIVE:openvino_npu_level_zero_backend.lib /WHOLEARCHIVE:openvino_npu_logger_utils.lib /WHOLEARCHIVE:openvino_npu_zero_utils.lib /WHOLEARCHIVE:openvino_onednn_cpu.lib /WHOLEARCHIVE:openvino_onednn_gpu.lib /WHOLEARCHIVE:openvino_onnx_common.lib /WHOLEARCHIVE:openvino_onnx_frontend.lib /WHOLEARCHIVE:openvino_paddle_frontend.lib /WHOLEARCHIVE:openvino_pytorch_frontend.lib /WHOLEARCHIVE:openvino_reference.lib /WHOLEARCHIVE:openvino_shape_inference.lib /WHOLEARCHIVE:openvino_snippets.lib /WHOLEARCHIVE:openvino_template_plugin.lib /WHOLEARCHIVE:openvino_tensorflow_common.lib /WHOLEARCHIVE:openvino_tensorflow_frontend.lib /WHOLEARCHIVE:openvino_tensorflow_lite_frontend.lib /WHOLEARCHIVE:openvino_util.lib /WHOLEARCHIVE:pugixml.lib /WHOLEARCHIVE:snappy.lib /WHOLEARCHIVE:utils.lib /WHOLEARCHIVE:ze_loader.lib

As a result, you can see the LINK2001 error.

Error LNK2001 Unresolved external symbols "public: void __cdecl google::protobuf::internal::ArenaStringPtr::Set(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class google::protobuf::Arena *)" (?Set@ArenaStringPtr@internal@protobuf@google@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVArena@34@@Z)	

Build script or step-by-step to reproduce

No response

Relevant log output

No response

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
@ilya-lavrenov
Copy link
Contributor

Then, Properties page > Linker > Command Line and added the following commands.

Could you please use cmake interface and link target openvino::runtime to your application.

Manual listing of all static libraries in Properties page > Linker can be a tricky as you need to list all the libs in proper order.

@ilya-lavrenov ilya-lavrenov added the category: build OpenVINO cmake script / infra label Dec 6, 2024
@ilya-lavrenov ilya-lavrenov self-assigned this Dec 6, 2024
@runNing4354
Copy link
Author

Then, Properties page > Linker > Command Line and added the following commands.

Could you please use cmake interface and link target openvino::runtime to your application.

Manual listing of all static libraries in Properties page > Linker can be a tricky as you need to list all the libs in proper order.

Thank you. I tried using the CMake interface, and it linked successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: build OpenVINO cmake script / infra support_request
Projects
None yet
Development

No branches or pull requests

2 participants