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

Raspberry Pi Makefile issues with proto_text #13176

Closed
ZairMahmood opened this issue Sep 20, 2017 · 16 comments
Closed

Raspberry Pi Makefile issues with proto_text #13176

ZairMahmood opened this issue Sep 20, 2017 · 16 comments
Labels
stat:contribution welcome Status - Contributions welcome type:build/install Build and install issues

Comments

@ZairMahmood
Copy link

ZairMahmood commented Sep 20, 2017

System information

  • Raspberry Pi on Ubuntu Mate 16.04 (Also tried Raspbian Stretch but GUI would freeze a lot and still gave similar errors):

Describe the problem

Building tensorflow from source using makefile using the code provided at: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile. I've included two log files in which i ran the initial setup and ran into a zlib.h error which i resolved by running 'sudo apt-get install libz-dev' but then re-run the last make-f line which gave me another error.

Error:

/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/platform/env.o: In function `tensorflow::mutex::mutex()':
env.cc:(.text._ZN10tensorflow5mutexC2Ev[_ZN10tensorflow5mutexC5Ev]+0xc): undefined reference to `nsync::nsync_mu_init(nsync::nsync_mu_s_*)'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/platform/env.o: In function `tensorflow::mutex::lock()':
env.cc:(.text._ZN10tensorflow5mutex4lockEv[_ZN10tensorflow5mutex4lockEv]+0xc): undefined reference to `nsync::nsync_mu_lock(nsync::nsync_mu_s_*)'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/platform/env.o: In function `tensorflow::mutex::unlock()':
env.cc:(.text._ZN10tensorflow5mutex6unlockEv[_ZN10tensorflow5mutex6unlockEv]+0xc): undefined reference to `nsync::nsync_mu_unlock(nsync::nsync_mu_s_*)'
collect2: error: ld returned 1 exit status
tensorflow/contrib/makefile/Makefile:632: recipe for target '/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_bin/proto_text' failed
make: *** [/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_bin/proto_text] Error 1

Logs

Output file 1 (initial run, stopped at zlib error): https://pastebin.com/dmqWYAs6
Output file 2 (current error after fixing zlib error): https://pastebin.com/aE51br80

What I've tried

Looked at similar issues but they were related to iOS and didn't make sense to me.

@ZairMahmood
Copy link
Author

ZairMahmood commented Sep 21, 2017

#12810 followed what mjmanning mentioned and it's not giving errors now but does freeze up everything (CPU and MEMORY hit 100%) when it gets to compiling training_ops

Edit: Attempting to use a swap drive and see how much further I can get

@aselle
Copy link
Contributor

aselle commented Sep 21, 2017

Consider using a cross compiler on a bigger host to produce the raspberry pi binary. I don't know how to do this most easily, but probably others have done this.

@aselle aselle added stat:awaiting response Status - Awaiting response from author type:build/install Build and install issues labels Sep 21, 2017
@ZairMahmood
Copy link
Author

ZairMahmood commented Sep 23, 2017

Currently sitting on this error:

(.text._ZN10tensorflow12RemoteCallOp12ComputeAsyncEPNS_15OpKernelContextESt8functionIFvvEE[_ZN10tensorflow12RemoteCallOp12ComputeAsyncEPNS_15OpKernelContextESt8functionIFvvEE]+0x300): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a(remote_fused_graph_execute_op.o): In function `tensorflow::RemoteFusedGraphExecuteOp::RemoteFusedGraphExecuteOp(tensorflow::OpKernelConstruction*)':
remote_fused_graph_execute_op.cc:(.text._ZN10tensorflow25RemoteFusedGraphExecuteOpC2EPNS_20OpKernelConstructionE[_ZN10tensorflow25RemoteFusedGraphExecuteOpC5EPNS_20OpKernelConstructionE]+0xf2): undefined reference to `google::protobuf::MessageLite::ParseFromString(std::string const&)'
remote_fused_graph_execute_op.cc:(.text._ZN10tensorflow25RemoteFusedGraphExecuteOpC2EPNS_20OpKernelConstructionE[_ZN10tensorflow25RemoteFusedGraphExecuteOpC5EPNS_20OpKernelConstructionE]+0x1e4): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a(saved_tensor_slice.pb_text.o): In function `tensorflow::internal::ProtoParseFromScanner(tensorflow::strings::Scanner*, bool, bool, tensorflow::SavedSlice*)':
saved_tensor_slice.pb_text.cc:(.text+0x630): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a(saved_tensor_slice.pb_text.o): In function `tensorflow::internal::ProtoParseFromScanner(tensorflow::strings::Scanner*, bool, bool, tensorflow::SavedSliceMeta*)':
saved_tensor_slice.pb_text.cc:(.text+0x146c): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a(memmapped_file_system.pb_text.o): In function `tensorflow::internal::ProtoParseFromScanner(tensorflow::strings::Scanner*, bool, bool, tensorflow::MemmappedFileSystemDirectoryElement*)':
memmapped_file_system.pb_text.cc:(.text+0x354): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a(saver.pb_text.o): In function `tensorflow::internal::ProtoParseFromScanner(tensorflow::strings::Scanner*, bool, bool, tensorflow::SaverDef*)':
saver.pb_text.cc:(.text+0x698): undefined reference to `google::protobuf::internal::fixed_address_empty_string'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a(cluster.pb_text.o):cluster.pb_text.cc:(.text+0x6e4): more undefined references to `google::protobuf::internal::fixed_address_empty_string' follow
collect2: error: ld returned 1 exit status
tensorflow/contrib/makefile/Makefile:566: recipe for target '/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/bin/benchmark' failed
make: *** [/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/bin/benchmark] Error 1

