Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 19 Jun 2013, 02:28
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
libtool and the missing link
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
goingnuts

Joined: 07 Dec 2008
Posts: 634

PostPosted: Wed 18 Jul 2012, 13:35    Post_subject:  libtool and the missing link
Sub_title: How to tell libtool to respect "-static"?
 

Some programs uses libtool when compiling and linking after you have done the ./configure.

As example I pass the following to build binutils:
Code:

LD="/usr/i386-linux-uclibc/bin/i386-uclibc-ld" CC="/usr/i386-linux-uclibc/bin/i386-uclibc-gcc -static"
CFLAGS="-pipe -Os -mtune=i386 -Wall -D_BSD_SOURCE -D_GNU_SOURCE" LDFLAGS="-static -Wl,--gc-sections,--sort-common,-s" ./configure --prefix=/usr/i386-linux-uclibc/usr --includedir=/usr/i386-linux-uclibc/usr/include --disable-nls --disable-shared --enable-static

...but no matter where I put the "-static" it never turns up in the final linking.

Below a part of the compiling process where the -"static" is present in the first block - but absolutely gone in the second part that actually creates the bin:

Code:

/bin/sh ./libtool --tag=CC --mode=link /usr/i386-linux-uclibc/bin/i386-uclibc-gcc -static -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -pipe -Os -mtune=i386 -Wall -D_BSD_SOURCE -D_GNU_SOURCE  -static -Wl,--gc-sections,--sort-common,-s -L/usr/i386-linux-uclibc/usr/lib -o ar  arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a -lfl  -lz -lm

libtool: link: /usr/i386-linux-uclibc/bin/i386-uclibc-gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -pipe -Os -mtune=i386 -Wall -D_BSD_SOURCE -D_GNU_SOURCE -Wl,--gc-sections -Wl,--sort-common -Wl,-s -o ar arparse.o arlex.o ar.o not-ranlib.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a -lfl  -lz -lm


By just adding the "-static" to the last command the bin is build static with no problems...Is there a magic flag to be set?

UPDATE: It always help to clear ones mind posting questions...At least for binutils it works if "-Xcompiler -static" is included in LDFLAGS. I will test some other sources were I have the same problem: It works with conky-1.3.0, not with libiconv-1.6.1...
Back to top
View user's profile Send_private_message Visit_website 
John Doe

Joined: 01 Aug 2005
Posts: 1689
Location: Michigan, US

PostPosted: Wed 18 Jul 2012, 22:47    Post_subject:  

I think you are after the following:

Code:
export LDFLAGS+="-static"
Back to top
View user's profile Send_private_message 
John Doe

Joined: 01 Aug 2005
Posts: 1689
Location: Michigan, US

PostPosted: Thu 19 Jul 2012, 00:42    Post_subject:  

p.s. might be best to stay away from libiconv. I've messed up my system with that before. As best I remember, puppy likes the version that glibc installs.
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 3845

PostPosted: Sat 21 Jul 2012, 12:50    Post_subject:  

In my musl static tool chain I wrote a wrapper that use a for arg in $@ case... to look through $@ for -l* and grokked in my link time options there (also replaced -O[0-3] with -Os and added my goodies in ... saved me from a ton of CLI simulated 3rd button click frustration) - just named it gcc after mving gcc to gcc-real

Not at home right now, here is a link to my old one
http://www.murga-linux.com/puppy/viewtopic.php?p=588232&#588232

_________________
Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0505s ][ Queries: 12 (0.0133s) ][ GZIP on ]