cpptask ordering of static libraries in gcc command line
Posted
by AC
on Stack Overflow
See other posts from Stack Overflow
or by AC
Published on 2010-03-20T02:17:30Z
Indexed on
2010/03/20
2:21 UTC
Read the original article
Hit count: 671
How do I force cpptask to move the static libraries to the end on arg list issued to the compiler?
Here is the clause I am using
<cpptasks:cc description="appname" subsystem="console" objdir="obj" outfile="dist/app_test">
<compiler refid="testsslcc" />
<linkerarg value="-L${libdir}" />
<linkerarg value="-L/usr/local/devl/lib" />
<linkerarg value="-Wl,-rpath,../lib" />
<libset libs="unittest ${libs} dsg readline ncurses gcov" />
<fileset dir="test/obj" includes="main.o" />
<fileset dir="." includes="${TCFILES}" />
<fileset dir="../lib" includes="libboost_thread.a libboost_date_time.a" />
</cpptasks:cc>
when this executes, libboost_thread.a libboost_date_time.a are first files in the argument list passed the compiler,
gcc -ggdb -Wl,-export-dynamic -Wshadow -Wno-format-y2k ../../lib/libboost_date_time.a ../../lib/libboost_thread.a x.cpp ...
which causes compiler error. By manually moving them to the end of the argument list, the application compiles without error.
gcc -ggdb -Wl,-export-dynamic -Wshadow -Wno-format-y2k x.cpp ... ../../lib/libboost_date_time.a ../../lib/libboost_thread.a
And yes I have tried changing the order in the xml, and that of course didn't work. For now I am using an exec task to call gcc with the files in the correct order but this of course is a hack.
© Stack Overflow or respective owner