Skip to content

Windows import library is missing sufficient symbols to use C++ API #41904

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

Closed
planetmarshall opened this issue Jul 30, 2020 · 25 comments
Closed
Assignees
Labels
stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype:windows Windows Build/Installation Issues TF 2.3 Issues related to TF 2.3 type:build/install Build and install issues

Comments

@planetmarshall
Copy link

System information

  • OS Platform and Distribution Windows 10
  • TensorFlow installed from (source or binary): Source
  • TensorFlow version: 2.3.0
  • Python version: 3.8.5
  • Bazel version (if compiling from source): 3.3.1
  • GCC/Compiler version (if compiling from source): Visual Studio 2019

Expected Result

The generated Windows Binaries should export sufficient symbols to compile and link a basic program using the C++ API

Actual Result

Compiling and linking a basic Tensorflow C++ program with the Windows Binaries results in undefined symbols.

Provide the exact sequence of commands / steps that you executed before running into the problem

Example from Tensorflow 2.3.0 API Reference

main.cpp

#include <tensorflow/cc/framework/scope.h>
#include <tensorflow/cc/client/client_session.h>
#include <tensorflow/cc/ops/array_ops.h>
#include <tensorflow/cc/ops/math_ops.h>

#include <vector>

namespace tf = tensorflow;
using namespace tf::ops;

