Segmentation Fault Core dumped
Been hard stucking on running the follow function as binary in Linux. It can run by mojo run .mojo just fine but it just can’t be executed as a binary … and the only error I got is in the title.
EC_LV5 is 64 bytes of error correction codewords ECL_LV5 = ListInt
16 Replies
Do you have any way of putting this in gdb at the moment? We can try to tease apart where things might be falling over
what is the intended value of ecwords?
output value is correct . A list of 64 elements values from 0-929
are you able to run any of this in GDB or some other debugger?
I’ve only tested in Ubuntu terminal and vscode
Could you share the full script?
I can run the fn without any issue I couldn’t run it in binary execution form
Yeah, can in the ubuntu VM/wsl can you install
gdb
?Like ./test
I’ll try right now
Not VM not WSL Ubuntu OS
I’ll provide result in few mins
I somehow fixed it by putting var ECL_V5 from outside of the fn into inside of the fn…. Still don’t know what’s the actual reason behind
can you maybe add
-g
or something to the compiler flags?
need debug symbols to diagnoseI discovered that if a variable is outside of the fn it should be defined as alias not var in order to make the binary work. If its defined as var the script can still run with mojo run
Congrats @randomasiandude, you just advanced to level 1!
Thank you for the gdb knowledge which I didn’t know 🙂
The issue was about defining global variables/constants as var vs. as alias . In my case it needs to be defined as alias for the binary to work
As a dude from python took me a while to figure out. And still reading the variables scope thing
interesting! weird that caused a segfault though? I forget if global vars are supported yet or not
they're not currently supported and the segfault on attempting to use one is a known bug. There probably should be a warning from the lsp and a mention in the 'sharp edges' page
Very True, especially for new comers from python.