LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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
  Search this Thread
Old 11-14-2009, 06:53 AM   #1
The_Sven
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
How to build statically linked binary with autoconf


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?
 
Old 11-14-2009, 11:52 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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-14-2009 at 11:56 PM.
 
Old 11-15-2009, 09:31 AM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
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 ?
 
  


Reply



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 On
HTML code is Off



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:06 AM.

Main Menu
Advertisement
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.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration