2008-10-31 18:17:55     Where did libasound.a go?

Document created by Aaronwu Employee on Aug 8, 2013
Version 1Show Document
  • View in full screen mode

2008-10-31 18:17:55     Where did libasound.a go?

Steve Strobel (UNITED STATES)

Message: 64558   

 

I am trying to rebuild an application for the first time in a few months. During that time I have upgraded my toolchains and uClinux distribution from 2007R1-RC3 to 2008R1.5-RC3. The application compiles fine, but has trouble linking against the asound library. The makefile used a library search path of ...uClinux/staging/usr/local/lib. That directory no longer exists, but the alsa files seem to now exist in staging/usr/lib. I changed the makefile, but still get the error message:

 

bfin-linux-uclibc-g++ -L~/Blackfin/uClinux/staging/usr/lib -o"crosspoint"  ./SimpleFileReaderWrapper.o ./SimpleFileWriterWrapper.o ./crosspoint.o   -lasound -lpthread

/opt/uClinux-2007rc3/bfin-linux-uclibc/bin/../lib/gcc/bfin-linux-uclibc/4.1.2/../../../../bfin-linux-uclibc/bin/ld: cannot find -lasound I think it is looking for libasound.a, which I don't find anywhere:

 

find -name libasound.*

./lib/alsa-lib/build-alsa-lib-1.0.12/src/libasound.la

./lib/alsa-lib/build-alsa-lib-1.0.12/src/.libs/libasound.lai

./lib/alsa-lib/build-alsa-lib-1.0.12/src/.libs/libasound.la

./lib/alsa-lib/build-alsa-lib-1.0.12/src/.libs/libasound.so

./lib/alsa-lib/build-alsa-lib-1.0.12/src/.libs/libasound.so.2

./lib/alsa-lib/build-alsa-lib-1.0.12/src/.libs/libasound.so.2.0.0

./romfs/usr/lib/libasound.so.2

./staging/usr/lib/libasound.la

./staging/usr/lib/libasound.so

./staging/usr/lib/libasound.so.2

./staging/usr/lib/libasound.so.2.0.0

 

Should I be using a shared library (and if so, how)? I am trying to roughly follow the method for "Using external libraries from the staging directory" as documented in <http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:existing_libraries#using_libs_in_external_applications>.

 

An old copy of the application runs fine on a newly-build system; I think it has the alsa library statically linked. My configuration looks like this:

 

<*> Sound card support

       Advanced Linux Sound Architecture  --->

 

<*> Advanced Linux Sound Architecture

< >   Sequencer support

<M>   OSS Mixer API

<M>   OSS PCM (digital audio) API

[*]     OSS PCM (digital audio) API - Include plugin system

[ ]   Dynamic device file minor numbers

[*]   Support old ALSA API

[*]   Verbose procfs contents

[ ]   Verbose printk

 

Thanks for any suggestions,

 

Steve

QuoteReplyEditDelete

 

 

2008-10-31 18:21:56     Re: Where did libasound.a go?

Mike Frysinger (UNITED STATES)

Message: 64559   

 

when you link, it doesnt require static libraries unless you specify -static

 

run with -Wl,--verbose to see where exactly the linker is searching

QuoteReplyEditDelete

 

 

2008-11-03 11:06:14     ~ expansion in linker -L arguments (was Re: Where did libasound.a go?)

Steve Strobel (UNITED STATES)

Message: 64632   

 

Thanks Mike for the suggestion. It led to a workaround, although I still don't understand the root of the problem. With the linker options you suggested, it printed, "attempt to open ~/Blackfin/uClinux/staging/usr/lib/libasound.so failed" (among a bunch of other places it looked). That file is a symbolic link to a file that does exist and can be viewed with cat:

 

ls -l ~/Blackfin/uClinux/staging/usr/lib/libasound.so

lrwxrwxrwx 1 stevestrobel stevestrobel 18 2008-10-28 10:57 /home/stevestrobel/Blackfin/uClinux/staging/usr/lib/libasound.so -> libasound.so.2.0.0

 

ls -l ~/Blackfin/uClinux/staging/usr/lib/libasound.so.2.0.0

-rwxr-xr-x 1 stevestrobel stevestrobel 2796418 2008-10-28 10:57 /home/stevestrobel/Blackfin/uClinux/staging/usr/lib/libasound.so.2.0.0

 

If I change the command line to expand ~ to the path it represents (/home/stevestrobel), the link completes successfully (on my machine, but won't on my co-workers since their home directories are different). I don't know why the ~ expansion doesn't seem to work right wtih the linker; it works fine with the -isystem compiler option when I run the command:

 

bfin-linux-uclibc-g++ -O0 -g3 -Wall -c -fmessage-length=0 -mfdpic -isystem ~/Blackfin/uClinux/staging/usr/include -MMD -MP -MF"crosspoint.d" -MT"crosspoint.d" -o"crosspoint.o" "../crosspoint.cc"

 

Is there a problem with the linker's ~ expansion? I just tried using $HOME instead of ~; that seems to work fine from the bash command line:

 

bfin-linux-uclibc-g++ -L$HOME/Blackfin/uClinux/staging/usr/lib -o"crosspoint" ./SimpleFileReaderWrapper.o ./SimpleFileWriterWrapper.o ./crosspoint.o -lasound -lpthread

 

But I can't seem to get Eclipse to do the same thing. When I set a library search path of $HOME/Blackfin/uClinux/staging/usr/lib, it actually runs the linker command:

 

bfin-linux-uclibc-g++ -LOME/Blackfin/uClinux/staging/usr/lib -o"crosspoint" ./SimpleFileReaderWrapper.o ./SimpleFileWriterWrapper.o ./crosspoint.o -lasound -lpthread

 

I tried escaping the $ with a \ and various combinations of quotes, but still can't get Eclipse to expand $HOME correctly. I guess the workaround for now is to add multiple -L options, one for each developer's home directory, with the entire path hard-coded in each. Any other suggestions? Is there something else I should do to test or file a bug report on the linker? Thanks.

 

Steve

QuoteReplyEditDelete

 

 

2008-11-03 11:56:48     Re: ~ expansion in linker -L arguments (was Re: Where did libasound.a go?)

Mike Frysinger (UNITED STATES)

Message: 64639   

 

the compiler/linker doesnt know/care about things like ~ expansion.  that is the business of the shell.  i dont think ~/ expansion has ever worked if it isnt at the start of a word ?  so you'd have to use -L ~/......

 

i imagine eclipse is passing $HOME to make which means you need to quote it properly: ${HOME}

QuoteReplyEditDelete

 

 

2008-11-03 13:46:46     Re: ~ expansion in linker -L arguments (was Re: Where did libasound.a go?)

Steve Strobel (UNITED STATES)

Message: 64641   

${HOME} works great.  Thanks for your help.

 

Steve

Attachments

    Outcomes