Skip to content

[C++] Compiling failed on Mac M1 #14779

Closed

Description

@vibhatha

Describe the bug, including details regarding any error messages, version, and platform.

I am getting the following error while compiling Arrow C++.

8 warnings generated.
[537/632] Linking CXX executable debug/arrow-utility-test
FAILED: debug/arrow-utility-test 
: && /Users/vibhatha/tools/arrow/lint/clang+llvm-14.0.0-x86_64-apple-darwin/bin/clang++ -fno-aligned-new  -Qunused-arguments -fcolor-diagnostics -ggdb -O0  -Wall -Wextra -Wdocumentation -Wshorten-64-to-32 -Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand -Wno-return-stack-address -Werror -Wno-unknown-warning-option -Wno-pass-failed -march=armv8-a  -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -mmacosx-version-min=12.0 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/homebrew/opt/bison/lib src/arrow/util/CMakeFiles/arrow-utility-test.dir/align_util_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/atfork_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/byte_size_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/cache_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/checked_cast_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/compression_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/decimal_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/formatting_util_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/key_value_metadata_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/hashing_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/int_util_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/io_util_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/iterator_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/logging_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/queue_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/range_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/reflection_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/small_vector_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/stl_util_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/string_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/tdigest_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/test_common.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/time_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/tracing_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/trie_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/uri_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/utf8_util_test.cc.o src/arrow/util/CMakeFiles/arrow-utility-test.dir/value_parsing_test.cc.o -o debug/arrow-utility-test  -Wl,-rpath,/Users/vibhatha/github/fork/arrow/cpp/build/debug -Wl,-rpath,/opt/homebrew/lib  debug/libarrow_testing.1100.0.0.dylib  debug/libarrow.1100.0.0.dylib  /opt/homebrew/opt/openssl@1.1/lib/libcrypto.dylib  /opt/homebrew/opt/openssl@1.1/lib/libssl.dylib  /opt/homebrew/lib/libbrotlienc.dylib  /opt/homebrew/lib/libbrotlidec.dylib  /opt/homebrew/lib/libbrotlicommon.dylib  /opt/homebrew/lib/libaws-cpp-sdk-config.dylib  /opt/homebrew/lib/libaws-cpp-sdk-transfer.dylib  /opt/homebrew/lib/libaws-cpp-sdk-identity-management.dylib  /opt/homebrew/lib/libaws-cpp-sdk-cognito-identity.dylib  /opt/homebrew/lib/libaws-cpp-sdk-sts.dylib  /opt/homebrew/lib/libaws-cpp-sdk-s3.dylib  /opt/homebrew/lib/libaws-cpp-sdk-core.dylib  utf8proc_ep-install/lib/libutf8proc.a  /opt/homebrew/lib/libre2.9.0.0.dylib  googletest_ep-prefix/lib/libgtest_maind.dylib  googletest_ep-prefix/lib/libgtestd.dylib  googletest_ep-prefix/lib/libgmockd.dylib  /opt/homebrew/opt/openssl@1.1/lib/libcrypto.dylib  /opt/homebrew/lib/libaws-crt-cpp.dylib  /opt/homebrew/lib/libaws-c-mqtt.1.0.0.dylib  /opt/homebrew/lib/libaws-c-event-stream.1.0.0.dylib  /opt/homebrew/lib/libaws-c-s3.1.0.0.dylib  /opt/homebrew/lib/libaws-c-auth.1.0.0.dylib  /opt/homebrew/lib/libaws-c-http.1.0.0.dylib  /opt/homebrew/lib/libaws-c-io.1.0.0.dylib  /opt/homebrew/lib/libaws-c-compression.1.0.0.dylib  /opt/homebrew/lib/libaws-c-cal.1.0.0.dylib  -framework Security  /opt/homebrew/lib/libaws-c-sdkutils.1.0.0.dylib  /opt/homebrew/lib/libaws-checksums.1.0.0.dylib  /opt/homebrew/lib/libaws-c-common.1.0.0.dylib  -pthread  -lpthread  -framework CoreFoundation && :
Undefined symbols for architecture arm64:
  "__ZNSt3__18to_charsEPcS0_d", referenced from:
      __ZN5arrow8internal7ToCharsIdJEEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEET_DpOT0_ in string_test.cc.o
  "__ZNSt3__18to_charsEPcS0_f", referenced from:
      __ZN5arrow8internal7ToCharsIfJEEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEET_DpOT0_ in string_test.cc.o
ld: symbol(s) not found for architecture arm64
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
[546/632] Building CXX object src/parquet/CMakeFiles/parquet-arrow-test.dir/arrow/arrow_reader_writer_test.cc.o
ninja: build stopped: subcommand failed.

I encounter this issue on Mac M1 while using the clang-14.

Component(s)

C++

