OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How To Link Statically?
daniel3000
post Jun 27 2006, 12:42 AM
Post #1





Group: Members
Posts: 1,002
Joined: 28-April 05
From: Germany
Member No.: 7,027



Hello,

I'm not a development guru, but from time to time I compile programs on the zaurus.
One questions, because there are often problems with unresolved dependencies when distributing programs which are linked dynamically:

How can I switch to statical linking

a. when using the normal Makefile stuff most sources come with
b. when compiling without having a makefile, i.e. directly with
gcc -o binary source.c

And:
Is really everything linked in statically then, or only the direct dependencies, but dependencies of dependencies still dynamically, e.g. if a library needs a library...

Thanks
daniel
Go to the top of the page
 
+Quote Post
dinorex
post Jun 27 2006, 12:54 AM
Post #2





Group: Members
Posts: 88
Joined: 20-February 06
From: Sydney
Member No.: 9,186



if you configure the zgcc cramfs package correctly, your line is ok to go.... for standard ANSI C stuff (under default environment)... to generate the .o (object) file

for linking out the binary, you need to link function... from the object file to binary...

for extra libs and / or languages, you may need to specify other include dirs and lib dirs....

you can try by the examples included in the cramfs package - hello dir

the Makefile in fact consists only 2 lines :

object file generation: g++ -c .... -o hello.o hello.cpp
binary file generation: g++ -o ... -o hello hello.o

hope this helps.
Go to the top of the page
 
+Quote Post
daniel3000
post Jun 27 2006, 01:52 AM
Post #3





Group: Members
Posts: 1,002
Joined: 28-April 05
From: Germany
Member No.: 7,027



QUOTE(dinorex @ Jun 27 2006, 10:54 AM)
if you configure the zgcc cramfs package  correctly, your line is ok to go....  for standard ANSI C stuff (under default environment)... to generate the .o (object) file

for linking out the binary, you need to link function... from the object file to binary...

for extra libs and / or languages, you may need to specify other include dirs and lib dirs....

you can try by the examples included in the cramfs package - hello dir

the Makefile in fact consists only 2 lines :

object file generation: g++ -c .... -o hello.o hello.cpp
binary file generation: g++ -o ... -o hello hello.o

hope this helps.
*


hm - no cramfs package. Im simply using the devel image by Silvio Iaccatino with a few own enhancements.
Not sure what to configure there, though.
I thought it must be some command line switch for gcc or similar?

daniel
Go to the top of the page
 
+Quote Post
miskinis
post Jun 27 2006, 02:54 AM
Post #4





Group: Members
Posts: 333
Joined: 8-January 05
From: North East, USA Today
Member No.: 6,159



QUOTE(daniel3000 @ Jun 27 2006, 09:52 AM)
I thought it must be some command line switch for gcc or similar?
*


Yes, if you have the static libraries (they end in .a) for everything you
are trying to link with, use the "-static" option to gcc. If you have a
desktop linux machine execute "man gcc" and it will spit out about
8000 lines of information. smile.gif Very useful stuff.

Not everything out there provides static object libraries however, recently
on the Zaurus, I found that lesstif (a Motif clone) did not offer a static object
library.

John
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd December 2014 - 05:31 AM