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

make error: #1

Open
xt479910344 opened this issue Sep 29, 2017 · 9 comments
Open

make error: #1

xt479910344 opened this issue Sep 29, 2017 · 9 comments

Comments

@xt479910344
Copy link

xt479910344 commented Sep 29, 2017

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

@nidetaoge
Copy link

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.

@qichaotang
Copy link

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

@mortalsoulzy
Copy link

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

@shinesun130
Copy link

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
Copy link

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

@mathTaoTao
Copy link

@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?

@hengshan123
Copy link

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

@yan99033
Copy link

yan99033 commented Apr 19, 2018

@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.

@WanQianSucceed
Copy link

@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.

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

No branches or pull requests

9 participants