OESF | ELSI (coming soon) | Community Links (coming soon) | LinuxPDA | Ibiblio


Welcome Guest ( Log In | Register )

> How To Link Statically?
post Jun 27 2006, 12:42 AM
Post #1

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


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

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...

Go to the top of the page
+Quote Post
Start new topic
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

Posts in this topic

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


RSS Lo-Fi Version Time is now: 26th April 2017 - 01:48 PM