This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: statically linked shared object

What about if you replace -static with "-Wl,-Bstatic"?  That explicitly
tells the linker to link statically (so long as it's GNU ld).  -static
is probably supposed to get translated to something like -Bstatic for
the linker, but maybe that doesn't happen in this case for some reason.


-----Original Message-----
From: [] On
Behalf Of
Sent: Thursday, June 10, 2004 1:54 PM
Subject: statically linked shared object


I've problem creating a statically linked shared object. I'm using g++
(GCC) 3.3 20030226.
First object vidflat.o is created:
g++  -fPIC -pg  -ggdb  -c -o vidflat.o

Then is created using keyword -static:
g++  vidflat.o  -static -shared -frtti  -o -L../../../../lib
-l3d -ldl -lm  -L/usr/lib -lglut -lGLU -lGL  -L/usr/X11R6/lib -lXt -lXi
-lXmu -lXext -lX11 -lpthread -pg

But ldd proves that this .so isn't linked statically at all:

ldd ./ => /lib/ (0x4002c000) => /usr/lib/ (0x40030000) => /usr/lib/ (0x40067000) => /usr/lib/ (0x40101000) => /usr/X11R6/lib/ (0x4015d000) => /usr/X11R6/lib/ (0x401b1000) => /usr/X11R6/lib/ (0x401b9000) => /usr/X11R6/lib/ (0x401d0000) => /usr/X11R6/lib/ (0x401df000) => /lib/ (0x402ad000) => /usr/lib/ (0x402fd000) => /lib/ (0x403b5000) => /lib/ (0x403d7000)
        /lib/ => /lib/ (0x80000000) => /usr/X11R6/lib/ (0x4050e000) => /usr/X11R6/lib/ (0x40517000) => /lib/ (0x4052e000) => /usr/lib/ (0x40536000)

Using -static worked fine for statically linked application but not for
shared object.
Which parameters do I have to pass to g++ to create statically linked
shared object?

Thanks in advance

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]