linker unable to find Modula-2 standard libraries in source build
From:
Alice Osako
Subject:
linker unable to find Modula-2 standard libraries in source build
Date:
Sun, 25 Feb 2024 01:16:09 -0500
User-agent:
Mozilla Thunderbird
I am looking to use GNU
Modula-2 13.x for a project (possibly more than one), and since
the Linux distro I am using (Manjaro 23.1, the current stable
release) does not yet include a pre-built package for gm2, I am
building the compiler from source.
I am able to build the compiler FE and run the automatic test
suite with all tests passing. I had some difficulty finding where
the .def files for the standard library were, and initially, a
naive attempt to compile a test program
$ gm2 Hello.mod -o Hello
resulted in the error message
<built-in>: error: the file containing the definition module
‘SYSTEM’ cannot be found
Once I located where the .def files were in the build directory, I
was able to add those to the include path manually. This resulted
in a different error:
$ gm2 -I/home/schol-r-lea/Deployments/gm2/gcc/gcc/m2/gm2-libs
Hello.mod -o Hello
/usr/bin/ld: cannot find -lm2cor: No such file or directory
/usr/bin/ld: cannot find -lm2log: No such file or directory
/usr/bin/ld: cannot find -lm2pim: No such file or directory
/usr/bin/ld: cannot find -lm2iso: No such file or directory
collect2: error: ld returned 1 exit status
I was able to compile the test program to an object file,
I expected that the compiler build script would place the
libraries to the path I set ($HOME/opt/lib) but this does not seem
to be the case. The executable for the compiler FE is where I
expected it ($HOME/opt/bin) so I know that this aspect is correct,
but I think I am sill doing something wrong. My build script is: