Skip to content
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

Zig selects musl toolchain by default on riscv64 #15368

Open
hack3ric opened this issue Apr 20, 2023 · 1 comment
Open

Zig selects musl toolchain by default on riscv64 #15368

hack3ric opened this issue Apr 20, 2023 · 1 comment
Labels
arch-riscv RISCV-32 and RISCV-64 bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@hack3ric
Copy link

hack3ric commented Apr 20, 2023

Zig Version

0.10.1

Steps to Reproduce and Observed Behavior

I am packaging Zig on Arch Linux riscv64. Since there's no LLVM 16 in Arch right now, we have to stick to v0.10.1.

On x86_64 the build script works just fine and produces x86_64-linux-gnu Zig. On riscv64 I switched CC and CXX to clang (since GCC segfaults/overflows, seems to relate to #3275), and it complains about redeclaration from musl:

[100%] Building stage3
error(compilation): clang failed with stderr: In file included from /build/zig/src/zig-0.10.1/lib/libcxx/src/strstream.cpp:15:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/strstream:134:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/istream:165:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/ostream:169:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/ios:221:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/__locale:44:
/build/zig/src/zig-0.10.1/lib/libcxx/include/__support/musl/xlocale.h:27:8: error: cannot add 'abi_tag' attribute in a redeclaration
/build/zig/src/zig-0.10.1/lib/libcxx/include/__config:634:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
/usr/include/stdlib.h:285:22: note: previous declaration is here
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/src/strstream.cpp:15:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/strstream:134:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/istream:165:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/ostream:169:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/ios:221:
In file included from /build/zig/src/zig-0.10.1/lib/libcxx/include/__locale:44:
/build/zig/src/zig-0.10.1/lib/libcxx/include/__support/musl/xlocale.h:32:8: error: cannot add 'abi_tag' attribute in a redeclaration
/build/zig/src/zig-0.10.1/lib/libcxx/include/__config:634:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
/usr/include/stdlib.h:291:31: note: previous declaration is here
...

When I specified -DZIG_TARGET_TRIPLE=native-native-gnu, CMake complains about missing Clang:

-- Configuring zig version 0.10.1
-- Could NOT find clang (missing: CLANG_LIBRARIES) (Required is at least version "15")
-- Configuring done (0.5s)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LLVM_LLVMAARCH64ASMPARSER_LIB
    linked by target "zigcpp" in directory /home/hacker/archrv/zig/repos/community-x86_64/src/zig-0.10.1
LLVM_LLVMAARCH64CODEGEN_LIB
    linked by target "zigcpp" in directory /home/hacker/archrv/zig/repos/community-x86_64/src/zig-0.10.1
LLVM_LLVMAARCH64DESC_LIB
    linked by target "zigcpp" in directory /home/hacker/archrv/zig/repos/community-x86_64/src/zig-0.10.1
LLVM_LLVMAARCH64DISASSEMBLER_LIB
    linked by target "zigcpp" in directory /home/hacker/archrv/zig/repos/community-x86_64/src/zig-0.10.1
...

Expected Behavior

Use riscv64-linux-gnu toolchain on riscv64 by default (?), or have a way to correctly specify it

@hack3ric hack3ric added the bug Observed behavior contradicts documented or intended behavior label Apr 20, 2023
@kassane
Copy link
Contributor

kassane commented Apr 25, 2023

Ref: ziglang/zig-bootstrap#115


Edit

Zig 0.10.x use LLVM 15, not 16 (master only)

@andrewrk andrewrk added the arch-riscv RISCV-32 and RISCV-64 label Jul 23, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv RISCV-32 and RISCV-64 bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants