[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Statisk linking



"Erwin S. Andreasen" <sslug@sslug> wrote:

> Det må være noget mystisk opførsel med libdl, som er det lib som
> håndterer dynamisk loading (via dlopen, ikke dynamiske libs når
> programmet starter). Måske kunne du prøve at lade -ldl forblive
> dynamisk og gære de andre ting statisk.

Okay, en del eksperimenteren har vist, at Gtk+ ikke kan lide at blive
linket statisk (den linker, men vil ikke køre). Yderligere en del
eksperimenteren har vist, at det ikke er så ligetil at linke stdc++
statisk; men det lod sig dog gøre med følgende simple linie:

/usr/lib/gcc-lib/i586-mandrake-linux/2.96/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o myresnak /usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../crt1.o /usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../crti.o /usr/lib/gcc-lib/i586-mandrake-linux/2.96/crtbegin.o  -L/usr/lib -L/usr/X11R6/lib -L/usr/lib/gcc-lib/i586-mandrake-linux/2.96 -L/usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../../i586-mandrake-linux/lib -L/usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../.. ant.o gtkinout.o myresnak.o inout.o parser.o command.o memory.o printer.o -Bstatic -lgtkmm -lgdkmm -lsigc -lpthread -lstdc++ -Bdynamic -ldl -lm -lgcc -lc -lgtk -lgdk -lgmodule -lglib -lXi -lXext -lX11 /usr/lib/gcc-lib/i586-mandrake-linux/2.96/crtend.o /usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../crtn.o


> Såh, du kunne fx lade libc og libdl forblive dynamiske men statisk
> linke de mere eksotiske ting du har.

De dele, der er C++, er nu statiske; og da det er dem, der er mest
dynamiske (ha-ha!), er jeg relativt tilfreds med det resultat. Men det
er lidt suboptimalt ikke at kunne få det helt som man vil.


> Start med at ekspandere de der "foo-config --libs" til hvad de
> egentlig outputter. Måske er der nogle underlige flag der og ikke
> bare libs.

Det var nu ikke tilfældet; men et -v på g++ hjalp til at finde
ovenstående lange smøre, og flytte lidt rundt på den.


> > Hvad kan det nu skyldes, og hvordan slipper jeg af med det? Eller
> > hvordan sørger jeg på anden vis for, at programmet kan køres på enhver
> > distribution?
> 
> Lade være med at skrive det i C/C++ ;)

Plrff - forkert gruppe, makker :-).



Anders.

PS. Tak for LeakTracer. Great fun.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *