Discussion:
[Alsa-user] ALSA, link static, cannot find -lasound
William Estrada
2009-02-10 01:29:03 UTC
Permalink
hi group,

Trying to rebuild my ALSA programs with static libs.

Code:

Here is what works:
$ gcc -g -O2 -lasound -o volume volume.o
$ file volume
volume: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

but when I try with -static, I get this:
Code:

gcc -g -O2 -static -lasound -o volume volume.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lasound

Any ideas??
--
William Estrada
***@popdial.com
Mt-Umunhum-Wireless.net ( http://64.124.13.3 )
Ymessenger: MrUmunhum
John Haxby
2009-02-10 08:27:44 UTC
Permalink
Post by William Estrada
hi group,
Trying to rebuild my ALSA programs with static libs.
[snip]
gcc -g -O2 -static -lasound -o volume volume.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lasound
There isn't a libasound.a so far as I'm aware. I would say that it's
unlikely that any distro would provide one since the alsa library
dynamically loads its various modules which rather defeats the object of
it being static.

To be honest, unless you have a really, really good case for a static
executable you should avoid them anyway. At the moment, I can't think
of a sensible use-case for static ALSA programs, although I'm sure
someone could!

jch
William Estrada
2009-02-10 20:50:22 UTC
Permalink
John,

The reason I need static programs is that want to run these programs
on multiple
platforms and I don't want to require the libraries be installed. I
already have
a problem running on FC5 ( my server ). The development platform is FC8.
I get
seg faults sometimes on the server but it runs fine on my laptop.

Thanks for your time.
Post by John Haxby
Post by William Estrada
hi group,
Trying to rebuild my ALSA programs with static libs.
[snip]
gcc -g -O2 -static -lasound -o volume volume.o
cannot find -lasound
There isn't a libasound.a so far as I'm aware. I would say that
it's unlikely that any distro would provide one since the alsa library
dynamically loads its various modules which rather defeats the object
of it being static.
To be honest, unless you have a really, really good case for a static
executable you should avoid them anyway. At the moment, I can't
think of a sensible use-case for static ALSA programs, although I'm
sure someone could!
jch
--
William Estrada
***@popdial.com
Mt-Umunhum-Wireless.net ( http://64.124.13.3 )
Ymessenger: MrUmunhum
p***@indiatimes.com
2009-02-10 12:53:18 UTC
Permalink
There should have been an option to build alsa utilities statically.
To check the speaker of a platform, I don't have to port the whole of alsa-lib + alsa-utilities on my small busybox file-system, do i ?

So an aplay or speaker-test would be really helpful in those situations.
I tried too, to build it statically, but yes, dl_* calls doesn't allow it to be built statically.

regards,
Pavan


----- Original Message -----
From: John Haxby <***@thehaxbys.co.uk>
To: ***@popdial.com
Cc: alsa-***@lists.sourceforge.net
Sent: Tue, 10 Feb 2009 13:57:44 +0530 (IST)
Subject: Re: [Alsa-user] ALSA, link static, cannot find -lasound
Post by William Estrada
hi group,
Trying to rebuild my ALSA programs with static libs.
[snip]
gcc -g -O2 -static -lasound -o volume volume.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lasound
There isn't a libasound.a so far as I'm aware. I would say that it's
unlikely that any distro would provide one since the alsa library
dynamically loads its various modules which rather defeats the object of
it being static.

To be honest, unless you have a really, really good case for a static
executable you should avoid them anyway. At the moment, I can't think
of a sensible use-case for static ALSA programs, although I'm sure
someone could!

jch

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Alsa-user mailing list
Alsa-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


--
My life has changed. What about yours?
Log on to the new Indiatimes Mail and Live out of the Inbox! http://mail.indiatimes.com
Takashi Iwai
2009-02-10 13:39:00 UTC
Permalink
At Tue, 10 Feb 2009 18:23:18 +0530 (IST),
Post by p***@indiatimes.com
There should have been an option to build alsa utilities statically.
To check the speaker of a platform, I don't have to port the whole of alsa-lib + alsa-utilities on my small busybox file-system, do i ?
So an aplay or speaker-test would be really helpful in those situations.
I tried too, to build it statically, but yes, dl_* calls doesn't allow it to be built statically.
Read alsa-lib/INSTALL. In short, build only static library without shared lib once,
./configure --disable-shared --enable-static


Takashi
Post by p***@indiatimes.com
regards,
Pavan
----- Original Message -----
Sent: Tue, 10 Feb 2009 13:57:44 +0530 (IST)
Subject: Re: [Alsa-user] ALSA, link static, cannot find -lasound
Post by William Estrada
hi group,
Trying to rebuild my ALSA programs with static libs.
[snip]
gcc -g -O2 -static -lasound -o volume volume.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lasound
There isn't a libasound.a so far as I'm aware. I would say that it's
unlikely that any distro would provide one since the alsa library
dynamically loads its various modules which rather defeats the object of
it being static.
To be honest, unless you have a really, really good case for a static
executable you should avoid them anyway. At the moment, I can't think
of a sensible use-case for static ALSA programs, although I'm sure
someone could!
jch
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Alsa-user mailing list
https://lists.sourceforge.net/lists/listinfo/alsa-user
--
My life has changed. What about yours?
Log on to the new Indiatimes Mail and Live out of the Inbox! http://mail.indiatimes.com
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Alsa-user mailing list
https://lists.sourceforge.net/lists/listinfo/alsa-user
John Haxby
2009-02-10 13:41:11 UTC
Permalink
Post by p***@indiatimes.com
There should have been an option to build alsa utilities statically.
To check the speaker of a platform, I don't have to port the whole of alsa-lib + alsa-utilities on my small busybox file-system, do i ?
That argument doesn't hold up. On my really, really tiny busybox
environment (this router I have here) busybox itself is dynamic -- it's
linked again uClibc. You don't need all the utilities, you don't even
need all the plugins -- mostly what you want is libasound.so. My router
here seems to have the bulk of the libraries that libasound links
against in its /lib.
Post by p***@indiatimes.com
So an aplay or speaker-test would be really helpful in those situations.
I tried too, to build it statically, but yes, dl_* calls doesn't allow it to be built statically.
I'm not claiming that this is a good idea, but you can do a semi-static
link and explicitly include -ldl. Create a libasound.a that you link
against but leave everything else dynamic. Although it's probably as
easy to put libasound.so in your small environment. I would be
surprised if you saved that much space by linking statically, libasound
is pretty big and I wouldn't be at all surprised if most of it didn't
get pulled in by a static link.

jch
Loading...