Skip to content

Bazel build is broken on MacOS / Clang 19.1.7 #1544

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

Open
phaedon opened this issue Mar 30, 2025 · 2 comments
Open

Bazel build is broken on MacOS / Clang 19.1.7 #1544

phaedon opened this issue Mar 30, 2025 · 2 comments

Comments

@phaedon
Copy link

phaedon commented Mar 30, 2025

Steps to repro:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk/bazel
echo "7.6.0" > .bazelversion
bazel build hello-world/...

Errors:

ERROR: /Users/phaedon/git/emsdk/bazel/hello-world/BUILD:9:10: Compiling hello-world/hello-world-simd.cc failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //hello-world:hello-world-simd) external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 29 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from hello-world/hello-world-simd.cc:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:932:10: error: use of undeclared identifier '__builtin_wasm_any_true_v128'
  932 |   return __builtin_wasm_any_true_v128((__i8x16)__a);
      |          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:938:18: error: use of undeclared identifier '__builtin_wasm_bitselect'
  938 |   return (v128_t)__builtin_wasm_bitselect((__i32x4)__a, (__i32x4)__b,
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:943:18: error: use of undeclared identifier '__builtin_wasm_abs_i8x16'
  943 |   return (v128_t)__builtin_wasm_abs_i8x16((__i8x16)__a);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:951:10: error: use of undeclared identifier '__builtin_wasm_all_true_i8x16'
  951 |   return __builtin_wasm_all_true_i8x16((__i8x16)__a);
      |          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:955:10: error: use of undeclared identifier '__builtin_wasm_bitmask_i8x16'
  955 |   return __builtin_wasm_bitmask_i8x16((__i8x16)__a);
      |          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:959:18: error: use of undeclared identifier '__builtin_wasm_popcnt_i8x16'
  959 |   return (v128_t)__builtin_wasm_popcnt_i8x16((__i8x16)__a);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:984:18: error: use of undeclared identifier '__builtin_wasm_add_sat_s_i8x16'
  984 |   return (v128_t)__builtin_wasm_add_sat_s_i8x16((__i8x16)__a, (__i8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:989:18: error: use of undeclared identifier '__builtin_wasm_add_sat_u_i8x16'
  989 |   return (v128_t)__builtin_wasm_add_sat_u_i8x16((__u8x16)__a, (__u8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:999:18: error: use of undeclared identifier '__builtin_wasm_sub_sat_s_i8x16'
  999 |   return (v128_t)__builtin_wasm_sub_sat_s_i8x16((__i8x16)__a, (__i8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1004:18: error: use of undeclared identifier '__builtin_wasm_sub_sat_u_i8x16'
 1004 |   return (v128_t)__builtin_wasm_sub_sat_u_i8x16((__u8x16)__a, (__u8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1009:18: error: use of undeclared identifier '__builtin_wasm_min_s_i8x16'
 1009 |   return (v128_t)__builtin_wasm_min_s_i8x16((__i8x16)__a, (__i8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1014:18: error: use of undeclared identifier '__builtin_wasm_min_u_i8x16'
 1014 |   return (v128_t)__builtin_wasm_min_u_i8x16((__u8x16)__a, (__u8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1019:18: error: use of undeclared identifier '__builtin_wasm_max_s_i8x16'
 1019 |   return (v128_t)__builtin_wasm_max_s_i8x16((__i8x16)__a, (__i8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1024:18: error: use of undeclared identifier '__builtin_wasm_max_u_i8x16'
 1024 |   return (v128_t)__builtin_wasm_max_u_i8x16((__u8x16)__a, (__u8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1029:18: error: use of undeclared identifier '__builtin_wasm_avgr_u_i8x16'
 1029 |   return (v128_t)__builtin_wasm_avgr_u_i8x16((__u8x16)__a, (__u8x16)__b);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1033:18: error: use of undeclared identifier '__builtin_wasm_abs_i16x8'
 1033 |   return (v128_t)__builtin_wasm_abs_i16x8((__i16x8)__a);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1041:10: error: use of undeclared identifier '__builtin_wasm_all_true_i16x8'
 1041 |   return __builtin_wasm_all_true_i16x8((__i16x8)__a);
      |          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1045:10: error: use of undeclared identifier '__builtin_wasm_bitmask_i16x8'
 1045 |   return __builtin_wasm_bitmask_i16x8((__i16x8)__a);
      |          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include/wasm_simd128.h:1070:18: error: use of undeclared identifier '__builtin_wasm_add_sat_s_i16x8'
 1070 |   return (v128_t)__builtin_wasm_add_sat_s_i16x8((__i16x8)__a, (__i16x8)__b);
      |                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
@phaedon
Copy link
Author

phaedon commented Mar 31, 2025

Verifying that this also fails on Ubuntu/GCC:

ERROR: /home/fjsinis/github/emsdk/bazel/hello-world/BUILD:9:10: Compiling hello-world/hello-world-simd.cc failed: (Exit 1): gcc failed: error executing CppCompile command (from target //hello-world:hello-world-simd) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++14' -MD -MF ... (remaining 24 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
hello-world/hello-world-simd.cc:1:10: fatal error: wasm_simd128.h: No such file or directory
    1 | #include <wasm_simd128.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

@sbc100
Copy link
Collaborator

sbc100 commented Mar 31, 2025

It looks like you are trying to build stuff with the host macOS toolchain somehow. At least the location of failing header file suggest a local clang 16 (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include).

emsdk is a cross compiler so the host toolchains and headers should never be used. So something must not be configured correctly here.

Can you try just building the wasm_cc_binaries targets? e.g.bazel build //hello-world:hello-world-wasm

I don't think the default cc_binary targets in bazel/hello-world/BUILD are supposed to be buildable except with the emscripten toolchain. I think in the past they could be built with --config=wasm.. but I'm not sure that works these days? @walkingeyerobot ?

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