1

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
Black Glix
  • 689
  • 2
  • 11
  • 26

1 Answers1

1

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...

yugr
  • 19,769
  • 3
  • 51
  • 96
  • I deleted static flag and added the verbose flag. After these changes, as you mentioned, linker found the shared object file, but this time I got another error. `//usr/arm-linux-gnueabihf/lib/libc.so.6: error adding symbols: DSO missing from command line` – Black Glix Jan 26 '17 at 10:41
  • @BlackGlix That's [strange-linking-error-dso-missing-from-command-line](http://stackoverflow.com/questions/19901934/strange-linking-error-dso-missing-from-command-line). TLDR - move object file to front of command line, libs to the end. – yugr Jan 26 '17 at 11:26