vishapoberon / compiler

vishap oberon compiler
http://oberon.vishap.am
GNU General Public License v3.0
186 stars 25 forks source link

err 16 MODULE expected on Ubuntu 24.04 #103

Open overanalytcl opened 4 months ago

overanalytcl commented 4 months ago

Hello! I have been getting this weird error on Ubuntu 24.04 with any module, for instance:

(* HelloWorld.Mod *)
MODULE HelloWorld;
   IMPORT Out;
BEGIN
   Out.String("Hello World");
   Out.Ln;
END HelloWorld.
$ voc HelloWorld.Mod -m HelloWorld
HelloWorld.mod  Compiling HelloWorld.  Main program.  383 chars.
HelloWorld

   0: ELF
      ^
    pos     0  err 16  MODULE expected

Module compilation failed.

The executable still generates and works as expected, but am I doing something wrong? I am new to Oberon-2 and I don't know if it's the fault of the program or it's a bug in voc.

dcwbrown commented 4 months ago

This is about the voc command line. 'voc HelloWorld.Mod -m HelloWorld' says: first compile the file 'HelloWorld.Mod' with the option 'm', then compile the file 'HelloWorld' with no options. The file 'HelloWorld' is the binary file generated by the first compilation - a binary file in Linux's 'Executable and Linkable Format', 'ELF' for short. All ELF files begin with 'ELF', which is why voc complains that the file does not start with 'MODULE'. Sorry - a lot of explanation for why the solution is to use the command 'voc HelloWorld.Mod -m'.