tensorflow-tutorial icon indicating copy to clipboard operation
tensorflow-tutorial copied to clipboard

make error:

Open xt479910344 opened this issue 7 years ago • 9 comments

g++ -std=c++11 -o ./bin/tfcpp_demo -I/usr/local/include/tf -I/usr/local/include/eigen3 -g -Wall -D_DEBUG -Wshadow -Wno-sign-compare -w -L/usr/local/lib pkg-config --cflags --libs protobuf -ltensorflow_cc ./src/main.cpp ./src/ann_model_loader.cpp In file included from ./src/main.cpp:9:0: /usr/local/include/tf/tensorflow/core/public/session.h:22:60: 致命错误:tensorflow/core/framework/device_attributes.pb.h:没有那个文件或目录 #include "tensorflow/core/framework/device_attributes.pb.h" ^ 编译中断。 In file included from ./src/model_loader_base.h:13:0, from ./src/ann_model_loader.h:11, from ./src/ann_model_loader.cpp:11: /usr/local/include/tf/tensorflow/core/public/session.h:22:60: 致命错误:tensorflow/core/framework/device_attributes.pb.h:没有那个文件或目录 #include "tensorflow/core/framework/device_attributes.pb.h" ^ 编译中断。 make: *** [tfcpp_demo] 错误 1

xt479910344 avatar Sep 29 '17 03:09 xt479910344

In usr/local/include/tf, you have missed something. You need to use bazel to compile your tensorflow to get bazel-genfiles/. All you need are in this folder.

nidetaoge avatar Oct 11 '17 02:10 nidetaoge

Apple LLVM version 9.0.0 (clang-900.0.38) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 302.3 -v -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0 -I /usr/local/include/tf -I /usr/local/include/eigen3 -D _DEBUG -D _THREAD_SAFE -I /usr/local/include -D _THREAD_SAFE -stdlib=libc++ -Wall -Wshadow -Wno-sign-compare -Wno-invalid-partial-specialization -w -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/baidu/Documents/sequence_labelling_code/TensorFlow_10_22/tensorflow-tutorial/cpp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o /Users/baidu/temp/main-b8b785.o -x c++ ./src/main.cpp clang -cc1 version 9.0.0 (clang-900.0.38) default target x86_64-apple-darwin16.7.0 ignoring nonexistent directory "/usr/include/c++/v1" ignoring duplicate directory "/usr/local/include" as it is a non-system directory that duplicates a system directory #include "..." search starts here: #include <...> search starts here: /usr/local/include/tf /usr/local/include/eigen3 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name ann_model_loader.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 302.3 -v -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0 -I /usr/local/include/tf -I /usr/local/include/eigen3 -D _DEBUG -D _THREAD_SAFE -I /usr/local/include -D _THREAD_SAFE -stdlib=libc++ -Wall -Wshadow -Wno-sign-compare -Wno-invalid-partial-specialization -w -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/baidu/Documents/sequence_labelling_code/TensorFlow_10_22/tensorflow-tutorial/cpp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o /Users/baidu/temp/ann_model_loader-778b49.o -x c++ ./src/ann_model_loader.cpp clang -cc1 version 9.0.0 (clang-900.0.38) default target x86_64-apple-darwin16.7.0 ignoring nonexistent directory "/usr/include/c++/v1" ignoring duplicate directory "/usr/local/include" as it is a non-system directory that duplicates a system directory #include "..." search starts here: #include <...> search starts here: /usr/local/include/tf /usr/local/include/eigen3 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 /usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -w -o ./bin/tfcpp_demo -L/usr/local/lib -L/usr/local/lib -lprotobuf -ltensorflow_cc /Users/baidu/temp/main-b8b785.o /Users/baidu/temp/ann_model_loader-778b49.o -L. -L/Users/baidu/tools/protobuf/lib -L. -L/Users/baidu/tools/mpich/lib -L/Users/baidu/tools/glog/lib -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.osx.a Undefined symbols for architecture x86_64: "tensorflow::TensorShapeBasetensorflow::TensorShape::TensorShapeBase(std::initializer_list)", referenced from: __ZN10tensorflow11TensorShapeCI2NS_15TensorShapeBaseIS0_EEESt16initializer_listIxE in ann_model_loader-778b49.o "tensorflow::TensorShapeBasetensorflow::TensorShape::dims() const", referenced from: tf_model::ANNModelLoader::predict(tensorflow::Session*, tf_model::FeatureAdapterBase const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, double*) in ann_model_loader-778b49.o Eigen::DSizes<long, 2> tensorflow::TensorShape::AsEigenDSizesWithPadding<2>() const in ann_model_loader-778b49.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

macos error

qichaotang avatar Oct 22 '17 16:10 qichaotang

I have finished compiling the tensorflow C++ source code ,using bazel . But when I try to build the project , the following errors are given: 1)error: #error incompatible with your Protocol Buffer headers 2) error: #error regenerate this file with a newer version of protoc 3)error: #error regenerate this file with a newer version of protoc. 4)tensorflow/core/framework/numeric_types.h:60:34: error: ‘log’/'exp'/'abs' is not a template function

mortalsoulzy avatar Jan 25 '18 10:01 mortalsoulzy

The error occurs when I try to build the project: /usr/local/include/tf/tensorflow/core/framework/resource_handle.pb.h:19:2: error: regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc. @Zy27 have you resolved this error?

shinesun130 avatar Feb 05 '18 03:02 shinesun130

Build successfully at last. Uninstall protobuf and reinstall protobuf can resolve the problem mentioned above.

shinesun130 avatar Feb 09 '18 11:02 shinesun130

@Zy27 I met the same error tensorflow/core/framework/numeric_types.h:60:34: error: ‘log’/'exp'/'abs' is not a template function

Have you solved this problem?

mathTaoTao avatar Mar 26 '18 07:03 mathTaoTao

I get the error too, do you solve it ? @xiupingmath

hengshan123 avatar Apr 15 '18 15:04 hengshan123

@hengshanji @Zy27 @xiupingmath I found the solution to the problem. My system was using Eigen 3.3.0, which was the exact cause to the problem.

tensorflow/core/framework/numeric_types.h:60:34: error: ‘log’/'exp'/'abs' is not a template function

What I did was to make install another local copy of Eigen 3.3.4, and included the following lines in the CMakeLists.txt file

set(EIGEN334_INCLUDE_DIRS $ENV{HOME}/Eigen-3.3.4/local/include/eigen3)

INCLUDE_DIRECTORIES(
  include
  ${EIGEN334_INCLUDE_DIRS}
  ...
)

Because I need both Eigen 3.3.0 and 3.3.4 versions in my source code, this is the only solution.

yan99033 avatar Apr 19 '18 07:04 yan99033

@xt479910344 Have you solved this problem?I met this problem too.I will be very grateful if you could tell me how to solve the problem.

WanQianSucceed avatar Oct 19 '18 02:10 WanQianSucceed