davidgiven / ack

The Amsterdam Compiler Kit
http://tack.sf.net
Other
416 stars 59 forks source link

Build error "lua: ./h/em_table_lib.lua:38: malformed pseudo line in em_table", on Ubuntu 22.04 + Lua 5.1.5, & segfault on Ubuntu 22.04 + Lua 5.2.4 #262

Closed tkchia closed 1 year ago

tkchia commented 1 year ago

Hello @davidgiven,

I am getting a fatal error trying to build ACK on Ubuntu 22.04 LTS with Lua 5.1.5:

$ make BUILDDIR="..." PREFIX='$(INSDIR)'
...
[25/10116] lua modules/src/em_code/mak.../src/em_code/em_code_ek_h/em_codeEK.h 
FAILED: .../obj/modules/src/em_code/em_code_ek_h/em_codeEK.h 
lua modules/src/em_code/make_codeek_h.lua < h/em_table > .../obj/modules/src/em_code/em_code_ek_h/em_codeEK.h && cat modules/src/em_code/em.nogen >> .../obj/modules/src/em_code/em_code_ek_h/em_codeEK.h 
lua: ./h/em_table_lib.lua:38: malformed pseudo line in em_table
stack traceback:
    [C]: in function 'error'
    ./h/em_table_lib.lua:38: in function 'load_table'
    modules/src/em_code/make_codeek_h.lua:3: in main chunk
    [C]: ?
[26/10116] lua modules/src/em_data/mak...dules/src/em_data/em_flag_c/em_flag.c 
FAILED: .../obj/modules/src/em_data/em_flag_c/em_flag.c 
lua modules/src/em_data/make_flag_c.lua < h/em_table > .../obj/modules/src/em_data/em_flag_c/em_flag.c 
lua: ./h/em_table_lib.lua:38: malformed pseudo line in em_table
stack traceback:
    [C]: in function 'error'
    ./h/em_table_lib.lua:38: in function 'load_table'
    modules/src/em_data/make_flag_c.lua:3: in main chunk
    [C]: ?
...
$ lua -v
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

The error seems to be caused by the lines

        local _, _, name, num, flags = line:find("^(%w+)%s+(%d+)%s+(%g+)$")
        if not name then
            error("malformed pseudo line in em_table")
        end

in h/em_table_lib.lua while trying to parse

bss 0   nvt

in h/em_table.

Thank you!

tkchia commented 1 year ago

Hello @davidgiven,

It seems that Lua 5.1 does not support the %g character class that h/em_table_lib.lua uses (though Lua 5.2 and above does support it).

Incidentally, the build (mostly) succeeds if I upgrade to Lua 5.2.4 or Lua 5.4.4, though it now crashes further down:

[4051/10116] ACKDIR=.../obj/lang/m2/include/headers -O6 
FAILED: .../obj/lang/m2/libm2/lib_cpm/Storage/Storage.o 
ACKDIR=.../staging .../staging/bin/ack -mcpm -c.o -o .../obj/lang/m2/libm2/lib_cpm/Storage/Storage.o lang/m2/libm2/Storage.mod -I.../obj/h/emheaders -I.../obj/lang/m2/include/headers -O6 
Segmentation fault (core dumped)
[4056/10116] ACKDIR=.../obj/lang/m2/include/headers -O6 
ninja: build stopped: subcommand failed.

Thank you!

davidgiven commented 1 year ago

I've fixed the Lua 5.1 issue in #265. Thanks very much for figuring it out.

tkchia commented 1 year ago

Thanks @davidgiven !