Boost logo

Boost Users :

From: Forever Kid (foreverkid3_at_[hidden])
Date: 2006-12-11 23:32:04


Thanks Raul, Nat, and Roland,

I appreciate the help.

I finally found my way here:

http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Link-Options.html#Link-Options

It seems these are key for static linking:
-static -static-libgcc

I am not used to the gcc compiler and it seems like it
does dynamic linking by default. Is that correct? I
thought that -l specified static linking (it seems I
was wrong)

...and are currently using these options for compiling
and linking:

Compile:
g++ -I/home/quirk/dev/lib/boost_1_33_1/ -O0 -g3 -Wall
-c -fmessage-length=0 -pthread -MMD -MP -MF"main.d"
-MT"main.d" -o"main.o" "../main.cpp"
Finished building: ../main.cpp

Link:
g++ -L/home/quirk/dev/lib/boost_1_33_1/stage/lib
-static -static-libgcc -o"ManagedMakeProject"
./main.o -lboost_thread-gcc-mt-d-1_33_1 -lpthread

--- Raúl Huertas <raulh39_at_[hidden]> wrote:

> Forever Kid escribió:
> > Thanks for the reply.
> >
> > When I change the linker line to this (added the
> .a
> > extension):
> > g++
> >
>
-L/home/fejimush/development/libraries/boost_1_33_1/stage/lib
> > -o"ManagedMakeProject" ./main.o
> > -lboost_thread-gcc-mt-d-1_33_1.a
> >
> > I get the follow error:
> >
>
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/bin/ld:
> > cannot find -lboost_thread-gcc-mt-d-1_33_1.a
> >
> > The file is there and everything seems to be
> spelled
> > correctly, path and filename.
> >
> >
>
> If you want that the linker doesn't search the
> library, you dont have to
> use the -l flag.
> Try linking with this:
>
> g++ \
> -o"ManagedMakeProject" ./main.o \
>
/home/fejimush/development/libraries/boost_1_33_1/stage/lib/libboost_thread-gcc-mt-d-1_33_1.a
>
> (Assuming that the file
> libboost_thread-gcc-mt-d-1_33_1.a is in the
> directory
>
/home/fejimush/development/libraries/boost_1_33_1/stage/lib)
>
> The -l flag searches first for the dinamic (.so)
> library, and only if it
> can't find it, it searches for the static version.
>
>
> But, returning to your first post, I think that your
> problem doesn't
> happens at build time, does it?
> When do you get the message "error while loading
> shared libraries"? At
> link time or at run time?
>
> If you are sure that the file
>
/home/quirk/dev/libraries/boost_1_33_1/stage/lib/libboost_thread-gcc-mt-d-1_33_1.so
> exists and that the problem is at run time, then try
> this:
>
> g++
> -L/home/quirk/dev/libraries/boost_1_33_1/stage/lib \
> -o"ManagedMakeProject" ./main.o -lpthread \
> -lboost_thread-gcc-mt-d-1_33_1 \
>
-Wl,-rpath,/home/quirk/dev/libraries/boost_1_33_1/stage/lib
>
> Regards,
> Raul.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
>
http://lists.boost.org/mailman/listinfo.cgi/boost-users

 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net