ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
33.44k stars 2.44k forks source link

Cann't build for armv7 with "neon" #16018

Open Dirreke opened 1 year ago

Dirreke commented 1 year ago

Zig Version

0.9.1

Steps to Reproduce and Observed Behavior

I use zig c++ -target arm-linux-gnueabihf -mcpu=generic+v7a+vfp3+d32+thumb2+neon -mfpu=neon -mfloat-abi=hard and it still cann't add neon to target-feature, and I always get this

/opt/zig/zig-linux-x86_64-0.9.1/lib/include/arm_neon.h:32:2: error: "NEON support not enabled"

Is it a bug? Or maybe I just missed some args?

Expected Behavior

//

leecannon commented 1 year ago

do you have the same issue with the latest stable zig release 0.10.1?

Dirreke commented 1 year ago

I cann't build for arm with 0.10.1 because #6573

  cargo:warning=warning(compilation): libc++ does not work on multi-threaded ARM yet.
  cargo:warning=For more details: https://github.com/ziglang/zig/issues/6573
  cargo:warning=error: unable to create compilation: TargetRequiresSingleThreaded
  exit status: 1

is there any way to build like rocksdb or Cbc with zig 0.10.1?

iacore commented 1 year ago

is there any way to build like rocksdb or Cbc with zig 0.10.1?

Can you use Clang?

andrewrk commented 1 year ago

Zig is indeed passing the neon flags to Clang, so the question is why doesn't clang define the macro?

#if !defined(__ARM_NEON)
#error "NEON support not enabled"
#else

Can you file a bug report on Clang? Use ZIG_VERBOSE_CC=1 to observe the clang command that zig spits out (which includes -Xclang +neon) and ask them why __ARM_NEON is not defined.

Dirreke commented 1 year ago

I'd love to try it. However, I'm a little busy these days. I will try to find this bug some days later.

Dirreke commented 2 months ago

It issue seems very related to #10411