LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Thread Tools Search this Thread
Old 11-14-2009, 07:53 AM   #1
The_Sven
LQ Newbie
 
Registered: Nov 2009
Posts: 1
Thanked: 0
How to build statically linked binary with autoconf


[Log in to get rid of this advertisement]
I want to build a statically linked version of Ogg Vorbis on Ubuntu 9.10.

The Ogg Vorbis build environment seems to run on autoconf. There is a configure script which will generate a Makefile. If I give the configure script the following options:

--enable-static
--disable-shared

then statically linking <almost> works. Almost = the binary is statically linked to all necessary Ogg libraries, but it's still dynamically linked to the C library !

sven@inspiron-6000:~$ ldd ./oggenc
linux-gate.so.1 => (0x00b09000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00cef000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x0029b000)
/lib/ld-linux.so.2 (0x006a8000)

When I <manually> add -static to the gcc command-line which generates oggenc, it seems to work just fine:

sven@inspiron-6000:~$ ldd oggenc
not a dynamic executable

I must confess that I know absolutely nothing about autoconf - I'm a Windows person. Ok, so shoot me !

How to I link statically without having to run the last step manually?
linux The_Sven is offline     Reply With Quote
Old 11-15-2009, 12:52 AM   #2
paulsm4
Senior Member
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 3,535
Thanked: 181
This should help:

http://people.redhat.com/drepper/no_static_linking.html

PS:
Most of the discussion applies equally to Windows

Last edited by paulsm4; 11-15-2009 at 12:56 AM..
paulsm4 is offline     Reply With Quote
Old 11-15-2009, 10:31 AM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 337
Thanked: 35
Quote:
Originally Posted by The_Sven View Post
I want to build a statically linked version of Ogg Vorbis on Ubuntu 9.10.

The Ogg Vorbis build environment seems to run on autoconf. There is a configure script which will generate a Makefile. If I give the configure script the following options:

--enable-static
--disable-shared

then statically linking <almost> works. Almost = the binary is statically linked to all necessary Ogg libraries, but it's still dynamically linked to the C library !

sven@inspiron-6000:~$ ldd ./oggenc
linux-gate.so.1 => (0x00b09000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00cef000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x0029b000)
/lib/ld-linux.so.2 (0x006a8000)

When I <manually> add -static to the gcc command-line which generates oggenc, it seems to work just fine:

sven@inspiron-6000:~$ ldd oggenc
not a dynamic executable

I must confess that I know absolutely nothing about autoconf - I'm a Windows person. Ok, so shoot me !

How to I link statically without having to run the last step manually?
I can understand why you want make static link to Oggs libraries, but why you want it for libc/libm too ?
linuxfedora Valery Reznic is offline     Reply With Quote

Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox 32bit still statically linked? Olaus Slackware 9 10-30-2009 10:29 PM
rebuild statically linked ports 24jedi *BSD 2 09-15-2006 11:56 PM
Really statically linked skype client ? tothzp Linux - Software 1 04-21-2006 08:17 AM
fully statically linked posix thread program on PPC mmiglia Linux - Software 0 09-22-2004 08:06 AM
Gnucash statically linked binary melinda_sayang Slackware 7 07-11-2004 03:32 AM


All times are GMT -5. The time now is 05:00 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration