-
Notifications
You must be signed in to change notification settings - Fork 183
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
Duplicate #136 code and meet make errors #293
Comments
Can you try to link Protobuf to your program? |
Thanks for the reply. Sorry that I don't know exactly how to link Protobuf. I installed Protobuf from source and the folder is at ~/protobuf.3.9.0 The project CMakeLists.txt file is as below: CMakeLists.txtcmake_minimum_required(VERSION 3.16) |
See e.g., https://cmake.org/cmake/help/latest/module/FindProtobuf.html find_package(Protobuf REQUIRED)
target_link_libraries(foo ${Protobuf_LIBRARIES})
target_include_directories(foo ${Protobuf_INCLUDE_DIRS}) |
Thanks. I tried include these 3 lines. And I get the following error: $ cmake .. And line 20 is : I am not sure what is wrong. |
Please print the |
Thanks. I do see something weird. cmake .. -- Configuring incomplete, errors occurred! I recently installed Anaconda and I am wondering if that changed the path. Shall I just uninstall Anaconda and try? |
You can try or you can try to change the PATH, but protobuf from anaconda is probably not the one you want. Anyway, the error you are seeing is most likely caused by something else, just add |
Thanks. Could I verify that I should install protobuf by myself(hopefully 3.9.0), and compile tensorflow_cc with option(INSTALL_PROTOBUF "Install protobuf compatible with tensorflow version." OFF) I am not sure if it is correct. |
No, you don't need to install protobuf yourself, the INSTALL_PROTOBUF will
do that for you, but you still have to link your executable to the Protobuf
in CMake as discussed earlier. Also, you can try our Docker images where
everything is already installed.
…On Sat, Jun 4, 2022, 18:00 lancelot-ch ***@***.***> wrote:
Thanks. Could I verify that I should install protobuf by myself(hopefully
3.9.0), and compile tensorflow_cc with
option(INSTALL_PROTOBUF "Install protobuf compatible with tensorflow
version." OFF)
I am not sure if it is correct.
—
Reply to this email directly, view it on GitHub
<#293 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABN5KH5XBS2TYSAXZU7Y4KLVNN4QLANCNFSM5XJUNOMA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I tried but I failed. I do with this way: I revise tensorflow_cc/tensorflow_cc/CMakeLists.txt option(INSTALL_PROTOBUF "Install protobuf compatible with tensorflow version." ON) #previously it is OFF I run cmake: ~/tensorflow_cc/tensorflow_cc/build$ cmake -DLOCAL_RAM_RESOURCES=2048 -DLOCAL_CPU_RESOURCES=4 .. I see below error messages: -- The C compiler identification is GNU 9.4.0 /home/user/tensorflow_cc/tensorflow_cc/build/protobuf/src/protobuf-external is not an existing non-empty directory. Please specify one of:
Seems that it suggests that I get an external Protobuf? Many thanks. |
The build folder seems to be damaged, please try to remove the whole build
folder first.
…On Wed, Jun 8, 2022, 00:39 lancelot-ch ***@***.***> wrote:
I tried but I failed.
I do with this way:
I revise tensorflow_cc/tensorflow_cc/CMakeLists.txt
option(INSTALL_PROTOBUF "Install protobuf compatible with tensorflow
version." ON) #previously it is OFF
I run cmake:
~/tensorflow_cc/tensorflow_cc/build$ cmake -DLOCAL_RAM_RESOURCES=2048
-DLOCAL_CPU_RESOURCES=4 ..
I see below error messages:
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Will build Protobuf from ''.
CMake Error at /usr/share/cmake-3.16/Modules/ExternalProject.cmake:2630
(message):
No download info given for 'protobuf-external' and its source directory:
/home/user/tensorflow_cc/tensorflow_cc/build/protobuf/src/protobuf-external
is not an existing non-empty directory. Please specify one of:
- SOURCE_DIR with an existing non-empty directory
- DOWNLOAD_COMMAND
- URL
- GIT_REPOSITORY
- SVN_REPOSITORY
- HG_REPOSITORY
- CVS_REPOSITORY and CVS_MODULE
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/ExternalProject.cmake:3236
(_ep_add_download_command)
cmake/ProtobufExternal.cmake:17 (ExternalProject_Add)
CMakeLists.txt:36 (include)
Seems that it suggests that I get an external Protobuf?
Many thanks.
—
Reply to this email directly, view it on GitHub
<#293 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABN5KH6X2RJGZLVGXUGRTA3VN7FRLANCNFSM5XJUNOMA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I removed build folder and tried again. I got the same error. Will build Protobuf from ''. /home/user/tensorflow_cc/tensorflow_cc/build/protobuf/src/protobuf-external is not an existing non-empty directory. Please specify one of:
-- Configuring incomplete, errors occurred! |
Many thanks to FloopCZ that with Docker I can make the program. The results is as following: root@9c79a0ff0c79:/home/test/build# ./test
|
Hi, try to run
before running your program to disable the GPU |
Actually I am meant to use GPU to accelerate program running by using GPU. I have been successful to run program using tensorflow_cc on CPU. Anyway, I will keep trying. |
ok, I think I misunderstood your previous message:
Is there anything else I can help with or should we close the issue? |
I copied #136 codes and revised as Floop suggested that put 3 lines right below
Scope root = Scope::NewRootScope();
And I have many make errors.
If anyone could help I will be much appreciated.
I am running on the following conditions:
Freshly built Ubuntu 20.04LTS
CUDA 10.7
CuDnn 8.4.0
Bazel 5.1.1
GCC 9.4.0
make 4.2.1
tensoflow_cc build on 20-05-27, using tensorflow 2.9.0
I am using a PC with an Intel CPU, an Intel GPU and an NVidia T600.
I compiled tensorflow_cc with default CMakeLists file except for putting REQUIRE_CUDA ON, and make is successful.
Then I copied 136 codes:
#include "tensorflow/cc/client/client_session.h"
#include "tensorflow/cc/ops/standard_ops.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/graph/default_device.h"
int main() {
using namespace tensorflow;
using namespace tensorflow::ops;
Scope root = Scope::NewRootScope();
GraphDef def;
TF_CHECK_OK(root.ToGraphDef(&def));
graph::SetDefaultDevice(false ? "/device:GPU:0" : "/cpu:0", &def);
// Matrix A = [3 2; -1 0]
auto A = Const(root, { {3.f, 2.f}, {-1.f, 0.f} });
// Vector b = [3 5]
auto b = Const(root, { {3.f, 5.f} });
// v = Ab^T
auto v = MatMul(root.WithOpName("v"), A, b, MatMul::TransposeB(true));
for (auto &node: *def.mutable_node()) {
node.set_device("/cpu:0");
std::cout << node.name() << " = '" << node.device() <<"'"<< std::endl;
}
std::cout << "=======================\n";
std::vector outputs;
ClientSession session(root);
// Run and fetch v
TF_CHECK_OK(session.Run({v}, &outputs));
// Expect outputs[0] == [19; -3]
LOG(INFO) << outputs[0].matrix();
return 0;
}
I have following make errors:
[ 50%] Building CXX object CMakeFiles/example.dir/example2.cpp.o
[100%] Linking CXX executable example
/usr/bin/ld: CMakeFiles/example.dir/example2.cpp.o: in function
google::protobuf::Arena::AllocHook(std::type_info const*, unsigned long) const': example2.cpp:(.text._ZNK6google8protobuf5Arena9AllocHookEPKSt9type_infom[_ZNK6google8protobuf5Arena9AllocHookEPKSt9type_infom]+0x41): undefined reference to
google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'/usr/bin/ld: CMakeFiles/example.dir/example2.cpp.o: in function
google::protobuf::internal::ArenaStringPtr::CreateInstance(google::protobuf::Arena*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*)': example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x60): undefined reference to
google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x78): undefined reference to
google::protobuf::internal::LogMessage::operator<<(char const*)' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x8d): undefined reference to
google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x9d): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x221): undefined reference to
google::protobuf::internal::ArenaImpl::AllocateAligned(unsigned long)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x240): undefined reference to
google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN6google8protobuf8internal14ArenaStringPtr14CreateInstanceEPNS0_5ArenaEPKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2d4): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()'/usr/bin/ld: CMakeFiles/example.dir/example2.cpp.o: in function
google::protobuf::internal::GetEmptyStringAlreadyInited[abi:cxx11]()': example2.cpp:(.text._ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev[_ZN6google8protobuf8internal27GetEmptyStringAlreadyInitedB5cxx11Ev]+0xb): undefined reference to
google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'/usr/bin/ld: CMakeFiles/example.dir/example2.cpp.o: in function
tensorflow::NodeDef::set_device(char const*)': example2.cpp:(.text._ZN10tensorflow7NodeDef10set_deviceEPKc[_ZN10tensorflow7NodeDef10set_deviceEPKc]+0x4b): undefined reference to
google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'/usr/bin/ld: example2.cpp:(.text._ZN10tensorflow7NodeDef10set_deviceEPKc[_ZN10tensorflow7NodeDef10set_deviceEPKc]+0x63): undefined reference to
google::protobuf::internal::LogMessage::operator<<(char const*)' /usr/bin/ld: example2.cpp:(.text._ZN10tensorflow7NodeDef10set_deviceEPKc[_ZN10tensorflow7NodeDef10set_deviceEPKc]+0x75): undefined reference to
google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'/usr/bin/ld: example2.cpp:(.text._ZN10tensorflow7NodeDef10set_deviceEPKc[_ZN10tensorflow7NodeDef10set_deviceEPKc]+0x85): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()' /usr/bin/ld: example2.cpp:(.text._ZN10tensorflow7NodeDef10set_deviceEPKc[_ZN10tensorflow7NodeDef10set_deviceEPKc]+0x11d): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()'/usr/bin/ld: CMakeFiles/example.dir/example2.cpp.o: in function
google::protobuf::RepeatedPtrField<tensorflow::NodeDef>::TypeHandler::Type* google::protobuf::internal::RepeatedPtrFieldBase::Mutable<google::protobuf::RepeatedPtrField<tensorflow::NodeDef>::TypeHandler>(int)': example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0x49): undefined reference to
google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0x61): undefined reference to
google::protobuf::internal::LogMessage::operator<<(char const*)' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0x73): undefined reference to
google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0x83): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0xb1): undefined reference to
google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0xc9): undefined reference to
google::protobuf::internal::LogMessage::operator<<(char const*)' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0xdb): undefined reference to
google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0xeb): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()' /usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0x12e): undefined reference to
google::protobuf::internal::LogMessage::~LogMessage()'/usr/bin/ld: example2.cpp:(.text._ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi[_ZN6google8protobuf8internal20RepeatedPtrFieldBase7MutableINS0_16RepeatedPtrFieldIN10tensorflow7NodeDefEE11TypeHandlerEEEPNT_4TypeEi]+0x150): undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/example.dir/build.make:87: example] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/example.dir/all] Error 2
The text was updated successfully, but these errors were encountered: