tensorflow: r1.12 C++ tutorials_example_trainer failed to build on Windows
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Windows 10 v1803 Pro 64bit English
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:N/A
- TensorFlow installed from (source or binary):source
- TensorFlow version:1.12
- Python version:3.6
- Installed using virtualenv? pip? conda?:pip
- Bazel version (if compiling from source):0.15
- GCC/Compiler version (if compiling from source):MSVC 2015 update 3
- CUDA/cuDNN version:N/A
- GPU model and memory:N/A
Describe the problem
Provide the exact sequence of commands / steps that you executed before running into the problem
Commands
bazel build -c opt --verbose_failures //tensorflow/cc:tutorials_example_trainer
Steps Setup as described in official document
.bazelrc is customized in the following way.
import (YOUR_TENSORFLOW_FOLDER)/tf_configure.bazelrc
.tf_configure.bazelrc is customized in the following way.
build:ignite --define with_ignite_support=true
build:xla --define with_xla_support=false
build --action_env TF_NEED_OPENCL_SYCL="0"
build --action_env TF_NEED_ROCM="0"
build --action_env TF_NEED_CUDA="0"
build --action_env TF_DOWNLOAD_CLANG="0"
build:opt --copt=/arch:AVX2
build:opt --define with_default_optimizations=true
build --copt=-w --host_copt=-w
build --verbose_failures
build --distinct_host_configuration=false
build --experimental_shortened_obj_file_path=true
build --define=no_tensorflow_py_deps=true
build --define=override_eigen_strong_inline=true
build:v2 --define=tf_api_version=2
Any other info / logs
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl icu_62::ErrorCode::~ErrorCode(void)" (__imp_??1ErrorCode@icu_62@@UEAA@XZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: signed char __cdecl icu_62::ErrorCode::isSuccess(void)const " (__imp_?isSuccess@ErrorCode@icu_62@@QEBACXZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: enum UErrorCode __cdecl icu_62::ErrorCode::reset(void)" (__imp_?reset@ErrorCode@icu_62@@QEAA?AW4UErrorCode@@XZ) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
unicode_script_op.lo.lib(unicode_script_op.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) const icu_62::ErrorCode::`vftable'" (__imp_??_7ErrorCode@icu_62@@6B@) referenced in function "public: virtual void __cdecl tensorflow::UnicodeScriptOp::Compute(class tensorflow::OpKernelContext *)" (?Compute@UnicodeScriptOp@tensorflow@@UEAAXPEAVOpKernelContext@2@@Z)
Similar to tutorials_example_trainer, build //tensorflow/examples/label_image:label_image also failed.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17
Commits related to this issue
- Force ICU to look for its data statically. This is required for Windows 10 builds. Patch suggested by github.com/cielavenir. Fixes #23655 PiperOrigin-RevId: 229464102 — committed to lissyx/tensorflow by hamatake 5 years ago
- Patch ICU to always look for its data statically. Fixes #23655 PiperOrigin-RevId: 238134165 — committed to tensorflow/tensorflow by hamatake 5 years ago
- Force ICU to look for its data statically. This is required for Windows 10 builds. Patch suggested by github.com/cielavenir. Fixes #23655 PiperOrigin-RevId: 229464102 — committed to lissyx/tensorflow by hamatake 5 years ago
Hi
I’ve just reproduced @cielavenir solution. In my case, I only had to use the ICU flags:
#define U_STATIC_IMPLEMENTATIONand"-DU_STATIC_IMPLEMENTATION"to get it working. No further changes were needed!Thanks for sharing your patch!
My setup: Tensorflow r1.12 Visual Studio 2015 Bazel 0.18.1
I found that the following option in .tf_configure.bazelrc raises the above LNK1181 error. This option is automatically added by configure.py. So we should manually remove this option before build.