gcc: cannot find -lasound when crosscompiling

4.1k Views Asked by At

I try to crosscompile this small program to my arm device, but get error:

arm-none-linux-gnueabi/bin/ld: cannot find -lasound
collect2: error: ld returned 1 exit status

Then i found libasound files in my target device and have copied to my folder /usr/lib but still no effect. I use the commands:

export CFLAGS="-I/usr/include -I/usr/lib"
$CC -o play sound_playback.c $CFLAGS -lasound

I have installed libasound2-dev package on my Ubuntu 14.04 x64 and be able to compile the program on my native computer without any errors.

UPDATE WITH SOLUTION
As Marc and John have said below, i just should use -L flag to set my library path. So my command line should be:

$CC -o play sound_playback.c $CFLAGS -L/usr/lib -lasound
0

There are 0 best solutions below