[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem(s) with cross-compiler
From: |
Gaius Mulley |
Subject: |
Re: Problem(s) with cross-compiler |
Date: |
Tue, 12 Dec 2023 19:44:21 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Philip Munts <phil@munts.net> writes:
> I have built GCC 13.2.0 cross-toolchains, including GM2, with the recent
> Crosstool-NG release 1.26.0, on Debian 12 (Bookworm):
>
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/aarch64-muntsos-linux-gnu-gm2
> --version
> aarch64-muntsos-linux-gnu-gm2 (crosstool-NG 1.26.0) 13.2.0
>
> The following test program compiles and run successfully with the Debian 12
> native compiler:
>
> MODULE test_hello;
>
> FROM STextIO IMPORT WriteString, WriteLn;
>
> BEGIN
> WriteLn;
> WriteString("Hello, World!");
> WriteLn;
> WriteLn;
> END test_hello.
>
> gm2 --version
> gm2 (Debian 10.2.1-6) 10.2.1 20210110
>
> gm2 -fiso -fsoft-check-all -Wpedantic -otest_hello test_hello.mod
> ./test_hello
>
> Hello, World!
>
> But when I try to compile the same program with the cross-compiler I get the
> following errors and warnings:
>
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/aarch64-muntsos-linux-gnu-gm2
> -fiso -fsoft-check-all -Wpedantic -otest_hello test_hello.mod
> cc1gm2: warning: command-line option '-isysroot
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../aarch64-muntsos-linux-gnu/libc'
> is valid for C/C++/D/Fortran/ObjC/ObjC++ but not for Modula-2
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/SYSTEM.mod:31:1:
> error: In implementation module 'SYSTEM': symbol (memcpy) has already been
> imported
> 31 | CONST
> | ^~~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/M2RTS.mod:35:1:
> error: In implementation module 'M2RTS': symbol (ADDRESS) has already
> been imported
> 35 | FROM ASCII IMPORT nl, nul ;
> | ^~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/TextIO.mod:31:1:
> error: In implementation module 'TextIO': symbol (IOChan) has already
> been imported
> 31 | FROM SYSTEM IMPORT ADR ;
> | ^~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/IOChan.mod:32:1:
> error: In implementation module 'IOChan': symbol (IOConsts) has
> already been imported
> 32 | FROM EXCEPTIONS IMPORT ExceptionSource, RAISE, AllocateSource,
> | ^~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/IOLink.mod:31:1:
> error: In implementation module 'IOLink': symbol (SYSTEM) has already
> been imported
> 31 | FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
> | ^~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/IOLink.mod:31:1:
> error: symbol (IOChan) has already been imported
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/RTfio.mod:30:1:
> error: In implementation module 'RTfio': symbol (DeviceTablePtr) has
> already been imported
> 30 | FROM RTio IMPORT GetFile ;
> | ^~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/RTgen.mod:35:1:
> error: In implementation module 'RTgen': symbol (DeviceTablePtr) has
> already been imported
> 35 | IMPORT ChanConsts ;
> | ^~~~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/RTgen.mod:46:1:
> error: symbol (doWBytes) has already been imported
> 46 | FROM ChanConsts IMPORT FlagSet, readFlag, writeFlag, rawFlag,
> | ^~~~
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/RTgen.mod:46:1:
> error: symbol (GenDevIF) has already been imported
> /usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2pim/Indexing.mod:33:1:
> error: In implementation module 'Indexing': symbol (ADDRESS) has
> already been imported
> 33 | CONST
> | ^~~~~
>
> The warning appears to be annoying but harmless. The errors though are
> blocking.
>
> I have tried various combinations of -I, -flibs=, -fno-libs=-, and
> -fm2-whole-program to no avail.
>
> I thought maybe the cross-compiler was either compiling the native
> SYSTEM.def and SYSTEM.mod instead of the cross, or both, or mixing up
> iso and pim, or something like that. But strace only shows opening
> the proper cross SYSTEM.def and SYSTEM.mod:
>
> [pid 551] openat(AT_FDCWD, "./SYSTEM.def", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> [pid 551] openat(AT_FDCWD, "./SYSTEM.def", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> [pid 551] openat(AT_FDCWD,
> "/usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/SYSTEM.def",
> O_RDONLY) = 5
> [pid 551] openat(AT_FDCWD,
> "/usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/SYSTEM.def",
> O_RDONLY) = 5
> [pid 551] openat(AT_FDCWD, "./SYSTEM.mod", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> [pid 551] openat(AT_FDCWD, "./SYSTEM.mod", O_RDONLY) = -1 ENOENT (No such
> file or directory)
> [pid 551] openat(AT_FDCWD,
> "/usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/SYSTEM.mod",
> O_RDONLY) = 6
> [pid 551] openat(AT_FDCWD,
> "/usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/SYSTEM.mod",
> O_RDONLY) = 6
> [pid 551] openat(AT_FDCWD,
> "/usr/local/gcc-aarch64-muntsos-linux-gnu-ctng/bin/../lib/gcc/aarch64-muntsos-linux-gnu/13.2.0/m2/m2iso/SYSTEM.mod",
> O_RDONLY) = 72
>
> Then I tried comparing the native SYSTEM.def with the cross SYSTEM.def, but
> they are essentially the same except for comments.
>
> So now I'm stumped. My ARM64 cross toolchain is available online at:
> http://repo.munts.com/debian12/amd64/gcc-aarch64-muntsos-linux-gnu-ctng-13.2.0-2023.340-debian12-amd64.deb
Hi Phil,
Thanks for the bug report - now fixed in gcc git,
regards,
Gaius