Going to try to 'make CXX=g++-4.8' for building protobuf
If I can't fix this, I'll move onto someone else's compiled library and try to install that.

@aselle aselle removed the stat:awaiting response Status - Awaiting response from author label Sep 23, 2017
@ZairMahmood
Copy link
Author

ZairMahmood commented Sep 24, 2017

Using 'make CXX=g++-4.8' resulted in:

/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/grappler/costs/op_performance_data.pb.o:(.rodata._ZTVN6google8protobuf8internal12MapEntryImplIN10tensorflow6OpInfo16OpInfo_AttrEntryENS0_7MessageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS3_9AttrValueELNS1_14WireFormatLite9FieldTypeE9ELSF_11ELi0EE15MapEntryWrapperE[_ZTVN6google8protobuf8internal12MapEntryImplIN10tensorflow6OpInfo16OpInfo_AttrEntryENS0_7MessageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS3_9AttrValueELNS1_14WireFormatLite9FieldTypeE9ELSF_11ELi0EE15MapEntryWrapperE]+0x2c): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/grappler/costs/op_performance_data.pb.o:(.rodata._ZTVN6google8protobuf8internal8MapEntryIN10tensorflow6OpInfo16OpInfo_AttrEntryENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS3_9AttrValueELNS1_14WireFormatLite9FieldTypeE9ELSE_11ELi0EEE[_ZTVN6google8protobuf8internal8MapEntryIN10tensorflow6OpInfo16OpInfo_AttrEntryENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS3_9AttrValueELNS1_14WireFormatLite9FieldTypeE9ELSE_11ELi0EEE]+0x2c): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/grappler/costs/op_performance_data.pb.o:(.rodata._ZTVN6google8protobuf8internal12MapEntryImplIN10tensorflow6OpInfo16OpInfo_AttrEntryENS0_7MessageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS3_9AttrValueELNS1_14WireFormatLite9FieldTypeE9ELSF_11ELi0EEE[_ZTVN6google8protobuf8internal12MapEntryImplIN10tensorflow6OpInfo16OpInfo_AttrEntryENS0_7MessageENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS3_9AttrValueELNS1_14WireFormatLite9FieldTypeE9ELSF_11ELi0EEE]+0x2c): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
collect2: error: ld returned 1 exit status
tensorflow/contrib/makefile/Makefile:631: recipe for target '/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_bin/proto_text' failed
make: *** [/home/sensor1/tensorflow/tensorflow/contrib/makefile/gen/host_bin/proto_text] Error 1

It would've nice to get the makefiles working but going to move on and try other methods of running tensorflow on Pi3. Might come back to it later on and try the compile_pi_protobuf script.

@evenus
Copy link

evenus commented Sep 27, 2017

@ZairMahmood Have you found any solution to this yet or did you just use someone else's compiled library? Myself am stuck on the same issues, ubuntu 16 Raspberry Pi 3, trying to makefile ends up in the following:

