gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] compiling and linking using the gcc-4.1.2 branch of gm2 under Whee


From: Gaius Mulley
Subject: [Gm2] compiling and linking using the gcc-4.1.2 branch of gm2 under Wheezy
Date: Sat, 07 Dec 2013 17:20:17 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)


Hi,

after hunting down the SYSTEM coroutines bug - I thought it might be
useful to walk through a compile and link example if one were to use
the latest gm2 based on gcc-4.1.2 under Debian Wheezy.

Firstly the potential problem is that we had to build and install gm2
after modifying the LIBRARY_PATH environment because Wheezy now
supports multiple architectures and gcc-4.1.2 assumed this was not the
case.  In short the crt1.o and crti.o have moved locations between
Debian Squeeze and Debian Wheezy.

We could simply copy crt1.o and crti.o into where ever we installed gm2
and simplify everything.  This might be the most sensible solution (and
one which the Debian gm2 package does in its post-install script).
However the solution here uses LIBRARY_PATH instead.

Secondly here are the example test modules:

$ ls
gm2.exp  imports2.mod  imports.mod

$ pwd
/home/gaius/GM2/graft-4.1.2/gcc-4.1.2/gcc/testsuite/gm2/pimcoroutines/pass

which are now part of the regression testsuite.

$ cat imports.mod
MODULE imports ;

FROM SYSTEM IMPORT CARDINAL32 ;

VAR
   c: CARDINAL32 ;
BEGIN
   c := 0
END imports.

$ cat imports2.mod
MODULE imports2 ;

FROM SYSTEM IMPORT TRANSFER, NEWPROCESS, IOTRANSFER, ADDRESS, ADR ;

BEGIN

END imports2.

Just for sanity let us see gm2 fail to find crt1.o and crti.o when we
compile and link.

$ unset LIBRARY_PATH

$ gm2  -fsources -fpim -flibs=pim-coroutine,pim,iso -g imports.mod 
Compiling: imports.mod
   Module SYSTEM               : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim-coroutine/SYSTEM.def
   Module M2RTS                : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim/M2RTS.def
   Module RTExceptions         : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim/RTExceptions.def
   Module imports              : imports.mod
   Module COROUTINES           : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim/COROUTINES.def
Pass 2
Pass C
Pass 3
Pass 4
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status

So we see that it did compile, but failed to link.  I've included the
libraries pim-coroutine and pim and iso in that order - to satisfy
dependencies.  But the compiler cannot find crt1.o or crti.o.

So now we explicitly set LIBRARY_PATH to include the gm2 and gcc
library directories.

$ export 
LIBRARY_PATH=/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim-coroutine/:/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim/:/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/iso/:/usr/lib/x86_64-linux-gnu

And try again:

$ gm2  -fsources -fpim -flibs=pim-coroutine,pim,iso -g imports.mod -lpth
Compiling: imports.mod
   Module SYSTEM               : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim-coroutine//SYSTEM.def
   Module M2RTS                : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim//M2RTS.def
   Module RTExceptions         : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim//RTExceptions.def
   Module imports              : imports.mod
   Module COROUTINES           : 
/home/gaius/opt-test/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/gm2/pim//COROUTINES.def
Pass 2
Pass C
Pass 3
Pass 4

and this time without -fsources for a silent compile.

$ gm2 -fpim -flibs=pim-coroutine,pim,iso -g imports.mod -lpth
$ ls
a.out gm2.exp  imports2.mod  imports_m2.cpp  imports.mod
$ ./a.out 
$ ls -ltr
total 372
-rw-r--r-- 1 gaius gaius    876 Dec  6 14:35 imports.mod
-rw-r--r-- 1 gaius gaius    882 Dec  6 14:36 imports2.mod
-rw-r--r-- 1 gaius gaius   1339 Dec  6 14:47 gm2.exp
-rw-r--r-- 1 gaius gaius   4521 Dec  7 16:41 imports_m2.cpp
-rwxr-xr-x 1 gaius gaius 340974 Dec  7 16:41 a.out

$ gm2  -fpim -flibs=pim-coroutine,pim,iso -g imports2.mod -lpth
$ ./a.out
$ ls -ltr
total 384
-rw-r--r-- 1 gaius gaius    876 Dec  6 14:35 imports.mod
-rw-r--r-- 1 gaius gaius    882 Dec  6 14:36 imports2.mod
-rw-r--r-- 1 gaius gaius   1339 Dec  6 14:47 gm2.exp
-rw-r--r-- 1 gaius gaius   4521 Dec  7 16:41 imports_m2.cpp
-rw-r--r-- 1 gaius gaius   4525 Dec  7 16:41 imports2_m2.cpp
-rwxr-xr-x 1 gaius gaius 340928 Dec  7 16:41 a.out

anyway hope this helps,

regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]