zig icon indicating copy to clipboard operation
zig copied to clipboard

Segmentation fault (core dumped)

Open deveshd020 opened this issue 2 years ago • 2 comments

Zig Version

0.11.0-dev-67709b6

Steps to Reproduce and Observed Behavior

// build failed at final stage of linking. out.txt: [ 5%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o [ 10%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm-ar.cpp.o [ 15%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang.cpp.o [ 21%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_driver.cpp.o [ 26%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1_main.cpp.o [ 31%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1as_main.cpp.o [ 36%] Linking CXX static library zigcpp/libzigcpp.a [ 36%] Built target zigcpp [ 42%] Building C object CMakeFiles/zig-wasm2c.dir/stage1/wasm2c.c.o [ 47%] Linking C executable zig-wasm2c [ 47%] Built target zig-wasm2c [ 52%] Converting /home/deveshd020/Downloads/ZIG/zig/stage1/zig1.wasm to /home/deveshd020/Downloads/ZIG/build/zig1.c [ 57%] Building C object CMakeFiles/zig1.dir/zig1.c.o [ 63%] Building C object CMakeFiles/zig1.dir/stage1/wasi.c.o [ 68%] Linking C executable zig1 [ 68%] Built target zig1 [ 73%] Running zig1.wasm to produce /home/deveshd020/Downloads/ZIG/build/zig2.c [ 78%] Running zig1.wasm to produce /home/deveshd020/Downloads/ZIG/build/compiler_rt.c [ 84%] Building C object CMakeFiles/zig2.dir/zig2.c.o [ 89%] Building C object CMakeFiles/zig2.dir/compiler_rt.c.o [ 94%] Linking CXX executable zig2 [ 94%] Built target zig2 [100%] Building stage3 CMakeFiles/stage3.dir/build.make:72: recipe for target 'stage3/bin/zig' failed CMakeFiles/Makefile2:195: recipe for target 'CMakeFiles/stage3.dir/all' failed Makefile:135: recipe for target 'all' failed

err.txt

/home/deveshd020/Downloads/ZIG/build/zig2.c: In function ‘unicode_utf8ToUtf16Le__97230’: /home/deveshd020/Downloads/ZIG/build/zig2.c:3379292: warning: assignment to ‘const uint16_t ()[16]’ {aka ‘const short unsigned int ()[16]’} from incompatible pointer type ‘const uint16_t *’ {aka ‘const short unsigned int *’} [-Wincompatible-pointer-types] 3379292 | t26 = t25.ptr; | /home/deveshd020/Downloads/ZIG/build/zig2.c: In function ‘value_Value_readFromMemory__22950’: /home/deveshd020/Downloads/ZIG/build/zig2.c:1493823: warning: ‘memcpy’ reading 16 bytes from a region of size 10 [-Wstringop-overread] 1493823 | memcpy(&t47, &t46, sizeof(zig_u128)); | /home/deveshd020/Downloads/ZIG/build/zig2.c:1493682: note: source object ‘t46’ of size 10 1493682 | uint8_t t46[10]; | /home/deveshd020/Downloads/ZIG/build/zig2.c: In function ‘mem_readPackedIntLittle__anon_222276__222276’: /home/deveshd020/Downloads/ZIG/build/zig2.c:2745134: warning: ‘memcpy’ reading 16 bytes from a region of size 10 [-Wstringop-overread] 2745134 | memcpy(&t11, &t10, sizeof(zig_u128)); | /home/deveshd020/Downloads/ZIG/build/zig2.c:2745111: note: source object ‘t10’ of size 10 2745111 | uint8_t t10[10]; | /home/deveshd020/Downloads/ZIG/build/zig2.c: In function ‘mem_readPackedIntBig__anon_222277__222277’: /home/deveshd020/Downloads/ZIG/build/zig2.c:2745208: warning: ‘memcpy’ reading 16 bytes from a region of size 10 [-Wstringop-overread] 2745208 | memcpy(&t13, &t12, sizeof(zig_u128)); | /home/deveshd020/Downloads/ZIG/build/zig2.c:2745170: note: source object ‘t12’ of size 10 2745170 | uint8_t t12[10]; | Segmentation fault (core dumped) make[2]: *** [stage3/bin/zig] Error 139 make[1]: *** [CMakeFiles/stage3.dir/all] Error 2 make: *** [all] Error 2

Expected Behavior

build failed with warnings, Segmentation fault, some compatible issue , type not aligned.

deveshd020 avatar Dec 29 '23 07:12 deveshd020

The warnings are expected. Do you get this issue with the current master commit?

RossComputerGuy avatar Feb 01 '24 05:02 RossComputerGuy

I'm getting a similar build error on make install :

[ 36%] Built target zigcpp
[ 47%] Built target zig-wasm2c
[ 68%] Built target zig1
[ 94%] Built target zig2
[100%] Building stage3
Segmentation fault
make[2]: *** [CMakeFiles/stage3.dir/build.make:73: stage3/bin/zig] Error 139
make[1]: *** [CMakeFiles/Makefile2:196: CMakeFiles/stage3.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

when I try for example whereis zig or which zig, I see that zig isn't properly installed. Any ideas on how to resolve this?

achenet avatar Aug 04 '24 10:08 achenet

This bug report does not contain Steps To Reproduce.

andrewrk avatar Aug 12 '24 07:08 andrewrk