[ADMB Users] g++ compile and link

3 views
Skip to first unread message

Arni Magnusson

unread,
Dec 10, 2008, 3:28:38 PM12/10/08
to us...@admb-project.org
To answer Jon Schnute's question 1, here are the scripts I use to
compile and link separately with GCC. The first four scripts are just
one long line each:

---

adcomp.bat

g++ -c -O3 -Wno-deprecated -D__GNUDOS__ -Dlinux -DOPT_LIB -DUSE_LAPLACE
-fpermissive -I. -I%ADMB_HOME%/include %1.cpp


adcompr.bat

g++ -c -O3 -Wno-deprecated -D__GNUDOS__ -Dlinux -DOPT_LIB -DUSE_LAPLACE
-fpermissive -I. -I%ADMB_HOME%/include %1.cpp


adlink.bat

g++ -s %1.o -L%ADMB_HOME%/lib -ldf1b2stub -ladmod -ladt -lado
-ldf1b2stub -ladmod -ladt -lado -o%1


adlinkr.bat

g++ -s %1.o -L%ADMB_HOME%/lib -ldf1b2o -ladmod -ladt -lado -ldf1b2o
-ladmod -ladt -lado -o%1


admake.bat

tpl2cpp %1
call adcomp %1
call adlink %1


admaker.bat

tpl2rem %1
call adcompr %1
call adlinkr %1

---

My Linux scripts are practically identical. I have converged to these
scripts after examining all recent ADMB releases for Windows and Linux.
I copy my scripts into the ADMB bin folder, and ignore other *.bat
scripts there.

If you like "safe" mode, remove -DOPT_LIB and replace ldf1b2o<->ldf1b2s
and lado<->lads.

The newest scripts have an -lpthread flag with a comment saying that the
user may not want to use it. This flag has no effect on performance
(although the executables are not identical) in my benchmarks, so I'm
not using it.

Arni
_______________________________________________
Users mailing list
Us...@admb-project.org
http://lists.admb-project.org/mailman/listinfo/users

Arni Magnusson

unread,
Dec 10, 2008, 6:14:42 PM12/10/08
to us...@admb-project.org
On Wed, 10 Dec 2008, Jon Schnute wrote:

> Thanks Arni! That really helps. I'm glad you've taken seriously the
> problem of finding scripts that work generically. You say that your
> "Linux scripts are practically identical". Given that there must be some
> differences, would you mind sending them, too?
>
> [...]
>

Sure thing, here they are. What I meant by practically identical is that
there are no differences in the g++ calls, only Dos vs. Bash script
ornaments. Although I haven't bothered to use double quoted "%ADMB_HOME%"
and "$ADMB_HOME" a formal release should probably do so, in case the
directory name contains spaces, like the infamous c:/program files.

---

adcomp and adcompr

#!/bin/bash


g++ -c -O3 -Wno-deprecated -D__GNUDOS__ -Dlinux -DOPT_LIB -DUSE_LAPLACE

-fpermissive -I. -I$ADMB_HOME/include $1.cpp


adlink

#!/bin/bash
g++ -s $1.o -L$ADMB_HOME/lib -ldf1b2stub -ladmod -ladt -lado -ldf1b2stub
-ladmod -ladt -lado -o$1


adlinkr

#!/bin/bash
g++ -s $1.o -L$ADMB_HOME/lib -ldf1b2o -ladmod -ladt -lado -ldf1b2o -ladmod
-ladt -lado -o$1


admake

#!/bin/bash
tpl2cpp $1
adcomp $1
adlink $1


admaker

#!/bin/bash
tpl2rem $1
adcompr $1
adlinkr $1

Reply all
Reply to author
Forward
0 new messages