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

Segmentation fault when running compiled Terra executable on Linux #682

Closed
alliby opened this issue Jan 4, 2025 · 5 comments
Closed

Segmentation fault when running compiled Terra executable on Linux #682

alliby opened this issue Jan 4, 2025 · 5 comments

Comments

@alliby
Copy link

alliby commented Jan 4, 2025

I try to compile terra in my linux machine and get segmentation fault when running the compiled terra executable.

built it both with the latest 18.1.7 pre-built llvm binaries from "https://github.com/terralang/llvm-build" and with my system llvm library.
this is the sanitizer address error message:

AddressSanitizer:DEADLYSIGNAL
=================================================================
==11642==ERROR: AddressSanitizer: SEGV on unknown address 0x000100000005 (pc 0x5565bfc6de93 bp 0x7fff8248f170 sp 0x7fff8248eec0 T0)
==11642==The signal is caused by a READ memory access.
    #0 0x5565bfc6de93 in llvm::RegisterTargetMachine<llvm::X86TargetMachine>::Allocator(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool) (/home/alliby/Repos/terra/install/bin/terra+0x5312e93) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #1 0x5565bbaf19cc in llvm::Target::createTargetMachine(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool) const (/home/alliby/Repos/terra/install/bin/terra+0x11969cc) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #2 0x5565bbad33f1 in terra_inittarget(lua_State*) (/home/alliby/Repos/terra/install/bin/terra+0x11783f1) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #3 0x5565c1e27955 in lj_BC_FUNCC (/home/alliby/Repos/terra/install/bin/terra+0x74cc955) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #4 0x5565c1dd5a0d in lua_pcall (/home/alliby/Repos/terra/install/bin/terra+0x747aa0d) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #5 0x5565bbda5a94 in terra_initwithoptions (/home/alliby/Repos/terra/install/bin/terra+0x144aa94) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #6 0x5565bbacc5cd in main (/home/alliby/Repos/terra/install/bin/terra+0x11715cd) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62)
    #7 0x7f724f03fc4b in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #8 0x7f724f03fd04 in __libc_start_main_impl ../csu/libc-start.c:360
    #9 0x5565bbacbfe0 in _start ../sysdeps/x86_64/start.S:115

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/home/alliby/Repos/terra/install/bin/terra+0x5312e93) (BuildId: c9f058b73b7fed98c7e2895599d19bdff6950b62) in llvm::RegisterTargetMachine<llvm::X86TargetMachine>::Allocator(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool)
==11642==ABORTING

my environment

OS: Void x86_64
Kernel: Linux 6.12.6_3
CPU: 12th Gen Intel(R) Core(TM) i5-1245U (12) @ 4.40 GHz
@elliottslaughter
Copy link
Member

What Linux distro and version are you on?

We try to make Terra maximally compatible, but cross-distro compatibility is hard and cannot be guaranteed 100%.

@alliby
Copy link
Author

alliby commented Jan 4, 2025

I'm using Void Linux with 6.12.6_3 kernel

@alliby
Copy link
Author

alliby commented Jan 4, 2025

I built Terra with both GCC 13.2.0 (with the gold linker) and clang 18.1.8 (with lld), but the same error occurred.

@elliottslaughter
Copy link
Member

By any chance can this be replicated inside Docker? Is there a Void Linux Docker image along with a handful of commands to install dependencies that you could give me?

@alliby
Copy link
Author

alliby commented Jan 4, 2025

I dont know if there is Void Linux Docker image, but Its seems similar to #678 and #357
I just tried to compile LLVM from source, and it worked without any problems.

@alliby alliby closed this as completed Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants