AztecProtocol / aztec-2.0

C++ elliptic curve library
134 stars 37 forks source link

Unable to cmake -DARM=ON .. for cross-compiling #57

Open 29988122 opened 3 years ago

29988122 commented 3 years ago

I tried to cross compile on ubuntu 20 LTS x86-64 for aarch64 devices, and it failed.

-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiling for ARM.
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
-- Multithreading is disabled.
S-- Found PythonInterp: /usr/bin/python3.8 (found version "3.8.5") 
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Could NOT find Threads (missing: Threads_FOUND) 
-- Could NOT find Threads (missing: Threads_FOUND) 
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- git Version: v1.5.0
-- Version: 1.5.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Error at armbuild/_deps/benchmark-src/CMakeLists.txt:251 (message):
  Failed to determine the source files for the regular expression backend

I also tried the dockerfile, but the image's not on the Dockerhub anymore.

It could be the issue of aarch64 lib paths retrieval on x84-64, but after checking https://github.com/AztecProtocol/barretenberg/blob/master/barretenberg/cmake/toolchains/arm64-linux-gcc.cmake I can't find anything suspicious for me to try.

Any input is appreciated.

zac-williamson commented 3 years ago
Hi Jerry, It looks like CMake can’t find the OpenMP libraries. If you install them via `sudo apt-get libomp-dev` it might work.If that fails, you can try and compile the software without multithreading support, by running `cmake .. -DNO_MULTITHREADING=1` I hope that helps,Zac. From: Jerry HoSent: 27 February 2021 12:01To: AztecProtocol/barretenbergCc: SubscribedSubject: [AztecProtocol/barretenberg] Unable to cmake -DARM=ON .. for cross-compiling (#57) I tried to cross compile on ubuntu 20 LTS x86-64 for aarch64 devices, and it failed.-- The CXX compiler identification is GNU 9.3.0-- The C compiler identification is GNU 9.3.0-- Check for working CXX compiler: /usr/bin/c++-- Check for working CXX compiler: /usr/bin/c++ -- works-- Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info - done-- Detecting CXX compile features-- Detecting CXX compile features - done-- Check for working C compiler: /usr/bin/cc-- Check for working C compiler: /usr/bin/cc -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Detecting C compile features-- Detecting C compile features - done-- Compiling for ARM.-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) -- Multithreading is disabled.S-- Found PythonInterp: /usr/bin/python3.8 (found version "3.8.5") -- Looking for pthread.h-- Looking for pthread.h - not found-- Could NOT find Threads (missing: Threads_FOUND) -- Could NOT find Threads (missing: Threads_FOUND) -- Found Git: /usr/bin/git (found version "2.25.1") -- git Version: v1.5.0-- Version: 1.5.0-- Performing Test HAVE_CXX_FLAG_STD_CXX11-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success-- Performing Test HAVE_CXX_FLAG_WALL-- Performing Test HAVE_CXX_FLAG_WALL - Success-- Performing Test HAVE_CXX_FLAG_WEXTRA-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success-- Performing Test HAVE_CXX_FLAG_WSHADOW-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success-- Performing Test HAVE_CXX_FLAG_WERROR-- Performing Test HAVE_CXX_FLAG_WERROR - Success-- Performing Test HAVE_CXX_FLAG_PEDANTIC-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success-- Performing Test HAVE_CXX_FLAG_WD654-- Performing Test HAVE_CXX_FLAG_WD654 - Failed-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed-- Performing Test HAVE_CXX_FLAG_COVERAGE-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success-- Performing Test HAVE_STD_REGEX-- Performing Test HAVE_STD_REGEX -- failed to compile-- Performing Test HAVE_GNU_POSIX_REGEX-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile-- Performing Test HAVE_POSIX_REGEX-- Performing Test HAVE_POSIX_REGEX -- failed to compileCMake Error at armbuild/_deps/benchmark-src/CMakeLists.txt:251 (message):  Failed to determine the source files for the regular expression backendI also tried the dockerfile, but the image's not on the Dockerhub anymore.It could be the issue of aarch64 lib paths retrieval on x84-64, but after checkinghttps://github.com/AztecProtocol/barretenberg/blob/master/barretenberg/cmake/toolchains/arm64-linux-gcc.cmakeI can't find anything suspicious for me to try.Any input is appreciated.—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe. 
29988122 commented 3 years ago

It still failed.

But, I can confirm that on the same machine, 'cmake ..' and the subsequent make commands work, as long as we do not specify -DARM=ON on x86-64 machine(e.g., cross-compile). The Open_MP and other libs can be found correctly in that case.

Any idea on how can I modify cmake and its corresponding aarch64 toolchain path? The environment on my side was a new ubuntu 20 LTS installation.

cmake -DARM=ON -DNO_MULTITHREADING=1 ..
-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiling for ARM.
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
-- Multithreading is disabled.
-- Found PythonInterp: /usr/bin/python3.8 (found version "3.8.5") 
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Could NOT find Threads (missing: Threads_FOUND) 
-- Could NOT find Threads (missing: Threads_FOUND) 
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- git Version: v1.5.0
-- Version: 1.5.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Error at build/_deps/benchmark-src/CMakeLists.txt:251 (message):
  Failed to determine the source files for the regular expression backend

-- Configuring incomplete, errors occurred!
See also "/home/a29988122/Desktop/barretenberg/barretenberg/build/CMakeFiles/CMakeOutput.log".
See also "/home/a29988122/Desktop/barretenberg/barretenberg/build/CMakeFiles/CMakeError.log".