Hi crystal community!
I tried to use --lto flag by using --lto=thin:
--lto=FLAG Use ThinLTO --lto=thin
Then I compile my code using:
crystal build src/scry.cr --stats --release --lto=thin
and I get this error:
Invalid memory access (signal 11) at address 0x8
[0x5555d12e9fb6] ???
[0x5555d0b086fa] __crystal_sigfault_handler +42
[0x7f6a80685dd0] ???
[0x7f6a82c60c20] ???
[0x7f6a82c60cc4] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoE +52
[0x7f6a82c502b5] ???
[0x7f6a82c51f4e] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleESt8functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEPNS_18ProfileSummaryInfoE +702
[0x5555d12ed73c] LLVMWriteBitcodeWithSummaryToFile +172
[0x5555d0fd7792] ???
[0x5555d0fdbc43] ???
[0x5555d0af1b44] ???
[0x0] ???
Codegen (bc+obj): 00:00:00.119673414 ( 252.99MB)
_main.o: file not recognized: File truncated
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `clang -flto=thin -Wl,-plugin-opt,jobs=8,-plugin-opt,cache-dir=/home/main/.cache/crystal/home-main-Projects-scry-src-scry.cr/lto.cache -O2 "${@}" -o '/home/main/Projects/scry/bin/scry' -rdynamic -lpcre -lm -lgc -lpthread /usr/lib/crystal/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`
See Full logs here
I also had this issue^
Hi this is still an issue on crystal v0.25.0 :sweat_smile: (well not a high priority one, keep hard work on windows support and parallelism :muscle: )
➜ ~ crystal --version
Crystal 0.25.0 (2018-06-12)
LLVM: 6.0.0
Default target: x86_64-pc-linux-gnu
➜ ~ clang --version
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
➜ ~ crystal build --release server.cr -s --lto=thin
Parse: 00:00:00.000122359 ( 0.19MB)
Semantic (top level): 00:00:00.378373032 ( 43.75MB)
Semantic (new): 00:00:00.002288008 ( 43.75MB)
Semantic (type declarations): 00:00:00.058524775 ( 43.75MB)
Semantic (abstract def check): 00:00:00.002560378 ( 43.75MB)
Semantic (ivars initializers): 00:00:00.116991194 ( 67.75MB)
Semantic (cvars initializers): 00:00:00.134518809 ( 67.81MB)
Semantic (main): 00:00:09.942175260 ( 148.18MB)
Semantic (cleanup): 00:00:00.007456161 ( 148.18MB)
Semantic (recursive struct check): 00:00:00.001440093 ( 148.18MB)
Codegen (crystal): 00:00:00.555385152 ( 172.18MB)
Invalid memory access (signal 11) at address 0x8
...
I was able to reproduce this without any command line options which I think is expected.
(cafe:~)$ crystal build --lto=thin temp.cr
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
[0x1039031e7] *CallStack::print_backtrace:Int32 +39
[0x10300a14e] __crystal_sigfault_handler +46
[0x7fff5a328f5a] _sigtramp +26
Invalid memory access (signal 11) at address 0x8
Shall this issue be fixed as early as possible if it does help devs to cut down compiling time especially web framework.
@proyb6 thinlto only helps release build times. Devs always want non-release builds unless they're deploying (and even then I usually don't use release because better stacktraces and faster deploys are more useful than performance for most people's scale)
Yup, in that case, incremental compilations is mattered to devs most as coming from Swift Server Side world. I know there were discussions on it.
The current compiler is already as incremental as it can be for the near future.
still in 0.32.1
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
Invalid memory access (signal 11) at address 0x8
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b7f29e7] *CallStack::print_backtrace:Int32 +39
[0x10b738d2b] __crystal_sigfault_handler +491
[0x10b738d2b] __crystal_sigfault_handler +491
[0x10b738d2b] __crystal_sigfault_handler +491
[0x10b738d2b] __crystal_sigfault_handler +491
[0x10b738d2b] __crystal_sigfault_handler +491
[0x10b738d2b] __crystal_sigfault_handler +491
[0x7fff6da9342d] _sigtramp +29
[0x10b738d2b] __crystal_sigfault_handler +491
[0x7fff6da9342d] _sigtramp +29
[0x10b738d2b] __crystal_sigfault_handler +491
[0x7fff6da9342d] _sigtramp +29
[0x10b738d2b] __crystal_sigfault_handler +491
[0x7fff6da9342d] _sigtramp +29
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x7fff6da9342d] _sigtramp +29
[0x7fff6da9342d] _sigtramp +29
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x7fff6da9342d] _sigtramp +29
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x7fff6da9342d] _sigtramp +29
[0x7fff6da9342d] _sigtramp +29
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4d4559] _ZN4ll[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
vm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6[0x10b3e7ba3] ~proc3Proc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10c4d44a8] _ZN4llvm18ProfileSummaryInfo14computeSummaryEv +14
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10c4d4559] _ZN4llvm18ProfileSummaryInfo15getProfileCountEPKNS_11InstructionEPNS_18BlockFrequencyInfoEb +37
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10c4c4180] _ZN4llvm23buildModuleSummaryIndexERKNS_6[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
ModuleENSt3__18functionIFPNS_18BlockFrequencyInfoERKNS_8FunctionEEEEPNS_18ProfileSummaryInfoE +2061
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10b7f3ea0] LLVMExtWriteBitcodeWithSummaryToFile +139
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
[0x10b3e42e3] ~procProc(Nil)@src/compiler/crystal/compiler.cr:430 +611
[0x10b191353] *Fiber#run:(IO::FileDescriptor | Nil) +35
clang-9: error: no such file or directory: 'S-lice40R-adix5858N-ode40K-emal5858W-ebS-ocket4141.o'
Most helpful comment
@proyb6 thinlto only helps release build times. Devs always want non-release builds unless they're deploying (and even then I usually don't use release because better stacktraces and faster deploys are more useful than performance for most people's scale)