Reputation: 709
I'm trying to make an "C" application for my NXP(Freescale) imx6 that Debian OS installed on it. My host machine is Ubuntu 16.04. I'm using eclipse as an IDE and I can manage to cross compile until today. I use arm-linux-gnueabihf-gcc
as an compiler and arm-linux-gnueabihf-ld
as an linker. I added -lasound
option to my linker parameter, but still can not build the application. I get an error
arm-linux-gnueabihf-ld: cannot find -lasound
I think I don't have the libasound.so
file on my Ubuntu (Host) machine and my linker couldn't link to library to my application.
I copied the libasound.so
file from my ARM machine to my host machine to the /home/user/Downloads
folder, but still couldn't compile.
Is there a step to use ALSA library in Cross Compilation project before build?
Here is the output of build operation
Building target: tihc_linux_application
Invoking: GCC C Linker
/usr/bin/arm-linux-gnueabihf-ld -static -L/home/user/Downloads -pthread -lasound -o "main" ./src/main.o
/usr/bin/arm-linux-gnueabihf-ld: mode armelf_linux_eabi
/usr/bin/arm-linux-gnueabihf-ld: cannot find -lasound
Upvotes: 1
Views: 2342
Reputation: 21974
You ask for static link (via -static
) but provide shared library so ld
probably ignores it (to be sure you can run with -Wl,--verbose
). One option is to cross-compile libalsa from scratch and then use resulting static lib to link your app. Another option is to search for pre-compiled gnueabihf libalsa somewhere...
Upvotes: 1