actboy168/bee.lua

Test compile failure on Linux

wbthomason opened this issue · 10 comments

Related to LuaLS/lua-language-server#160,

build $builddir/_/test: command | $bin/bootstrap $builddir/_/copy_script $
causes a build failure. Removing this target from linux.ninja allows the build to succeed.

It seems that a test caused the crash. You can use this to see which test caused the crash.

build/linux/bin/bootstrap test/test.lua -v

I get the following output:

❯ build/linux/bin/bootstrap test/test.lua -v
OS:       	Linux
Arch:     	64
Compiler: 	GCC 10.1.0
CRT:      	libstdc++ 20200507
DEBUG:    	false
Started on Tue May 26 10:45:53 2020
    test_fs.test_absolute ... Ok
    test_fs.test_absolute_relative ... Ok
    test_fs.test_add_remove_permissions ... Ok
    test_fs.test_concat ... Ok
    test_fs.test_copy_file ... zsh: bus error (core dumped)  build/linux/bin/bootstrap test/test.lua -v

Upon further investigation, the culprit seems to be os.clock() as used here:

create_file('temp2.txt', tostring(os.clock()))

It seems strange that a built-in would cause a crash, though? Calling os.clock() or tostring(os.clock()) in a Lua 5.3 REPL works as expected, but adding print(tostring(os.clock())) in that test function reliably causes the crash.

You can compile a debug version and use gdb to see what happened.

luamake rebuild -mode debug

Sorry, but I'm having a bit of difficulty with this. I don't see a luamake binary in the repo - where should this come from?

Hmm. When I do luamake rebuild -mode debug and then gdb --args build/linux/bin/bootstrap test/test.lua and run (inside gdb), I cannot replicate the test failure.

It seems that this failure only occurs when luamake is built in release mode.

That is, when I run luamake rebuild -mode debug all 85 tests pass correctly, whereas when I run luamake rebuild -mode release I get this build error.

When I use gdb on the release build, even though I don't get debug symbols, it appears that the error is caused by receiving SIGBUS while in snprintf in libc.

My system glibc version is 2.31-5

Is there any update on this issue? I am still having the build failure; I'm happy to do more to try and track down the cause, but I'm not sure what would help at this point.

I think this is a bug of gcc, you can reduce the optimization level to avoid it.e.g. -optimize size or -optimize off