Hi,
I am trying to compile the Native C++ Sample Code in the tutorials to run on my latop (x86_64). Unfortunately I get the following compilation error which I do not get during ndk-build. Any help would be appreciated!
nikhil@Nikhil-Ubuntu:~/snpe-sdk/snpe-1.2.2/examples/NativeCpp/SampleCode$ make -f Makefile.x86_64-linux-clang
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/LoadContainer.cpp -o obj/local/x86_64-linux-clang/LoadContainer.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/ExecuteNetwork.cpp -o obj/local/x86_64-linux-clang/ExecuteNetwork.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/LoadInputTensor.cpp -o obj/local/x86_64-linux-clang/LoadInputTensor.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/NV21Load.cpp -o obj/local/x86_64-linux-clang/NV21Load.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/CheckRuntime.cpp -o obj/local/x86_64-linux-clang/CheckRuntime.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/udlExample.cpp -o obj/local/x86_64-linux-clang/udlExample.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/main.cpp -o obj/local/x86_64-linux-clang/main.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/SetBuilderOptions.cpp -o obj/local/x86_64-linux-clang/SetBuilderOptions.o
g++ -c -std=c++11 -fPIC -march=x86-64 -I /home/nikhil/snpe-sdk/snpe-1.2.2/include/zdl jni/Util.cpp -o obj/local/x86_64-linux-clang/Util.o
g++ -L /home/nikhil/snpe-sdk/snpe-1.2.2/lib/x86_64-linux-clang obj/local/x86_64-linux-clang/LoadContainer.o obj/local/x86_64-linux-clang/ExecuteNetwork.o obj/local/x86_64-linux-clang/LoadInputTensor.o obj/local/x86_64-linux-clang/NV21Load.o obj/local/x86_64-linux-clang/CheckRuntime.o obj/local/x86_64-linux-clang/udlExample.o obj/local/x86_64-linux-clang/main.o obj/local/x86_64-linux-clang/SetBuilderOptions.o obj/local/x86_64-linux-clang/Util.o -lSNPE -o obj/local/x86_64-linux-clang/snpe-sample
obj/local/x86_64-linux-clang/LoadContainer.o: In function `loadContainerFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
LoadContainer.cpp:(.text+0x39): undefined reference to `zdl::DlContainer::IDlContainer::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
obj/local/x86_64-linux-clang/CheckRuntime.o: In function `checkRuntime()':
CheckRuntime.cpp:(.text+0x8a): undefined reference to `zdl::DlSystem::Version_t::toString[abi:cxx11]() const'
collect2: error: ld returned 1 exit status
Makefile.x86_64-linux-clang:38: recipe for target 'obj/local/x86_64-linux-clang/snpe-sample' failed
make: *** [obj/local/x86_64-linux-clang/snpe-sample] Error 1
Hi,
I assume you have followed environment setup instructions and your dev host is Ubuntu 14.04. What is gcc compiler version you are using?Would you be able to share some env vatriables, like $SNPE_ROOT, $PATH, $LD_LIBRARY_PATH, $PYTHONPATH?
Thanks
Hi,
My host is actually Ubuntu 16.10.
Gcc Version: 5.4
PYTHONPATH = /usr/local/:/home/npailoor/caffe2//build/:/home/npailoor/Downloads/snpe-1.2.2/models/alexnet/scripts:/home/npailoor/Downloads/snpe-1.2.2/models/lenet/scripts:/home/npailoor/Downloads/snpe-1.2.2/lib/python:/usr/local::/home/npailoor/caffe2/build:/home/npailoor/AI/caffe2/python/training/
SNPE_ROOT = /home/npailoor/Downloads/snpe-1.2.2
LD_LIBRARY_PATH = /usr/local/lib:/home/npailoor/Downloads/snpe-1.2.2/lib/x86_64-linux-clang:/usr/local/cuda-8.0/lib64
Thanks!
Hello, I recently ran into the same issue when compiling the the Snapdragon NPE NativeCPP example code for my Linux. I have a similar OS, Ubuntu 16.04, with just about the same variable definitions.
I was able to get my example to compile by installing g++ 4.9
then telling the system to use that compiler instead of the g++ 5.4
then in my case there was already a make file for the example so I used that
The error was coming from some issue where the new compilers look at certain things differently than before. So to compile the older things we have to use an older compiler.
I hope this helps!
I was having the same issues.
I am on Ubuntu 18.04 and using an old g++-4.8 instead of the new g++ 7 or 8 fixed it for me.