Skip to content

Zig 0.9.1 - build error on riscv64 #12432

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

Closed
kassane opened this issue Aug 12, 2022 · 3 comments
Closed

Zig 0.9.1 - build error on riscv64 #12432

kassane opened this issue Aug 12, 2022 · 3 comments

Comments

@kassane
Copy link
Contributor

kassane commented Aug 12, 2022

I'm testing on the single board D1 Nezha.

OS: Archlinux
Arch: rv64imacdfvx
Zig version: 0.9.1 (Unfortunately there is no master for riscv)

Code

pub fn main() void{
  // Test
}

Output

$> zig run -O ReleaseFast main.zig -fno-sanitize-c -target riscv64-linux -mcpu=baseline_rv64 -lc
Compile C Objects [375/1342] vfscanf.c... error(compilation): clang failed with stderr: zig: error: clang frontend command failed with exit code 132 (use -v to see invocation)
clang version 13.0.1 ([email protected]:ziglang/zig-bootstrap.git 81f0e6c5b902ead84753490db4f0007d08df964a)
Target: riscv64-unknown-linux-musl
Thread model: posix
InstalledDir: /home/sipeed
zig: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
zig: note: diagnostic msg: /tmp/vfprintf-93ac6e.c
zig: note: diagnostic msg: /tmp/vfprintf-93ac6e.sh
zig: note: diagnostic msg: 

********************
@nektro
Copy link
Contributor

nektro commented Aug 12, 2022

please include contents of /tmp/vfprintf-93ac6e.c and /tmp/vfprintf-93ac6e.sh

@kassane
Copy link
Contributor Author

kassane commented Aug 12, 2022

please include contents of /tmp/vfprintf-93ac6e.c and /tmp/vfprintf-93ac6e.sh

No longer have access to the temporary files after crashing the board.
I restarted the board (single core - 1 GB RAM DDR3) and deleted the zig cache files (zig-cache & ~/.cache/zig).
After a few minutes compiling... it happens:

/home/sipeed/.cache/zig/o/3a99b9ec4fd42048e073efa3a1e2d4d2/main: error while loading shared libraries: /usr/lib/libc.so: invalid ELF header

$> file /lib/libc.so.6
/lib/libc.so.6: ELF 64-bit LSB shared object, UCB RISC-V, RVC, double-float ABI, version 1 (GNU/Linux), dynamically linked, interpreter /usr/lib/ld-linux-riscv64-lp64d.so.1, BuildID[sha1]=205dbd70ceebe8d2813f19dfa3560423184189b8, for GNU/Linux 4.15.0, stripped

$> ldd --version      
ldd (GNU libc) 2.36
Copyright (C) 2022 Free Software Foundation, Inc.

but works with musl! And without linking the glibc it worked.

Note: Building any application on this board is a fairly exhaustive. Eternal loading... LLVM Emit Object...

--- edit

When it comes to build time the improvement a little faster with -fno-stage1.

@kassane
Copy link
Contributor Author

kassane commented Aug 13, 2022

I will close this topic!

Because regardless of the toolchain there must have been some instability of the device that caused some problem during compilation.
I will only keep mentioned another topic involving the same single board. In which it is used cross-compiled on the computer using the zig nightly version.

@kassane kassane closed this as completed Aug 13, 2022
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