The order of command line arguments is actually important for the gnu linker. Specifically, I'm having this problem:
Ant generates:
gcc -lsomelib -lanotherlib -lsomethingelse -o myprogram.exe myprogram.o
That doesn't work, but the following does:
gcc -o myprogram.exe myprogram.o -lsomelib -lanotherlib -lsomethingelse
After reading through a whole bunch of random ant/cpptasks pages, I still can't figure out if this is something I can control. Do I need to hack the cpptasks source to fix this?
thanks,
-harlan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Would be helpful to see an excerpt from the build script.
If you are using explicit linkerarg elements, the documentation for the linkerarg element (http://ant-contrib.sourceforge.net/linkerarg.html) describes the location attribute in some detail. It would seem that all you need to do is to add location="end" to the linkerarg elements.
If you are using libset or syslibset elements, the code around line 148 in net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java places the generated -l arguments in the endargs collection, which means that they should appear after the file names.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks! Setting location="end" on the linkerargs did the trick.
I realize that I should be using "libset" (which would put the arguments at the end), but I'm forced to use "linkerargs" because ANT hangs when I put these libraries in the "libset" (this error is documented in another forum post, https://sourceforge.net/forum/forum.php?thread_id=1510820&forum_id=113701\)
Thanks for getting back to me so quickly -- that was very helpful.
-harlan crystal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
The order of command line arguments is actually important for the gnu linker. Specifically, I'm having this problem:
Ant generates:
gcc -lsomelib -lanotherlib -lsomethingelse -o myprogram.exe myprogram.o
That doesn't work, but the following does:
gcc -o myprogram.exe myprogram.o -lsomelib -lanotherlib -lsomethingelse
After reading through a whole bunch of random ant/cpptasks pages, I still can't figure out if this is something I can control. Do I need to hack the cpptasks source to fix this?
thanks,
-harlan
Would be helpful to see an excerpt from the build script.
If you are using explicit linkerarg elements, the documentation for the linkerarg element (http://ant-contrib.sourceforge.net/linkerarg.html) describes the location attribute in some detail. It would seem that all you need to do is to add location="end" to the linkerarg elements.
If you are using libset or syslibset elements, the code around line 148 in net/sf/antcontrib/cpptasks/gcc/AbstractLdLinker.java places the generated -l arguments in the endargs collection, which means that they should appear after the file names.
Thanks! Setting location="end" on the linkerargs did the trick.
I realize that I should be using "libset" (which would put the arguments at the end), but I'm forced to use "linkerargs" because ANT hangs when I put these libraries in the "libset" (this error is documented in another forum post, https://sourceforge.net/forum/forum.php?thread_id=1510820&forum_id=113701\)
Thanks for getting back to me so quickly -- that was very helpful.
-harlan crystal