/home/pi/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/platform/env.o: In function `tensorflow::mutex::mutex()':env.cc:.text._ZN10tensorflow5mutexC2Ev[_ZN10tensorflow5mutexC5Ev]+0x18): undefined reference to `nsync::nsync_mu_init(nsync::nsync_mu_s_*)'
/home/pi/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/platform/env.o: In function `tensorflow::mutex::lock()':env.cc:(.text._ZN10tensorflow5mutex4lockEv[_ZN10tensorflow5mutex4lockEv]+0x18): undefined reference to `nsync::nsync_mu_lock(nsync::nsync_mu_s_*)'
/home/pi/tensorflow/tensorflow/contrib/makefile/gen/host_obj/tensorflow/core/platform/env.o: In function `tensorflow::mutex::unlock()':env.cc:(.text._ZN10tensorflow5mutex6unlockEv[_ZN10tensorflow5mutex6unlockEv]+0x18): undefined reference to `nsync::nsync_mu_unlock(nsync::nsync_mu_s_*)'
collect2: error: ld returned 1 exit status
tensorflow/contrib/makefile/Makefile:631: recipe for target '/home/pi/tensorflow/tensorflow/contrib/makefile/gen/host_bin/proto_text' failed
make: *** [/home/pi/tensorflow/tensorflow/contrib/makefile/gen/host_bin/proto_text] Error 1

@ZairMahmood
Copy link
Author

I'm currently using someone else's precompiled library:
http://tuatini.me/building-tensorflow-as-a-standalone-project
I'll revisit compiling it myself way later on.

@nksheridan
Copy link

nksheridan commented Oct 23, 2017

What about reducing the GPU memory allocation like to 16MB? Did you try a USB drive for swap drive? Maybe the screen blanking should be disabled too on Pi? And I was thinking to disable GUI, then go ahead and do it via SSH too. So the the CPU hasn't much to do besides this build..

Edit: sorry I didn't notice you are using Ubuntu Mate 16.04

Edit: I just tried this today, I used the GUI, but reduced GPU right down to 16MB. I got way past compiling training_ops, but then I left the Pi and the screen blanking kicked in, when I came back it had crashed! It's suspicious it would crash at that very time (a 15 min period) after it had been doing fine for several hrs! During that period, I'd been making sure screen blanking didn't kick in. So maybe screen blanking is a problem. Anyway, I will disable that and try again tmrw!

@nksheridan
Copy link

@forskamse
Copy link

forskamse commented Nov 28, 2017

I have solved this problem with the help of bro @umang6891 at #12482.
Follow these steps:
First, run ‘export -p’ to confirm the variable HOST_NSYNC_LIB and TARGET_NSYNC are right there.
If not, run:
export HOST_NSYNC_LIB=tensorflow/contrib/makefile/compile_nsync.sh
export TARGET_NSYNC_LIB="$HOST_NSYNC_LIB"
then add it in the file mutex.h(/tensorflow/tensorflow/core/platform/default/mutex.h)
#include "tensorflow/contrib/makefile/downloads/nsync/public/nsync_cv.h"
#include "tensorflow/contrib/makefile/downloads/nsync/public/nsync_mu.h"
Hope that it can work on you Rpi.

@nksheridan
Copy link

Thanks! I will try it out!

@ZairMahmood
Copy link
Author

@Kyle-Kuzma I definitely tried that when I was having this issue and still didn't work. Possibly fixed in 1.4? Haven't tried yet since I'm pretty satisfied with Tuatini's solution.

@aselle aselle added stat:awaiting tensorflower Status - Awaiting response from tensorflower stat:contribution welcome Status - Contributions welcome and removed stat:awaiting tensorflower Status - Awaiting response from tensorflower labels Nov 30, 2017
@qyhsxdx
Copy link

qyhsxdx commented Apr 15, 2018

How do you solve this problem, please?,I tried so many ways that I didn't use it.thanks

@forskamse
Copy link

@qyhsxdx Hi! It has been such a long time since I last compiled tensorflow on my own pi3. I suggested that you turn to the compiled versions, see tensorflow on arm. But first ,run
strings /lib/arm-linux-gnueabihf/libm.so.6|grep GLIBC
to check whether your device are supported by GLIBC 2.23.

@qyhsxdx
Copy link

qyhsxdx commented Apr 15, 2018

@forskamse ok,thank you !

@mirkobrankovic
Copy link

@forskamse thx this hellped me pass the optimiser compilation error

@umang6891
Copy link

I have solved this problem with the help of bro @umang6891 at #12482.
Follow these steps:
First, run ‘export -p’ to confirm the variable HOST_NSYNC_LIB and TARGET_NSYNC are right there.
If not, run:
export HOST_NSYNC_LIB=tensorflow/contrib/makefile/compile_nsync.sh
export TARGET_NSYNC_LIB="$HOST_NSYNC_LIB"
then add it in the file mutex.h(/tensorflow/tensorflow/core/platform/default/mutex.h)
#include "tensorflow/contrib/makefile/downloads/nsync/public/nsync_cv.h"
#include "tensorflow/contrib/makefile/downloads/nsync/public/nsync_mu.h"
Hope that it can work on you Rpi.

Glad I could help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:contribution welcome Status - Contributions welcome type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

8 participants