-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Unable to build on 32-bit without SSE2 #37976
Description
What version of gRPC and what language are you using?
1.65 - 1.67, C++
What operating system (Linux, Windows,...) and version?
Linux 6.1.21
What runtime / compiler are you using (e.g. python version or version of gcc)
gcc 10.2.1 gnueabihf
(Note: the kernel uname is reported as aarch64 but the system has armhf libraries/executables)
What did you do?
Start the build process.
What did you expect to see?
Compilation starts.
What did you see instead?
+++ Enabling SSE2 for aarch64
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Could NOT find Threads (missing: Threads_FOUND)
Analysis
While cmake reports it cannot find threads this is actually a confusing report. This is the first test after -msse2 is added to the gcc flags, which causes gcc on this system to do the following:
gcc: error: unrecognized command-line option ‘-msse2’
Because of the error code, cmake then assumes the threading test failed and thus the system does not support pthread.
Additionally, cat /proc/cpuinfo clearly shows SSE2 is not available:
Features : fp asimd evtstrm crc32 cpuid
If the -msse2 flag is not added to _gRPC_C_CXX_FLAGS then compilation proceeds.
What I am unsure on is:
- whether SSE2 is considered "mandatory" for GRPC, as older versions did not perform this check;
- whether GCC 10.2.1 on armhf is supported.
One potential solution is, after the Linux/32-bit check in CMakeLists.txt, to verify whether cat /proc/cpuinfo contains the sse2 feature, and then enable it as necessary, under the assumption this host configuration is valid and supported.