int main() {
    tf::Scope root = tf::Scope::NewRootScope();
    auto a = Placeholder(root, tf::DT_INT32);
    auto c = Add(root, a, {41});

    tf::ClientSession session(root);
    std::vector<tf::Tensor> outputs;

    auto status = session.Run({{a, {1}}}, {c}, &outputs);

    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project(tensorflow_example)

set(CMAKE_VERBOSE_MAKEFILE TRUE)
add_executable(example main.cpp)

target_link_libraries(example PRIVATE "${TENSORFLOW_ROOT}/tensorflow_cc.lib")
target_compile_definitions(example PRIVATE NOMINMAX)
target_include_directories(example PRIVATE
    "${TENSORFLOW_ROOT}/include"
    "${TENSORFLOW_ROOT}/include/src"
)
python configure.py
<Accept defaults>
bazel build --config=opt //tensorflow:tensorflow_cc
bazel build --config=opt //tensorflow:tensorflow_cc_dll_import_lib
bazel build --config=opt //tensorflow:install_headers
mkdir build
cd build
cmake .. -DTENSORFLOW_ROOT=<path to bazel-bin/tensorflow>
cmake --build .

The compilation succeeds but linking fails with the following missing externals:

Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::Operation::Operation(class tensorflow::Node *)" (??0Operation@tensorflow@@QEAA@PEAVNode@1@@Z) referenced in function "public: __cdecl tensorflow::Input::Input(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z) [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::Input::Initializer::Initializer(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Initializer@Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z) referenced in function "public: __cdecl tensorflow::Input::Input(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z) [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::Scope::~Scope(void)" (??1Scope@tensorflow@@QEAA@XZ) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: static class tensorflow::Scope __cdecl tensorflow::Scope::NewRootScope(void)" (?NewRootScope@Scope@tensorflow@@SA?AV12@XZ) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::ClientSession::ClientSession(class tensorflow::Scope const &)" (??0ClientSession@tensorflow@@QEAA@AEBVScope@1@@Z) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::ClientSession::~ClientSession(void)" (??1ClientSession@tensorflow@@QEAA@XZ) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: class tensorflow::Status __cdecl tensorflow::ClientSession::Run(class std::unordered_map<class tensorflow::Output,struct tensorflow::Input::Initializer,struct tensorflow::OutputHash,struct std::equal_to<class tensorflow::Output>,class std::allocator<struct std::pair<class tensorflow::Output const ,struct tensorflow::Input::Initializer> > > const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > const &,class std::vector<class tensorflow::Tensor,class std::allocator<class tensorflow::Tensor> > *)const " (?Run@ClientSession@tensorflow@@QEBA?AVStatus@2@AEBV?$unordered_map@VOutput@tensorflow@@UInitializer@Input@2@UOutputHash@2@U?$equal_to@VOutput@tensorflow@@@std@@V?$allocator@U?$pair@$$CBVOutput@tensorflow@@UInitializer@Input@2@@std@@@7@@std@@AEBV?$vector@VOutput@tensorflow@@V?$allocator@VOutput@tensorflow@@@std@@@5@PEAV?$vector@VTensor@tensorflow@@V?$allocator@VTensor@tensorflow@@@std@@@5@@Z) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::ops::Placeholder::Placeholder(class tensorflow::Scope const &,enum tensorflow::DataType)" (??0Placeholder@ops@tensorflow@@QEAA@AEBVScope@2@W4DataType@2@@Z) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
main.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::ops::Add::Add(class tensorflow::Scope const &,class tensorflow::Input,class tensorflow::Input)" (??0Add@ops@tensorflow@@QEAA@AEBVScope@2@VInput@2@1@Z) referenced in function main [C:\Users\plane\projects\tf_test\build\example.vcxproj]
C:\Users\plane\projects\tf_test\build\Debug\example.exe : fatal error LNK1120: 9 unresolved externals [C:\Users\plane\projects\tf_test\build\example.vcxproj]
@planetmarshall planetmarshall added the type:build/install Build and install issues label Jul 30, 2020
@amahendrakar amahendrakar added subtype:windows Windows Build/Installation Issues TF 2.3 Issues related to TF 2.3 labels Jul 31, 2020
@gowthamkpr gowthamkpr added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jul 31, 2020
@planetmarshall
Copy link
Author

I'm new to Bazel but from what I can tell, the root cause is that, unfiltered, the Windows dll would contain more than 64K symbols, which is the maximum number of symbols that can be exported by a Windows Dll (because each symbol is indexed by a 16bit integer).

To cirvcumvent this, Bazel builds a 'dummy' dll called tf_custom_op_library_additional_deps.dll in order to generate a .def file containing the symbols to export:

From https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/BUILD :

 # add win_def_file for tensorflow_cc
    win_def_file = select({
        # We need this DEF file to properly export symbols on Windows
        "//tensorflow:windows": ":tensorflow_filtered_def_file",
        "//conditions:default": None,
    }),

However, this filtered def file contains only the symbols required to build custom ops. It does not contain the symbols required to actually use the C++ API as defined in the reference.

From https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/tensorflow.bzl :

# A list of targets that contains the implemenation of
# tf_custom_op_library_additional_deps. It's used to generate a DEF file for
# exporting symbols from _pywrap_tensorflow.dll on Windows.
def tf_custom_op_library_additional_deps_impl():
    return [
        "@com_google_protobuf//:protobuf",
        "@nsync//:nsync_cpp",
        # for //third_party/eigen3
        clean_dep("//third_party/eigen3"),
        # for //tensorflow/core:framework_headers_lib
        clean_dep("//tensorflow/core:framework"),
        clean_dep("//tensorflow/core:reader_base"),
    ]

Note that the //tensorflow/core:ops target is missing here.

@meteorcloudy
Copy link
Member

meteorcloudy commented Aug 6, 2020

A related issue is #30246

I have an attempt to fix here: meteorcloudy@4b8e7be, could you please test if that helps?

@meteorcloudy
Copy link
Member

The basic idea of meteorcloudy/tensorflow@4b8e7be is to let Bazel parse all symbols from object files of a cc_library (unlike cc_binary, it will not include its transitive dependencies) and generate a DEF file that could be filtered (overcome the 64K symbol limit) and used for export symbols in tensorflow.dll.

@tensorflowbutler tensorflowbutler removed the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Aug 8, 2020
@planetmarshall
Copy link
Author

A related issue is #30246

I have an attempt to fix here: meteorcloudy@4b8e7be, could you please test if that helps?

I'm afraid not. It fails with the following unresolved externals:

C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::Operation::Operation(class tensorflow::Node *)" (??0Operation@tensorflow@@QEAA@PEAVNode@1@@Z) referenced in function "public: __cdecl tensorflow::Input::Input(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z)
C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::Input::Initializer::Initializer(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Initializer@Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z) referenced in function "public: __cdecl tensorflow::Input::Input(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z)
C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::Scope::~Scope(void)" (??1Scope@tensorflow@@QEAA@XZ) referenced in function main
C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: static class tensorflow::Scope __cdecl tensorflow::Scope::NewRootScope(void)" (?NewRootScope@Scope@tensorflow@@SA?AV12@XZ) referenced in function main
C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::ClientSession::ClientSession(class tensorflow::Scope const &)" (??0ClientSession@tensorflow@@QEAA@AEBVScope@1@@Z) referenced in function main
C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl tensorflow::ClientSession::~ClientSession(void)" (??1ClientSession@tensorflow@@QEAA@XZ) referenced in function main
C:\Users\plane\projects\tf_test\out\build\x64-Release\main.cpp.obj : error LNK2019: unresolved external symbol "public: class tensorflow::Status __cdecl tensorflow::ClientSession::Run(class std::unordered_map<class tensorflow::Output,struct tensorflow::Input::Initializer,struct tensorflow::OutputHash,struct std::equal_to<class tensorflow::Output>,class std::allocator<struct std::pair<class tensorflow::Output const ,struct tensorflow::Input::Initializer> > > const &,class std::vector<class tensorflow::Output,class std::allocator<class tensorflow::Output> > const &,class std::vector<class tensorflow::Tensor,class std::allocator<class tensorflow::Tensor> > *)const " (?Run@ClientSession@tensorflow@@QEBA?AVStatus@2@AEBV?$unordered_map@VOutput@tensorflow@@UInitializer@Input@2@UOutputHash@2@U?$equal_to@VOutput@tensorflow@@@std@@V?$allocator@U?$pair@$$CBVOutput@tensorflow@@UInitializer@Input@2@@std@@@7@@std@@AEBV?$vector@VOutput@tensorflow@@V?$allocator@VOutput@tensorflow@@@std@@@5@PEAV?$vector@VTensor@tensorflow@@V?$allocator@VTensor@tensorflow@@@std@@@5@@Z) referenced in function main

In addition the SavedModel interfaces as described in the Documentation are not available (ie, attempting to use them results in linking errors). This is resolved in the linked PR.

@meteorcloudy
Copy link
Member

I see, meteorcloudy@4b8e7be basically offers an example to get the DEF file from cc_library instead of cc_binary. The DEF file will not contains symbols from the transitive cc_libraries, so it makes it easier to not exceed the symbol limits (64K). I think if you add the corresponding cc_libraries for the missing symbols in

filegroup(
    name = "cc_ops_def_file",
    srcs = [
        "//tensorflow/cc:cc_ops",
        "//tensorflow/cc:array_ops",
        "//tensorflow/cc:const_op",
        "//tensorflow/cc:math_ops",
    ],
    output_group = "def_file",
)

It will probably work.

@andrea-garritano
Copy link

I had the same problem as @planetmarshall. Applying the patch of meteorcloudy@4b8e7be, i have a linking problem for ClientSession .
After applying meteorcloudy@4b8e7be, I added some lines in "tensorflow/BUILD" so I had this:

filegroup(
    name = "cc_ops_def_file",
    srcs = [
        "//tensorflow/cc:cc_ops",
        "//tensorflow/cc:array_ops",
        "//tensorflow/cc:const_op",
        "//tensorflow/cc:math_ops",
        "//tensorflow/cc:scope",
        "//tensorflow/cc:client_session",
        "//tensorflow/cc/profiler",
        "//tensorflow/core:tensorflow",
    ],
    output_group = "def_file",
)

Then i rebuild the .lib.

Now I have no more linking problems, but the Add operation returns an error during runtime:
Unhandled exception at 0x00007FFCB07BA719 in ConsoleApplication1.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0000005151BEEAF0.

@andrea-garritano
Copy link

Now I have no more linking problems, but the Add operation returns an error during runtime:
Unhandled exception at 0x00007FFCB07BA719 in ConsoleApplication1.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0000005151BEEAF0.

I've just resolved the bad_alloc problem. I switch from Debug to Release in Microsoft Visual Studio.
Now i'm able to execute the example from Tensorflow 2.3.0 API Reference.

Thanks for your help!

@ntdat017
Copy link

ntdat017 commented Nov 1, 2020

I had the same problem as @planetmarshall. Applying the patch of meteorcloudy@4b8e7be, i have a linking problem for ClientSession .
After applying meteorcloudy@4b8e7be, I added some lines in "tensorflow/BUILD" so I had this:

filegroup(
    name = "cc_ops_def_file",
    srcs = [
        "//tensorflow/cc:cc_ops",
        "//tensorflow/cc:array_ops",
        "//tensorflow/cc:const_op",
        "//tensorflow/cc:math_ops",
        "//tensorflow/cc:scope",
        "//tensorflow/cc:client_session",
        "//tensorflow/cc/profiler",
        "//tensorflow/core:tensorflow",
    ],
    output_group = "def_file",
)

Then i rebuild the .lib.

Now I have no more linking problems, but the Add operation returns an error during runtime:
Unhandled exception at 0x00007FFCB07BA719 in ConsoleApplication1.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0000005151BEEAF0.

Hi @andrea-garritano, I have same problem and do like meteorcloudy/tensorflow@4b8e7be, but it's raise some of error:
"""
ERROR: C:/users/me/documents/tensorflow/tensorflow/BUILD:642:11: in cmd attribute of genrule rule //tensorflow:tensorflow_filtered_def_file: label '//tensorflow:cc_ops_def_file' in $(locations) expression expands to no files
ERROR: Analysis of target '//tensorflow:tensorflow_cc.dll' failed; build aborted: Analysis of target '//tensorflow:tensorflow_filtered_def_file' failed; build aborted
INFO: Elapsed time: 0.734s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 2365 targets configured)
"""
Have you meet this error?

@andrea-garritano
Copy link

I had the same problem as @planetmarshall. Applying the patch of meteorcloudy@4b8e7be, i have a linking problem for ClientSession .
After applying meteorcloudy@4b8e7be, I added some lines in "tensorflow/BUILD" so I had this:

filegroup(
    name = "cc_ops_def_file",
    srcs = [
        "//tensorflow/cc:cc_ops",
        "//tensorflow/cc:array_ops",
        "//tensorflow/cc:const_op",
        "//tensorflow/cc:math_ops",
        "//tensorflow/cc:scope",
        "//tensorflow/cc:client_session",
        "//tensorflow/cc/profiler",
        "//tensorflow/core:tensorflow",
    ],
    output_group = "def_file",
)

Then i rebuild the .lib.
Now I have no more linking problems, but the Add operation returns an error during runtime:
Unhandled exception at 0x00007FFCB07BA719 in ConsoleApplication1.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0000005151BEEAF0.

Hi @andrea-garritano, I have same problem and do like meteorcloudy/tensorflow@4b8e7be, but it's raise some of error:
"""
ERROR: C:/users/me/documents/tensorflow/tensorflow/BUILD:642:11: in cmd attribute of genrule rule //tensorflow:tensorflow_filtered_def_file: label '//tensorflow:cc_ops_def_file' in $(locations) expression expands to no files
ERROR: Analysis of target '//tensorflow:tensorflow_cc.dll' failed; build aborted: Analysis of target '//tensorflow:tensorflow_filtered_def_file' failed; build aborted
INFO: Elapsed time: 0.734s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 2365 targets configured)
"""
Have you meet this error?

I'm sorry, but I never met this error.

@Shadowman82
Copy link

I did like @andrea-garritano suggested and tensorflow_cc builds successfully but I had 2 linking errors when I build the test code:

Error	LNK2001	simbolo esterno "public: __cdecl tensorflow::Operation::Operation(class tensorflow::Node *)" (??0Operation@tensorflow@@QEAA@PEAVNode@1@@Z) non risolto	cnn_tf_test	C:\Users\DESKTOP-SERVER2\Desktop\cnn_tf_test\cnn_tf_test\main.obj	1	
Error	LNK2001	simbolo esterno "public: __cdecl tensorflow::Input::Initializer::Initializer(class std::initializer_list<struct tensorflow::Input::Initializer> const &)" (??0Initializer@Input@tensorflow@@QEAA@AEBV?$initializer_list@UInitializer@Input@tensorflow@@@std@@@Z) non risolto	cnn_tf_test	C:\Users\DESKTOP-SERVER2\Desktop\cnn_tf_test\cnn_tf_test\main.obj	1

Any suggestions?
Thank you,
Best regards

@Shadowman82
Copy link

Shadowman82 commented Jan 29, 2021

I solved putting TF_EXPORT macro in ops.h in front of the requested class methods Operation::Operation and Input::Initializer, and adding this include at the beginning of ops.h include section:
#include "tensorflow/core/platform/macros.h"

@Shadowman82
Copy link

Shadowman82 commented Feb 11, 2021

I have now another linking error when I try to include the freeze_saved_model module in the BUILD file as below:

filegroup(
    name = "cc_ops_def_file",
    srcs = [
        "//tensorflow/cc:cc_ops",
        "//tensorflow/cc:array_ops",
        "//tensorflow/cc:const_op",
        "//tensorflow/cc:math_ops",
        "//tensorflow/cc:scope",
        "//tensorflow/cc:client_session",
        "//tensorflow/cc/profiler",
        "//tensorflow/core:tensorflow",
	"//tensorflow/cc/tools:freeze_saved_model",
    ],	
    output_group = "def_file",
)

Adding the last src causes a lot of linker errors when compiling tensorflow_cc, some of them reported below. Does anyone have some suggestions?
Thank you

libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: __cdecl std::pair<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> *,bool>::pair<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> *,bool><struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> * &,bool,0>(struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> * &,bool &&)" (??$?0AEAPEAU?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@_N$0A@@?$pair@PEAU?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@_N@std@@QEAA@AEAPEAU?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@1@$$QEA_N@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: __cdecl std::_List_node_emplace_op2<class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > >::_List_node_emplace_op2<class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > ><struct std::piecewise_construct_t const &,class std::tuple<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &>,class std::tuple<> >(class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > &,struct std::piecewise_construct_t const &,class std::tuple<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &> &&,class std::tuple<> &&)" (??$?0AEBUpiecewise_construct_t@std@@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@V?$tuple@$$V@1@@?$_List_node_emplace_op2@V?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@std@@@std@@QEAA@AEAV?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@1@AEBUpiecewise_construct_t@1@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@$$QEAV?$tuple@$$V@1@@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: __cdecl std::_Compressed_pair<class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> >,class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > >,1>::_Compressed_pair<class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> >,class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > >,1><class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > const &>(struct std::_One_then_variadic_args_t,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > const &)" (??$?0AEBV?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@$$V@?$_Compressed_pair@V?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@std@@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@2@$00@std@@QEAA@U_One_then_variadic_args_t@1@AEBV?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@1@@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: __cdecl std::_Compressed_pair<class std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > >,class std::_Vector_val<struct std::_Simple_types<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > > >,1>::_Compressed_pair<class std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > >,class std::_Vector_val<struct std::_Simple_types<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > > >,1><class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > const &>(struct std::_One_then_variadic_args_t,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > const &)" (??$?0AEBV?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@$$V@?$_Compressed_pair@V?$allocator@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@std@@V?$_Vector_val@U?$_Simple_types@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@std@@@2@$00@std@@QEAA@U_One_then_variadic_args_t@1@AEBV?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@1@@Z) non risolto
...
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: class tensorflow::NodeDef * const & __cdecl std::unordered_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class tensorflow::NodeDef *,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > >::at(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?at@?$unordered_map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@@std@@QEBAAEBQEAVNodeDef@tensorflow@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: unsigned __int64 __cdecl std::_Hash<class std::_Umap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class tensorflow::NodeDef *,class std::_Uhash_compare<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> >,0> >::bucket(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?bucket@?$_Hash@V?$_Umap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@V?$_Uhash_compare@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@$0A@@std@@@std@@QEBA_KAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: unsigned __int64 __cdecl std::_Hash<class std::_Umap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class tensorflow::NodeDef *,class std::_Uhash_compare<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> >,0> >::bucket_count(void)const " (?bucket_count@?$_Hash@V?$_Umap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@V?$_Uhash_compare@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@$0A@@std@@@std@@QEBA_KXZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: void __cdecl std::_Hash<class std::_Umap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class tensorflow::NodeDef *,class std::_Uhash_compare<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> >,0> >::clear(void)" (?clear@?$_Hash@V?$_Umap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@V?$_Uhash_compare@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@$0A@@std@@@std@@QEAAXXZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: void __cdecl std::list<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > >::clear(void)" (?clear@?$list@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@@std@@QEAAXXZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: class google::protobuf::RepeatedPtrField<class tensorflow::TensorInfo> const & __cdecl tensorflow::TensorInfo_CompositeTensor::components(void)const " (?components@TensorInfo_CompositeTensor@tensorflow@@QEBAAEBV?$RepeatedPtrField@VTensorInfo@tensorflow@@@protobuf@google@@XZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: static void __cdecl std::_Default_allocator_traits<class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > >::deallocate(class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > &,struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> * const,unsigned __int64)" (?deallocate@?$_Default_allocator_traits@V?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@std@@@std@@SAXAEAV?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@2@QEAU?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@2@_K@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: void __cdecl std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> >::deallocate(struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> * const,unsigned __int64)" (?deallocate@?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@std@@QEAAXQEAU?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@2@_K@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: void __cdecl std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > >::deallocate(class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > * const,unsigned __int64)" (?deallocate@?$allocator@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@std@@QEAAXQEAV?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@2@_K@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: float __cdecl std::_Hash<class std::_Umap_traits<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class tensorflow::NodeDef *,class std::_Uhash_compare<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> >,0> >::max_load_factor(void)const " (?max_load_factor@?$_Hash@V?$_Umap_traits@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@V?$_Uhash_compare@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@$0A@@std@@@std@@QEBAMXZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: static unsigned __int64 __cdecl std::_Default_allocator_traits<class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > >::max_size(class std::allocator<struct std::_List_node<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,void *> > const &)" (?max_size@?$_Default_allocator_traits@V?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@std@@@std@@SA_KAEBV?$allocator@U?$_List_node@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@PEAX@std@@@2@@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: static unsigned __int64 __cdecl std::_Default_allocator_traits<class std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > > >::max_size(class std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > > const &)" (?max_size@?$_Default_allocator_traits@V?$allocator@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@std@@@std@@SA_KAEBV?$allocator@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@2@@Z) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: unsigned __int64 __cdecl std::_Hash_vec<class std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > > >::max_size(void)const " (?max_size@?$_Hash_vec@V?$allocator@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@std@@@std@@QEBA_KXZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: unsigned __int64 __cdecl std::list<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *>,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > >::max_size(void)const " (?max_size@?$list@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@2@@std@@QEBA_KXZ) non risolto
libtensorflow_cc.dll.exp : error LNK2001: simbolo esterno "public: unsigned __int64 __cdecl std::_Hash_vec<class std::allocator<class std::_List_unchecked_iterator<class std::_List_val<struct std::_List_simple_types<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class tensorflow::NodeDef *> > > > > >::size(void)const " (?size@?$_Hash_vec@V?$allocator@V?$_List_unchecked_iterator@V?$_List_val@U?$_List_simple_types@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEAVNodeDef@tensorflow@@@std@@@std@@@std@@@std@@@std@@@std@@QEBA_KXZ) non risolto

@philipeccles
Copy link

Hi @Shadowman82.

Did you ever get anywhere with this? If I build dll just with the ops

"//tensorflow/cc:cc_ops",
"//tensorflow/cc:array_ops",
"//tensorflow/cc:const_op",
"//tensorflow/cc:math_ops",

it works and I get a dll and lib. When I link with my application, however it complains about ClientSession missing symbols.

I note that the file client_session.cc is NOT even built unless it is added to the list above.

I tried adding some garbage text to the file and the dll still compiled. If I add

"//tensorflow/cc:client_session",

to the list above and build, it tries to build client_session.cc

@philipeccles
Copy link

Continuing from above. If I add all of:

filegroup(
name = "cc_ops_def_file",
srcs = [
"//tensorflow/cc:cc_ops",
"//tensorflow/cc:array_ops",
"//tensorflow/cc:const_op",
"//tensorflow/cc:math_ops",
"//tensorflow/cc:scope",
"//tensorflow/cc:client_session",
"//tensorflow/cc/profiler",
"//tensorflow/core:tensorflow",
],
output_group = "def_file",
)

I can't even build the dll. Loads of missing symbols similar to those reported by @Shadowman82

@jomocl
Copy link

jomocl commented May 26, 2021

@philipeccles try and check this out I ended up getting it to work https://dkjoi.medium.com/tf2-4-dll-with-gpu-support-for-3090-in-windows-305126bc0d17?source=your_stories_page-------------------------------------

I also have one simple with linking it to a standard model and doing inference.

@philipeccles
Copy link

philipeccles commented May 27, 2021

I finally got it to build and link with my application.
CPU for now, doubtless GPU will cause another level of hassle.

One of the problems is I was using tensorflow.dll instead of tensorflow_cc.dll. The latter automatically builds client_session, the former doesn't. The only way I could get client_session to build was adding it in the filegroup in BUILD file as above. But building tensorflow.dll failed. If I build tensorflow_cc.dll I don't have to add client_session to build file and it all works.

I will show my entire patch file at end of this message.

What exactly is the major difference between tensorflow.dll instead of tensorflow_cc.dll? I see no documentation.

Just to make the point. Tensorflow is open source so much gratitude to everyone who has contributed. However building it is on a different level entirely in terms of difficulty, compared to other open source projects I have built. I have spent a week at least getting to this point. Don't assume it's going to be easy!

So here is my patch to tensorflow-2.3.0

@philipeccles
Copy link

build.patch.txt

@philipeccles
Copy link

@Shadowman82 , do you know the difference between tensorflow.dll and tensorflow_cc.dll? In the BUILD file they seem to be built in a very similar way.

@Shadowman82
Copy link

@philipeccles , I managed to solve it in the same way like you. I also had the same issue because I was using tensorflow.dll instead of tensorflow_cc.dll. Looking at the BUILD file the tensorflow_cc.dll I didn't find a reason for that

@amehrish
Copy link

amehrish commented Oct 3, 2021

I recently succeeded in building 2.6 (both tensorflow.dll and tensorflow_cc.dll) with GPU on Windows but linking it is a different challenge altogether to make a simple Matmul operation work and honestly, I am struggling. I arrived at this discussion after searching a lot for answers. Just as @philipeccles has stated above, I would like to express my gratitude to the tf team for making it accessible. However unless the accessibility of C++ API is improved particularly on Windows, it is a huge problem. Mere making something work should not feel like an achievement but currently this is how it feels with tensorflow C++ API. I am requesting all the good people in tf team to make it easy and intuitive to add symbols such as a file that list all the symbols perhaps that could be read by tf executable during compile time to determine what should be included and excluded (60k symbols limit will force us to make that choice). TF_EXPORT is tedious. C++ API is not usable in its current form on Windows for building graps.
Is there a good documentation to build tf C++ API from source for Linux Debia/ Ubuntu 20.04? I'd be very grateful. Thank you!

@mohantym
Copy link
Contributor

mohantym commented Dec 1, 2021

Hi @planetmarshall !
We are checking to see whether you still need help in this issue . Please create a new issue if the issue is replicating in Latest version TF 2.6 . Thanks!

@mohantym mohantym added the stat:awaiting response Status - Awaiting response from author label Dec 1, 2021
@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Dec 8, 2021
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@GosuPaper
Copy link

GosuPaper commented Apr 28, 2022

@Shadowman82 Hi,

Did you manage to use FreezeSavedModel ?I have, like you, the problem with a lot of link error during bazel buidl after adding to the BUILD file of tensorflow through filegroup.
Can you tell me which TF version and bazel you are using to make it work ? And which file you are building.

I use bazel build --config=opt --config=cuda tensorflow:tensorflow_cc.dll then
bazel build --config=opt --config=cuda tensorflow:tensorflow_cc.lib then
bazel build --config=opt --config=cuda tensorflow:install_headers

All of them works nicely and I can use them in my project until i add "//tensorflow/cc/tools:freeze_saved_model" to the filegroup.

Thank you a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype:windows Windows Build/Installation Issues TF 2.3 Issues related to TF 2.3 type:build/install Build and install issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.