Error in C++ SDK

@y1165949971

Regarding Q1: Disable EON comipler (In Deployment page) before deploying the C++ SDK.

@rjames
Hi James,
There comes a new problem in Q1:
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libtensorflow-lite.a when searching for -ltensorflow-lite
/usr/bin/ld: cannot find -ltensorflow-lite
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libfarmhash.a when searching for -lfarmhash
/usr/bin/ld: cannot find -lfarmhash
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libfft2d_fftsg.a when searching for -lfft2d_fftsg
/usr/bin/ld: cannot find -lfft2d_fftsg
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libfft2d_fftsg2d.a when searching for -lfft2d_fftsg2d
/usr/bin/ld: cannot find -lfft2d_fftsg2d
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libruy.a when searching for -lruy
/usr/bin/ld: cannot find -lruy
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libXNNPACK.a when searching for -lXNNPACK
/usr/bin/ld: cannot find -lXNNPACK
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libcpuinfo.a when searching for -lcpuinfo
/usr/bin/ld: cannot find -lcpuinfo
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libpthreadpool.a when searching for -lpthreadpool
/usr/bin/ld: cannot find -lpthreadpool
/usr/bin/ld: skipping incompatible ./tflite/linux-aarch64/libclog.a when searching for -lclog
/usr/bin/ld: cannot find -lclog
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:140: recipe for target ‘runner’ failed
make: *** [runner] Error 1

Thanks!

@y1165949971,

Are you running this command on a AARCH64 device? If not, then you should use a cross compiler.
For e.g.

# clean
APP_CUSTOM=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1 make clean
# build
APP_CUSTOM=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1 make -j

@rjames
Hi james,
I ran these on my X86 Ubuntu linux.I install cross compiler used this command :

sudo apt install gcc-aarch64-linux-gnu

.Then i run your new command.There comes a new problem:

fier_porting.cpp -o edge-impulse-sdk/porting/mingw32/ei_classifier_porting.o
make: execvp: aarch64-linux-gnu-g++: Not a directory
make: execvp: aarch64-linux-gnu-g++: Not a directory
Makefile:137: recipe for target ‘tflite-model/tflite-trained.o’ failed
make: execvp: aarch64-linux-gnu-g++: Not a directory
make: *** [tflite-model/tflite-trained.o] Error 127
make: *** Waiting for unfinished jobs…
Makefile:137: recipe for target ‘edge-impulse-sdk/dsp/kissfft/kiss_fft.o’ failed
make: execvp: aarch64-linux-gnu-g++: Not a directory
make: *** [edge-impulse-sdk/dsp/kissfft/kiss_fft.o] Error 127
Makefile:137: recipe for target ‘edge-impulse-sdk/dsp/kissfft/kiss_fftr.o’ failed
make: *** [edge-impulse-sdk/dsp/kissfft/kiss_fftr.o] Error 127
Makefile:137: recipe for target ‘edge-impulse-sdk/dsp/dct/fast-dct-fft.o’ failed
make: *** [edge-impulse-sdk/dsp/dct/fast-dct-fft.o] Error 127
make: execvp: aarch64-linux-gnu-g++: Not a directory
Makefile:137: recipe for target ‘edge-impulse-sdk/dsp/memory.o’ failed
make: *** [edge-impulse-sdk/dsp/memory.o] Error 127
make: execvp: aarch64-linux-gnu-g++: Not a directory
Makefile:137: recipe for target ‘edge-impulse-sdk/porting/posix/ei_classifier_porting.o’ failed
make: *** [edge-impulse-sdk/porting/posix/ei_classifier_porting.o] Error 127
make: execvp: aarch64-linux-gnu-g++: Not a directory
Makefile:137: recipe for target ‘edge-impulse-sdk/porting/posix/debug_log.o’ failed
make: *** [edge-impulse-sdk/porting/posix/debug_log.o] Error 127
make: execvp: aarch64-linux-gnu-g++: Not a directory
Makefile:137: recipe for target ‘edge-impulse-sdk/porting/mingw32/ei_classifier_porting.o’ failed
make: *** [edge-impulse-sdk/porting/mingw32/ei_classifier_porting.o] Error 127

@y1165949971

You’re missing the ARM GNU Toolchain for your host machine. You can use e.g. use this. Found here.

You’d need to set your PATH variable accordingly so that the toolchain can be found. See instructions here.

Then you should be able to run the above command with no issues.

@y1165949971

Regarding Q2: I think this is a bug. I’ll create a ticket and update your other post when it has been resolved.

Hi rjames,
You do help me a lot. Looking for your reply for Q2.
Thank you very much.

1 Like

@y1165949971

I’ve updated the audio.cpp and removed the moving average filter features (maf) as workaround until we fix this. Can you get the latest changes and try again?

// Raul

