Forums - Compilation Error Sample Code x86_64

5 posts / 0 new
Last post
Compilation Error Sample Code x86_64
npailoor3
Join Date: 28 Jul 17
Posts: 13
Posted: Tue, 2017-08-01 15:05

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

  • Up0
  • Down0
moljaca moderator
Join Date: 25 Jul 17
Location: San Diego
Posts: 40
Posted: Fri, 2017-08-04 18:19

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

  • Up0
  • Down0
npailoor3
Join Date: 28 Jul 17
Posts: 13
Posted: Mon, 2017-08-07 08:07

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!

  • Up0
  • Down0
jgcj
Join Date: 16 Aug 17
Posts: 3
Posted: Wed, 2017-08-23 09:14

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

#> sudo apt-get install g++-4.9

then telling the system to use that compiler instead of the g++ 5.4

#> export CXX=/usr/bin/g++-4.9

then in my case there was already a make file for the example so I used that

#> make -f Makefile.x86_64-linux-clang

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!

  • Up0
  • Down0
gino0
Join Date: 26 May 19
Posts: 12
Posted: Fri, 2019-06-21 03:29

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.

sudo apt-get install g++-4.8

export CXX=g++-4.8 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.