michaeleisel / zld

A faster version of Apple's linker
MIT License
1.19k stars 50 forks source link

compile failed on Apple M1 #80

Closed Thearas closed 3 years ago

Thearas commented 3 years ago

Run make but got an error:

error: unknown target CPU 'armv8-a+crypto'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont,
      slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge,
      corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake,
      skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client,
      icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3,
      athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2,
      bdver3, bdver4, znver1, znver2, x86-64

Any plan to support compiling on M1? :)

michaeleisel commented 3 years ago

Can you post the full build log? Also, are you able to just use the pre-compiled version instead?

thii commented 3 years ago

iirc that's from abseil

Thearas commented 3 years ago

It's OK to use the pre-compiled version. I just try to compile something on my new mac.😂

Thearas commented 3 years ago

Can you post the full build log? Also, are you able to just use the pre-compiled version instead?

This is not a bug report, take a look if you have time.

➜  zld git:(master) make clean && make
rm -rf abseil-cpp-20200225 build cfe-8.0.1.src dyld-733.6 llvm-8.0.1.src pstl tapi-1100.0.11 tbb tbb_staticlib
curl -# -L https://github.com/abseil/abseil-cpp/archive/20200225.tar.gz | tar xz
################################################################################# 100.0%                  -=O=-                                #     #     #    #
mkdir abseil-cpp-20200225/build abseil-cpp-20200225/build_x86_64 abseil-cpp-20200225/build_arm64
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -S abseil-cpp-20200225 -B abseil-cpp-20200225/build_x86_64
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/thearas/repos/zld/abseil-cpp-20200225/build_x86_64
make -C abseil-cpp-20200225/build_x86_64 -j
Scanning dependencies of target time_zone
Scanning dependencies of target exponential_biased
Scanning dependencies of target spinlock_wait
Scanning dependencies of target civil_time
Scanning dependencies of target int128
Scanning dependencies of target leak_check
Scanning dependencies of target log_severity
Scanning dependencies of target leak_check_disable
Scanning dependencies of target dynamic_annotations
Scanning dependencies of target random_internal_randen_slow
Scanning dependencies of target random_internal_randen_hwaes_impl
Scanning dependencies of target random_seed_gen_exception
Scanning dependencies of target city
[  1%] Building CXX object absl/base/CMakeFiles/exponential_biased.dir/internal/exponential_biased.cc.o
[  2%] Building CXX object absl/numeric/CMakeFiles/int128.dir/int128.cc.o
[  2%] Building CXX object absl/base/CMakeFiles/spinlock_wait.dir/internal/spinlock_wait.cc.o
[  3%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_fixed.cc.o
[  3%] Building CXX object absl/random/CMakeFiles/random_internal_randen_slow.dir/internal/randen_slow.cc.o
[  3%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_info.cc.o
[  4%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_format.cc.o
[  4%] Building CXX object absl/random/CMakeFiles/random_seed_gen_exception.dir/seed_gen_exception.cc.o
[  6%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_if.cc.o
[  6%] Building CXX object absl/debugging/CMakeFiles/leak_check.dir/leak_check.cc.o
[  6%] Building CXX object absl/debugging/CMakeFiles/leak_check_disable.dir/leak_check_disable.cc.o
[  7%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_impl.cc.o
[  8%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_lookup.cc.o
[  9%] Building CXX object absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/internal/randen_hwaes.cc.o
[ 10%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_libc.cc.o
[ 10%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_posix.cc.o
[ 11%] Building CXX object absl/hash/CMakeFiles/city.dir/internal/city.cc.o
[ 12%] Building CXX object absl/time/CMakeFiles/civil_time.dir/internal/cctz/src/civil_time_detail.cc.o
[ 12%] Building CXX object absl/base/CMakeFiles/dynamic_annotations.dir/dynamic_annotations.cc.o
[ 13%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/zone_info_source.cc.o
[ 14%] Building CXX object absl/base/CMakeFiles/log_severity.dir/log_severity.cc.o
error: unknown target CPU 'armv8-a+crypto'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont,
      slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge,
      corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake,
      skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client,
      icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3,
      athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2,
      bdver3, bdver4, znver1, znver2, x86-64
make[3]: *** [absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/internal/randen_hwaes.cc.o] Error 1
make[2]: *** [absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 15%] Linking CXX static library libabsl_leak_check_disable.a
[ 16%] Linking CXX static library libabsl_leak_check.a
[ 17%] Linking CXX static library libabsl_dynamic_annotations.a
[ 17%] Built target leak_check
[ 17%] Built target leak_check_disable
[ 18%] Linking CXX static library libabsl_spinlock_wait.a
[ 18%] Built target dynamic_annotations
[ 18%] Built target spinlock_wait
[ 18%] Linking CXX static library libabsl_exponential_biased.a
[ 18%] Built target exponential_biased
[ 18%] Linking CXX static library libabsl_city.a
[ 18%] Linking CXX static library libabsl_random_seed_gen_exception.a
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_info.cc:721:35: warning:
      declaration shadows a local variable [-Wshadow-uncaptured-local]
      name, [](const std::string& name) -> std::unique_ptr<ZoneInfoSource> {
                                  ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_info.cc:709:44: note:
      previous declaration is here
bool TimeZoneInfo::Load(const std::string& name) {
                                           ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_info.cc:722:18: warning:
      declaration shadows a local variable [-Wshadow-uncaptured-local]
        if (auto zip = FileZoneInfoSource::Open(name)) return zip;
                 ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_info.cc:720:8: note:
      previous declaration is here
  auto zip = cctz_extension::zone_info_source_factory(
       ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_info.cc:723:18: warning:
      declaration shadows a local variable [-Wshadow-uncaptured-local]
        if (auto zip = AndroidZoneInfoSource::Open(name)) return zip;
                 ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_info.cc:720:8: note:
      previous declaration is here
  auto zip = cctz_extension::zone_info_source_factory(
       ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_libc.cc:166:22: warning:
      declaration shadows a local variable [-Wshadow]
        if (std::tm* tmp = local_time(&lo, &tm)) {
                     ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_libc.cc:156:18: note:
      previous declaration is here
    if (std::tm* tmp = local_time(&mid, &tm)) {
                 ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_libc.cc:191:9: warning:
      result of comparison 'const std::int_fast64_t' (aka 'const long long') <
      -9223372036854775808 is always false [-Wtautological-type-limit-compare]
  if (s < std::numeric_limits<std::time_t>::min()) {
      ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_libc.cc:195:9: warning:
      result of comparison 'const std::int_fast64_t' (aka 'const long long') >
      9223372036854775807 is always false [-Wtautological-type-limit-compare]
  if (s > std::numeric_limits<std::time_t>::max()) {
      ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 18%] Built target city
[ 18%] Built target random_seed_gen_exception
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_libc.cc:84:6: warning:
      unused function template 'tm_gmtoff' [-Wunused-template]
auto tm_gmtoff(const T& tm) -> decltype(tm.__tm_gmtoff) {
     ^
/Users/thearas/repos/zld/abseil-cpp-20200225/absl/time/internal/cctz/src/time_zone_libc.cc:100:6: warning:
      unused function template 'tm_zone' [-Wunused-template]
auto tm_zone(const T& tm) -> decltype(tm.__tm_zone) {
     ^
[ 18%] Linking CXX static library libabsl_log_severity.a
[ 19%] Linking CXX static library libabsl_random_internal_randen_slow.a
[ 19%] Built target log_severity
5 warnings generated.
[ 19%] Built target random_internal_randen_slow
[ 20%] Linking CXX static library libabsl_civil_time.a
[ 20%] Built target civil_time
[ 20%] Linking CXX static library libabsl_int128.a
[ 20%] Built target int128
3 warnings generated.
[ 21%] Linking CXX static library libabsl_time_zone.a
[ 21%] Built target time_zone
make[1]: *** [all] Error 2
make: *** [abseil-cpp-20200225] Error 2
SantiPerti commented 3 years ago

Hi!, I am having the same issue here, any news?

michaeleisel commented 3 years ago

two things:

mcginty commented 3 years ago

I have the same exact build error on an M1 MacBook Air w/ Xcode 12.4 and macOS 11.2.3.

michaelkirk commented 3 years ago

Getting this same unknown target CPU 'armv8-a+crypto' error on M1 when building zld@ 788f449 (1.3.0 + 3).

When I do brew install zld I run into #86

does the pre-compiled version meet your needs?

When using https://github.com/michaeleisel/zld/releases/tag/1.3.0 to build some rust packages, I hit #85:

error: failed to run custom build command for `libc v0.2.94`

Caused by:
  process didn't exit successfully: `/Users/mkirk/src/abs/abstreet/target/debug/build/libc-5f8b74cb6ae41598/build-script-build` (signal: 9, SIGKILL: kill)
warning: build failed, waiting for other jobs to finish...
error: build failed

I don't think that #85 is fixed in master since 1.3.0 anyway, but I was going to give it a shot and could not.

michaelkirk commented 3 years ago

As a temporary work around, I was able to build zld on my m1 by just skipping the x84_64 parts:

https://github.com/michaelkirk/zld/commit/53f035bda16d41fa9376056a095318baf929d19b

michaeleisel commented 3 years ago

This appears to be an abseil issue, I've filed a report: https://github.com/abseil/abseil-cpp/issues/970