Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Strange problem on AMD64-current building latest zig



Hi,

I have been following the development of zig for some time now,
building the latest versions under NetBSD-current, both amd64 and
aarch64. As the latest development versions require the latest llvm,
at present minimum 19.0, I used to build llvm (clang, lld and lldb)
off-pkgsrc tree as per the instructions in the zig wiki page. This
used to work fine on both architectures up until approx. zig 0.14
0-dev.1940; Since then, about a week ago, it stopped building for me
under amd64, whereas it continues to build just fine under aarch64. To
minimize the differences, I got rid of my own llvm builds on both
platforms, after having seen that llvm 19.1.2 was imported into wip,
and rebuilt it on both platforms. I also reinstalled -current on both,
using exactly the same cvs tree.

I now have on aarch64:
...
$ uname -a
NetBSD ci4o2 10.99.12 NetBSD 10.99.12 (GENERIC64) #0: Sat Oct 26
01:16:53 BST 2024
root%ym1r.lorien.lan@localhost:/bd/sysbuild/evbarm64/obj/home/sysbuild/src/sys/arch/evbarm/compile/GENERIC64
evbarm
$ clang --version
clang version 19.1.2 (git://wip.pkgsrc.org/pkgsrc-wip.git
13dd3f5a03826db85228882a701bf76f40f114ea)
Target: aarch64-unknown-netbsd10.99
Thread model: posix
InstalledDir: /usr/pkg/bin
$ zig version
0.14.0-dev.2052+6a364b4a5
....

On amd64, the second compiler stage consistently crashes the same way
(I tried it on different machines with the same result):

Core was generated by `zig2'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000000007af07a in
codegen_llvm_Builder_Global_Index_getReplacement__13852 ()
[Current thread is 1 (process 20655)]
(gdb) bt
#0  0x00000000007af07a in
codegen_llvm_Builder_Global_Index_getReplacement__13852 ()
#1  0x000000000078c9e4 in codegen_llvm_Builder_Global_Index_unwrap__13828 ()
#2  0x0000000000b7cc8d in codegen_llvm_Builder_Global_Index_name__13832 ()
#3  0x0000000000d4e4d8 in
codegen_llvm_Builder_Global_Index_renameAssumeCapacity__13849 ()
#4  0x0000000000930033 in codegen_llvm_Builder_Global_Index_rename__13844 ()
#5  0x00000000009566d1 in codegen_llvm_Object_updateExportedGlobal__10749 ()
#6  0x00000000007241df in codegen_llvm_Object_updateExports__10747 ()
#7  0x0000000000944ca5 in link_Elf_updateExports__3867 ()
#8  0x0000000000723409 in link_File_updateExports__3785 ()
#9  0x00000000005b48e9 in Zcu_PerThread_processExportsInner__8769 ()
#10 0x00000000004bfe95 in Zcu_PerThread_processExports__8767 ()
#11 0x00000000004ce3fc in Compilation_update__4113 ()
#12 0x000000000089a795 in Compilation_updateSubCompilation__4193 ()
#13 0x00000000008e129a in Compilation_buildOutputFromZig__4194 ()
#14 0x0000000000fc7046 in Compilation_buildRt__4159 ()
#15 0x0000000000c26a76 in
Thread_WaitGroup_spawnManager__anon_103579_Manager_run__64010 ()
#16 0x000000000139aca2 in Thread_callFn__anon_289825__87192 ()
#17 0x0000000000fc6f7b in
Thread_PosixThreadImpl_spawn__anon_234578_Instance_entryFn__80559 ()
#18 0x0000707e9703d145 in ?? () from /usr/lib/libpthread.so.1
#19 0x0000707e967f5200 in ?? () from /usr/lib/libc.so.12
Backtrace stopped: Cannot access memory at address 0x707e90dfb000

I have reported this issue on zig's github account
(https://github.com/ziglang/zig/issues/21788), with no response so far
- this is not the first time I do so, usually some zig developer sorts
it quickly enough with a standard 'Debitrot *BSD'  comment...

I am posting this with the hope somebody would know some
architecture-level difference in the above and suggest some solution.
It is nice to follow zig's development and have it available on *BSD.

BTW1. I tried to follow the suggestions on zig's wiki for
bootstrapping the compiler with llvm 19 under both Open- and FreeBSD,
but this also failed. On OpenBSD I wasn't even able to build llvm
19.1.2, on FreeBSD if I were to use llvm19 from ports, it is not
capable of linking static files; whereas, if I build llvm myself, the
resulting third stage zig compiler link fails with missing symbols
from the system's libc...

BTW2. lldb build under aarch64 always fails for me, I guess this
merits a pkgsrc pr, as it fails on the released pkgsrc llvm as well,
not only the one from wip.

BTW3. When building zig succeeds, I run the basic test suite (zig
build test-behavior). It succeeds only if I remove every trace of zig
cache (~/.cache/zig/* and src/zig/.zig-cache/*); otherwise, many tests
fail because of some OS-level limit which I haven't yet been able to
find.


Chavdar





-- 
----


Home | Main Index | Thread Index | Old Index