@rjames Hi rjames ,
I am trying the new version.But the old problem got again. I solved it by restarting ubuntu yeterday,but fails now.

@y1165949971

It looks like your trying to cross compile the audio app for aarch64 target. This won’t work the way your doing it now, because -lasound library you’re linking to was built for your host.

You’d need to

  1. install libasound2-dev on the AARCH64 linux target.
  2. clone the example-standalone-inferencing-linux repo onto your AARCH64 linux target and run
CC=gcc CXX=g++ APP_AUDIO=1 TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1 make clean
CC=gcc CXX=g++ APP_AUDIO=1 TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1 make -j

Note: you will be compiling audio app natively and linking with the correct libraries.

On target you could verify that usr/include is in G++ path with the following:

echo | gcc -E -Wp,-v -

It may have worked yesterday because I had included /usr/include to the CLFAGS (here) but then removed it (here) because I realized it wouldn’t work for cross-compilation.

@rjames Hi rjames,thanks for your reply.I don’t have Ubuntu software package in my AARCH64 linux target.
Q1: I have alsa-lib in my AARCH64 linux target. Do i need to install it ? How could i install correct version of libasound2-dev on the AARCH64 linux target.
image
Q2:I tried the two commands,maybe i need to install gcc on my AARCH64 linux target?

Thanks ~

I’m not sure about alsa-lib. According to here it may look to be the same. You’ll need the headers, can you check if they’re found in /usr/include/.

What is the current architecture?
Can you share the output of uname -a?

And may I ask what is it you’re trying to achieve, maybe there’s another way.

@rjames Hi,rjames
Thanks for reply. It looks like the ‘/include’ and ‘libasound2-dev.h’ cannot be found. Could i mkdir /include,copy the ***.h into /include and set PATH variable? My current architecture is shown as the figure.
And I am trying to achieve real-time keywords-spotting on my Aarch64 target. Maybe we can cross-compiler all the dependencies by Cmakelist.txt or Makefile? I used to assume it can achieve my goal by using the command “APP_CUSTOM=1 TARGET_LINUX_AARCH64=1 USE_FULL_TFLITE=1 CC=clang CXX=clang++ make -j” . Maybe you get another way?
image

Thank u very much~

@y1165949971

Real-time keywords-spotting on AARCH64 can be achieved also without compiling any source code and offline.

  1. Go to the Deployment page in your project and build for Linux AARCH64. Save this as e.g. model.eim.
  2. Copy the model (model.eim) to your AARCH64 target.
  3. On the AARCH64 target run edge-impulse-linux-runner --model-file model.eim

You will now have offline real-time keyword spotting on your target.

Regarding alsa-lib, I can confirm that I can natively build the APP_AUDIO on a Linux x86 machine.
The same should be possible on arm64 if you have the header and library.

  1. Ensure libasound lib is found.
➜  x86 git:(x86) find /usr/lib/ -name 'libasound*'
/usr/lib/libasound.so.2.0.0
/usr/lib/libasound.so
/usr/lib/libasound.so.2
...
  1. Ensure alsa/libasound.h can be found:
➜  x86 git:(x86) find /usr/include -name 'asoundlib.h'
/usr/include/asoundlib.h
/usr/include/sys/asoundlib.h
/usr/include/alsa/asoundlib.h
  1. Then you can build the APP_AUDIO

@rjames Hi rjames,
My target don’t have ubuntu software package. Maybe i need to install edge-impulse-linux on my Linux AARCH64 to run this command?

Q1:I can find the first one. But i cann’t find ‘/include’ and ’ asoundlib.h’. What about i mkdir it and copy the asoundlib.h into it.

Q2:I tried the two commands,maybe i need to install gcc on my AARCH64 linux target?

Which compiler do you have on your target? gcc is not installed or not found in PATH. You will need a compiler, first install one, set the PATH accordingly so that it can be found.

FYI:
Follow instructions found here (and e.g. for Node.js here) to get edge-impulse-linux-runner.

@y1165949971

You shouldn’t have to move the header file. You’d have to find where the headers for this package is installed. It may be in other places than /usr/include try widening your search to

find / -name 'asoundlib.h'

EDIT: I see that you already searched and didn’t find it.
You’d need to install the alsa lib development package (to get the headers) for your target.
Search for example: alsa-lib-dev, alsa-lib-devel, libasound2-dev in your package manager

@rjames
Thanks for reply. Maybe I understand your advise. The easiest way to achieve my goal is to install Ubuntu on my target,then install our edge-impulse-linux. The i can run the model.eim.
Cause i want to learn something from our Edge Impulse,i will try the traditional way to achieve it. Firstly, i need to install a compiler (e.g gcc-7.5.0) . Secondly, install the alsa lib development package (to get the headers) for my target. I need to cross-compiler them to my Aarch64 target without Ubuntu? Is there any instruction for me to refer.