abseil-cpp icon indicating copy to clipboard operation
abseil-cpp copied to clipboard

Build by aarch64 failed.

Open wanguxiang1218 opened this issue 2 years ago • 21 comments

I cannot build abseil by aarch64 for arm53.

1.download new release tag. 2.build it by cmake. mkdir build cd build /home/tools/cmake-3.19.6-Linux-x86_64/bin/cmake -D CMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc -D CMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ ..

build error!!

aarch64-linux-gnu-g++: error: unrecognized command line option ‘-maes’ aarch64-linux-gnu-g++: error: unrecognized command line option ‘-msse4.1’ make[2]: *** [absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/build.make:82: absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/internal/randen_hwaes.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2730: absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/all] Error 2 make: *** [Makefile:160: all] Error 2

How can i build for arm53? Thanks!

wanguxiang1218 avatar Aug 03 '22 09:08 wanguxiang1218

I'm also seeing this behavior when building through Bazel (v4.2.2), which seems to indicate that https://github.com/abseil/abseil-cpp/blob/master/absl/copts/configure_copts.bzl#L45-L57 or something in the platform-specific flags selection path is failing?

This seems related to or possibly the same bug as https://github.com/abseil/abseil-cpp/issues/1227 and https://github.com/abseil/abseil-cpp/issues/1210 maybe?

ilanbiala avatar Aug 31 '22 17:08 ilanbiala

Changing CMAKE_C_COMPILER variable shouldn't affect build, as Abseil is a C++ only library.

Changing CMAKE_CXX_COMPILER variable doesn't change other CMake variables, so it's not the same as changing a toolchain.

E.g. AbseilConfigureCopts.cmake relies on variables like CMAKE_SYSTEM_PROCESSOR and CMAKE_CXX_COMPILER_ID. You can print their values by editing that file:

message("CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}")
message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")

See CMake documentation on cross-compiling.

If you do not cross-compile, you should set CC and CXX environment variables before running CMake.

anpol avatar Sep 05 '22 18:09 anpol

It does look that there is something wrong with how abseil build system is set up. Fixing it on upstream side gonna fix it for everyone, otherwise such tickets will keep arising (even though this can be solved on a user end by manual changes).

barracuda156 avatar Sep 08 '22 10:09 barracuda156

This basically means that the abseil-cpp module cannot compile on any AARCH64 processor based systems. I am surprised that this bug hasn't been fixed after more than a year.

The simplest solution seems to be just remove those X86_64 specific flags to unbreak AARCH64 processor support, like in this patch. Can this fix be provided? I'd appreciate Abseil team's timely response.

thx123 avatar Jan 04 '24 04:01 thx123

abseil-cpp-20230802.1 has the same problem

cmake -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ .. make -j8

output: [ 14%] Building CXX object absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/internal/randen_hwaes.cc.o aarch64-linux-gnu-g++: error: unrecognized command line option '-maes' aarch64-linux-gnu-g++: error: unrecognized command line option '-msse4.1' absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/build.make:81: recipe for target 'absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/internal/randen_hwaes.cc.o' failed make[2]: *** [absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/internal/randen_hwaes.cc.o] Error 1 CMakeFiles/Makefile2:3683: recipe for target 'absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/all' failed make[1]: *** [absl/random/CMakeFiles/random_internal_randen_hwaes_impl.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 14%] Building CXX object absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_lookup.cc.o

Is there any solution?

Vangof avatar Feb 06 '24 07:02 Vangof