gm2
[Top][All Lists]
Advanced

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

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,

$ gm2 -I/home/schol-r-lea/Deployments/gm2/gcc/gcc/m2/gm2-libs -c Hello.mod

producing Hello.o, but when I tired to link the object file, it again was unable to link the standard libraries. I have the library path set as such:

LD_LIBRARY_PATH=/lib:/home/schol-r-lea/opt/lib:/home/schol-r-lea/opt/lib64

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:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash -e

GM2_DIR="$HOME/Deployments/gm2"
GCC_SRC="$GM2_DIR/gcc"
GCC_BUILD="$GCC_SRC/build"
DEST="$HOME/opt"
LIBDIR="$DEST/lib"

TARGET="x86_64-pc-linux-gnu"

cd $GCC_SRC

cd $GCC_BUILD

TARGET_DIR="$GCC_BUILD/$TARGET"
if [ ! -d $TARGET_DIR ]; then
   mkdir -p $TARGET_DIR
fi

cd $TARGET_DIR

$GCC_SRC/configure --host=$TARGET \
                   --target=$TARGET \
                   --prefix=$DEST     \
                   --bindir=$DEST/bin \
                   --libdir=$LIBDIR \
                   --libexecdir=$LIBDIR \
                   --enable-threads=posix \
                   --enable-clocale=gnu \
                   --disable-multilib \
                   --disable-bootstrap \
                   --enable-checking \
                   --enable-languages="m2"

make all-gcc
make all-target-libgcc
make all-target-libgm2
make install-strip-gcc install-target-libgcc
make check-m2 -j 4

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am certain that I am making a simple error in this but I can't seem to determine what it is.


reply via email to

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