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

error LNK2019 when building the library NeoOnnx.dll #470

Closed
Vovkin81 opened this issue Oct 27, 2021 · 2 comments · Fixed by #504
Closed

error LNK2019 when building the library NeoOnnx.dll #470

Vovkin81 opened this issue Oct 27, 2021 · 2 comments · Fixed by #504

Comments

@Vovkin81
Copy link

Hello.
I am building a library on windows 10, MSVC 2019 x64, protobuf 3.18.1 . I get two errors:

onnx.pb.obj : error LNK2019: ссылка на неразрешенный внешний символ "class google::protobuf::internal::ExplicitlyConstr
ucted<class std::basic_string<char,struct std::char_traits,class std::allocator > > google::protobuf::inter
nal::fixed_address_empty_string" (?fixed_address_empty_string@internal@protobuf@google@@3v?$ExplicitlyConstructed@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@123@A) в функции "public: virtual class onnx::ValueInfoProto* __cdecl onnx::ValueInfoProto::New(void)const " (?New@ValueInfoProto@onnx@@UEBAPEAV12@XZ). [H:\libs\neoml2.0.22.0\Build\NeoOnnx\src\NeoOnnx.vcxproj]

onnx.pb.obj : error LNK2019: ссылка на неразрешенный внешний символ "struct std::atomic google::protobuf::interna
l::init_protobuf_defaults_state" (?init_protobuf_defaults_state@internal@protobuf@google@@3u?$atomic@_N@std@@A) в функции "public: virtual unsigned char * __cdecl onnx::TensorShapeProto_Dimension::_InternalSerialize(unsigned char *,class
google::protobuf::io::EpsCopyOutputStream *)const " (?_InternalSerialize@TensorShapeProto_Dimension@onnx@@UEBAPEAEPEAEPEAVEpsCopyOutputStream@io@protobuf@google@@@z). [H:\libs\neoml2.0.22.0\Build\NeoOnnx\src\NeoOnnx.vcxproj]

H:\libs\neoml2.0.22.0\Build\NeoOnnx\src\Release\NeoOnnx.dll : fatal error LNK1120: неразрешенных внешних элементов: 2 [
H:\libs\neoml2.0.22.0\Build\NeoOnnx\src\NeoOnnx.vcxproj]

How fix it?
Thank you!

@FedyuninV
Copy link
Contributor

This is protobuf-related problem protocolbuffers/protobuf#2502 and it occurs when trying to link protobuf dynamically.

It can be fixed by adding -DCMAKE_CXX_FLAGS='-DPROTOBUF_USE_DLLS' to the NeoML's generating command.

(If you don't need ONNX import, then you can just add -DNeoOnnx_BUILD=OFF and get rid of protobuf dependency)

@FedyuninV
Copy link
Contributor

Now it should work without explicit -DCMAKE_CXX_FLAGS='-DPROTOBUF_USE_DLLS'

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 a pull request may close this issue.

2 participants