Activity

  1. changed the title [-][C++]: Compiling failed on Mac M1[/-] [+][C++] Compiling failed on Mac M1[/+] on Nov 30, 2022
  2. added this to the 11.0.0 milestone on Nov 30, 2022
  3. self-assigned this
    on Nov 30, 2022
  4. pitrou commented on Nov 30, 2022

    @pitrou
    Member

    Given that few standard libraries seem to support std::to_chars for floating-point types, we should probably revert its usage from the Arrow codebase.
    @bkietz Thoughts?

  5. vibhatha commented on Dec 2, 2022

    @vibhatha
    ContributorAuthor

    Also please note that, the issue occurs when using the following clang version.

    clang version 14.0.0 (https://github.com/tru/llvm-release-build fc075d7c96fe7c992dde351695a5d25fe084794a)

    But when using clang Apple clang version 13.1.6 (clang-1316.0.21.2.5) the issue didn't occur. Previously in my path, CLANG_TOOLS has been included and its clang and clang++ was used in compiling. That could have been the reason why I got the issue.

    But, please note that I have been using this setting for a while and didn't encountered the reported issue until now.

  6. bkietz commented on Dec 2, 2022

    @bkietz
    Member

    I've crawled through the history of libc++' charconv header and I can't find an explanation for this. I do think that floating point to_chars might need to wait a while, but perhaps we could let this issue accumulate a few more reports before reverting

  7. pitrou commented on Dec 5, 2022

    @pitrou
    Member

    But when using clang Apple clang version 13.1.6 (clang-1316.0.21.2.5) the issue didn't occur.

    That's an interesting data point, thank you. If you want to use a third-party clang, perhaps you also need to use a matching libc++ instead of the Apple-provided one?

  8. removed their assignment
    on Jan 9, 2023
  9. modified the milestones: 11.0.0, 12.0.0 on Jan 9, 2023
  10. j-bennet commented on Mar 8, 2023

    @j-bennet

    I have a similar error (not quite the same) on a Mac M2. I'm new to pyarrow, and especially to C++ builds. I was trying to build using ninja-debug-python preset:

    > cmake --build .
    [304/631] Linking CXX shared library debug/libarrow.1200.0.0.dylib
    ld: warning: -pie being ignored. It is only used when linking a main executable
    [307/631] Linking CXX shared library debug/libarrow_testing.1200.0.0.dylib
    ld: warning: -pie being ignored. It is only used when linking a main executable
    [353/631] Linking CXX executable debug/arrow-array-test
    FAILED: debug/arrow-array-test
    : && /Users/jbennet/mambaforge/envs/pyarrow-dev/bin/arm64-apple-darwin20.0.0-clang++ -fno-aligned-new -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/jbennet/mambaforge/envs/pyarrow-dev/include -Qunused-arguments -fcolor-diagnostics  -Wall -Wextra -Wdocumentation -Wshorten-64-to-32 -Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand -Wno-return-stack-address -Wno-unknown-warning-option -Wno-pass-failed -march=armv8-a  -g -Werror -O0 -ggdb -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/jbennet/mambaforge/envs/pyarrow-dev/lib -L/Users/jbennet/mambaforge/envs/pyarrow-dev/lib src/arrow/CMakeFiles/arrow-array-test.dir/array/array_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_binary_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_dict_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_list_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_run_end_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_struct_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_union_test.cc.o src/arrow/CMakeFiles/arrow-array-test.dir/array/array_view_test.cc.o -o debug/arrow-array-test  -Wl,-rpath,/Users/jbennet/src/arrow/cpp/build/debug/ -Wl,-rpath,/Users/jbennet/mambaforge/envs/pyarrow-dev/lib  debug/libarrow_testing.1200.0.0.dylib  debug/libarrow.1200.0.0.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libbrotlienc.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libbrotlidec.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libbrotlicommon.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/liborc.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libprotobuf.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libutf8proc.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libre2.10.0.0.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libgtest_main.1.12.1.dylib  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libgmock.1.12.1.dylib  jemalloc_ep-prefix/src/jemalloc_ep/dist//lib/libjemalloc_pic.a  mimalloc_ep/src/mimalloc_ep/lib/mimalloc-2.0/libmimalloc-debug.a  /Users/jbennet/mambaforge/envs/pyarrow-dev/lib/libgtest.1.12.1.dylib && :
    Undefined symbols for architecture arm64:
      "testing::Matcher<std::__1::basic_string_view<char, std::__1::char_traits<char> > const&>::Matcher(char const*)", referenced from:
          testing::Matcher<std::__1::basic_string_view<char, std::__1::char_traits<char> > const&> testing::internal::MatcherCastImpl<std::__1::basic_string_view<char, std::__1::char_traits<char> > const&, char const*>::CastImpl<true>(char const* const&, std::__1::integral_constant<bool, true>, std::__1::integral_constant<bool, true>) in array_test.cc.o
          testing::Matcher<std::__1::basic_string_view<char, std::__1::char_traits<char> > const&> testing::internal::MatcherCastImpl<std::__1::basic_string_view<char, std::__1::char_traits<char> > const&, char const*>::CastImpl<true>(char const* const&, std::__1::integral_constant<bool, true>, std::__1::integral_constant<bool, true>) in array_binary_test.cc.o
    ld: symbol(s) not found for architecture arm64
    clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
    [366/631] Building CXX object src/arrow/compute/kernels/CMakeFiles/arrow-compute-scalar-math-test.dir/scalar_arithmetic_test.cc.o
    ninja: build stopped: subcommand failed.
    

    How do I fix this?

  11. j-bennet commented on Mar 8, 2023

    @j-bennet

    Nevermind; problem solved by using the -DGTest_SOURCE="BUNDLED" flag, suggested here:

  12. AlenkaF commented on Mar 29, 2023

    @AlenkaF
    Member

    Duplicate of #14917

  13. added a commit that references this issue on Mar 31, 2023
    68dc40a
  14. added a commit that references this issue on May 15, 2023
    a310a50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions