conda-forge / bazel-toolchain-feedstock

A conda-smithy repository for bazel-toolchain.
BSD 3-Clause "New" or "Revised" License
0 stars 5 forks source link

On macos-arm64 with clang-16 adding `-stdlib=libc++` causes "argument unused during compilation" #18

Open mattip opened 6 months ago

mattip commented 6 months ago

Solution to issue cannot be found in the documentation.

Issue

i am trying to use the cross-compilation to build ray in https://github.com/conda-forge/ray-packages-feedstock/pull/158. I am getting this error:

clang-16: error: argument unused during compilation: '-stdlib=libc++' [-Werror,-Wunused-command-line-argument]

I think this is coming from here?

cc @isuruf

Installed packages

not relevant

Environment info

not relevant
mattip commented 6 months ago

I tried adding various iterations on export CXXFLAGS="${CXXFLAGS} --Wno-error=unused-command-line-argument" to migtigate the error, but could not figure out the incantation to get that passed into the compiler.

mattip commented 6 months ago

This stackoverflow seems to advocate for never adding that flag on modern clang.

mattip commented 2 weeks ago

Now I see the opposite problem: it seems something is missing to make C++ work on the new macOS-13 image. Everything works with macOS-12, but when using macOS-13 I see

ERROR: /Users/runner/miniforge3/conda-bld/ray-packages_1730179613555/_build_env/share/bazel/91a566a9d6d07eb1543dee7f54a62af2/external/com_google_absl/absl/base/BUILD.bazel:60:11: Compiling absl/base/log_severity.cc [for tool] failed: (Exit 1): wrapped_clang_pp failed: error executing command (from target @com_google_absl//absl/base:log_severity) 
  (cd /Users/runner/miniforge3/conda-bld/ray-packages_1730179613555/_build_env/share/bazel/91a566a9d6d07eb1543dee7f54a62af2/sandbox/darwin-sandbox/2/execroot/com_github_ray_project_ray && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
    APPLE_SDK_VERSION_OVERRIDE=10.15 \
    PATH=/Users/runner/miniforge3/conda-bld/ray-packages_1730179613555/_build_env/bin:/Users/runner/miniforge3/conda-bld/ray-packages_1730179613555/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh/bin:/Users/runner/miniforge3/condabin:/Users/runner/miniforge3/bin:/Users/runner/miniforge3/condabin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/opt/ruby@3.0/bin:.:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools \
    XCODE_VERSION_OVERRIDE=15.2.0.15C500b \
    ZERO_AR_DATE=1 \
  external/local_config_cc/wrapped_clang_pp '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG '-DNS_BLOCK_ASSERTIONS=1' '-std=c++11' 'DEBUG_PREFIX_MAP_PWD=.' -iquote external/com_google_absl -iquote bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_absl -MD -MF bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_absl/absl/base/_objs/log_severity/log_severity.d '-DBAZEL_CURRENT_REPOSITORY="com_google_absl"' '-frandom-seed=bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_absl/absl/base/_objs/log_severity/log_severity.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks -no-canonical-prefixes -pthread -g0 -w -g0 '-std=c++17' -Wall -Wextra -Wc++98-compat-extra-semi -Wcast-qual -Wconversion -Wdeprecated-pragma -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wformat-security -Wgnu-redeclared-enum -Winfinite-recursion -Winvalid-constexpr -Wliteral-conversion -Wmissing-declarations -Woverlength-strings -Wpointer-arith -Wself-assign -Wshadow-all -Wshorten-64-to-32 -Wsign-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-zero-compare -Wundef -Wuninitialized -Wunreachable-code -Wunused-comparison -Wunused-local-typedefs -Wunused-result -Wvla -Wwrite-strings -Wno-float-conversion -Wno-implicit-float-conversion -Wno-implicit-int-float-conversion -Wno-unknown-warning-option -DNOMINMAX -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -target x86_64-apple-macosx10.15 -c external/com_google_absl/absl/base/log_severity.cc -o bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/com_google_absl/absl/base/_objs/log_severity/log_severity.o)
# Configuration: 71978da1aef7948acbe240f134a7eeddfaf5176385f8c0c3efc808783bcf60f8
# Execution platform: @local_config_platform//:host

In file included from external/com_google_absl/absl/base/log_severity.cc:15:
external/com_google_absl/absl/base/log_severity.h:18:10: fatal error: 'array' file not found
#include <array>
h-vetinari commented 2 weeks ago

Now I see the opposite problem

Does the original problem still occur if you leave -stdlib=libc++ untouched?

mattip commented 2 weeks ago

It would be good if we could figure out a minimal reproducer for the problem. Rebuilding ray for this is quite heavy. The problem appears early in the build process.