Issues with unresolved externals from TensorFlow 2.4 C++ on Windows

  c++, tensorflow, windows

I built the TensorFlow v2.4 C++ API on Windows and now I am trying to run my application, however the linker complains for unresolved externals.
I am trying to build a library with some custom OPs which I was successfully able to compile under Linux, but on Windows I get this:

Error   LNK2019 unresolved external symbol "public: __cdecl tensorflow::Status::Status(enum tensorflow::error::Code,class std::basic_string_view<char,struct std::char_traits<char> >,class std::vector<struct tensorflow::StackFrame,class std::allocator<struct tensorflow::StackFrame> > &&)" ([email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@[email protected]@Z) referenced in function "public: __cdecl tensorflow::Status::Status(enum tensorflow::error::Code,class std::basic_string_view<char,struct std::char_traits<char> >)" ([email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@@Z) TF_Project  main_cc.obj 1   
Error   LNK2019 unresolved external symbol "class tensorflow::Status __cdecl tensorflow::GetNodeAttr(class tensorflow::AttrSlice const &,class std::basic_string_view<char,struct std::char_traits<char> >,int *)" ([email protected]@@[email protected]@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@[email protected]) referenced in function "public: class tensorflow::Status __cdecl tensorflow::shape_inference::InferenceContext::GetAttr<int>(class std::basic_string_view<char,struct std::char_traits<char> >,int *)const " ([email protected]@[email protected][email protected]@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@[email protected])  TF_Project  main_cc.obj 1
Error   LNK2019 unresolved external symbol "private: void __cdecl tensorflow::kernel_factory::OpKernelRegistrar::InitInternal(class tensorflow::KernelDef const *,class std::basic_string_view<char,struct std::char_traits<char> >,class std::unique_ptr<class tensorflow::kernel_factory::OpKernelFactory,struct std::default_delete<class tensorflow::kernel_factory::OpKernelFactory> >)" ([email protected]@[email protected]@@[email protected]@[email protected][email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@@[email protected]@[email protected]@@@[email protected]@@[email protected]@Z) referenced in function "void __cdecl `dynamic initializer for 'register_kernel_4''(void)" ([email protected]@YAXXZ) TF_Project  main_cc.obj 1   

I tried all sorts of things, I compiled tensorflow.dll, tensorflow_cc.dll and tensorflow_framework.dll
I tried to link against all 3 in all sorts of combinations, but the missing symbols are not found.
Am I missing some library that I should link against?

I did a simple test to verify that the libraries I built are valid and they seem so.

Calling tf_monolithic_build(); and tf_compiler_version();
does not produce unresolved externals and returns expected results.

Any help would be greatly appreciated!

Source: Windows Questions

LEAVE A COMMENT