Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test compile failure on Linux #8

Closed
wbthomason opened this issue May 25, 2020 · 10 comments
Closed

Test compile failure on Linux #8

wbthomason opened this issue May 25, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@wbthomason
Copy link

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.

@actboy168
Copy link
Owner

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

@wbthomason
Copy link
Author

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

@wbthomason
Copy link
Author

wbthomason commented May 26, 2020

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.

@actboy168
Copy link
Owner

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

luamake rebuild -mode debug

@wbthomason
Copy link
Author

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?

@actboy168
Copy link
Owner

@wbthomason
Copy link
Author

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.

@wbthomason
Copy link
Author

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

@actboy168 actboy168 added the bug Something isn't working label Jun 4, 2020
@wbthomason
Copy link
Author

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.

@actboy168
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants