Sid Touati <[EMAIL PROTECTED]> writes:

> To give a concrete example, suppose that I have a g++ compiler command
> line  such as :
> g++ -O0 -g3  -o sira sira.o RG.o intLPSIRA.o siraloop.o anyoption.o
> -L/home/touati/lib -L/usr/ilog/cplex100/lib/x86_rhel4.0_3.4/static_pic
> -L/home/touati/lp_solve_5.5/lib -L/usr/lib -llpsolve55 -lpthread -lm
> -lcplex -lDDG -lG -lL -lboost_filesystem

This command line is bad -- system libraries (libpthread,
libm) should go after all "user" libraries.

This may be important because the order of library
initialization is generally reverse of their order on the
link line.

> And I would like to select the static version of
> libboost_filesystem. 

The answer is platform-specific. On many platforms the
following will do what you want:

  g++ ... -Wl,-Bstatic -lboost_filesystem -Wl,-Bdynamic ...

> experimented two solutions :
> - with -static g++ option : this option makes g++ to consider static
> libraries for all other libraries.

Don't ever use completely static linking (which is what
gcc -static does) -- it produces binaries that are likely
to fail across even subminor system revision differences.

> - by providing libboost_filesystem.a as a direct object file to the
> line command, but this solution would not be portable to all UNIX
> platforms.

Name a UNIX platform to which this solution is not portable.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to