Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error for android using cmake on macOS #1015

Closed
zoujiaqing opened this issue Jan 14, 2024 · 1 comment
Closed

build error for android using cmake on macOS #1015

zoujiaqing opened this issue Jan 14, 2024 · 1 comment
Assignees
Labels
Bug 🐛 Build 👷 Duplicate 🔁 A duplicate of an other issue/PR.

Comments

@zoujiaqing
Copy link

Description

zoujiaqing@mac android-build % cmake .. \
    -DANDROID_NDK=$NDK_HOME \
    -DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=arm64-v8a \
    -DANDROID_NATIVE_API_LEVEL=android-21 \
    -DANDROID_STL=c++_shared \
    -DCMAKE_BUILD_TYPE=Release \
    -DOPENSSL_CRYPTO_LIBRARY=/Users/zoujiaqing/projects/privchat/privchat-sdk-android/distribution/libs/arm64-v8a/libssl.so \
    -DOPENSSL_INCLUDE_DIR=/opt/homebrew/Cellar/[email protected]/1.1.1w/include
-- The CXX compiler identification is Clang 17.0.2
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- C++ Requests CMake Options
-- =======================================================
--   CPR_GENERATE_COVERAGE: OFF
--   CPR_CURL_NOSIGNAL: OFF
--   CPR_USE_SYSTEM_GTEST: OFF
--   CPR_FORCE_USE_SYSTEM_CURL: OFF
--   CPR_ENABLE_SSL: ON
--   CPR_FORCE_OPENSSL_BACKEND: OFF
--   CPR_FORCE_WINSSL_BACKEND: OFF
--   CPR_FORCE_DARWINSSL_BACKEND: OFF
--   CPR_FORCE_MBEDTLS_BACKEND: OFF
--   CPR_ENABLE_LINTING: OFF
--   CPR_ENABLE_CPPCHECK: OFF
--   CPR_BUILD_TESTS: OFF
--   CPR_BUILD_TESTS_SSL: OFF
--   CPR_BUILD_TESTS_PROXY: OFF
--   CPR_DEBUG_SANITIZER_FLAG_THREAD: OFF
--   CPR_DEBUG_SANITIZER_FLAG_ADDR: OFF
--   CPR_DEBUG_SANITIZER_FLAG_LEAK: OFF
--   CPR_DEBUG_SANITIZER_FLAG_UB: OFF
--   CPR_DEBUG_SANITIZER_FLAG_ALL: OFF
-- =======================================================
-- Automatically detecting SSL backend.
-- Detecting SSL backend...
-- Found OpenSSL: /Users/zoujiaqing/projects/privchat/privchat-sdk-android/distribution/libs/arm64-v8a/libssl.so (found version "1.1.1w")
-- SSL auto detect: Using OpenSSL.
-- Configuring build in curl...
-- Using CMake version 3.28.1
-- ZLIB_HEADER_VERSION: 1.2.11
-- ZLIBNG_HEADER_VERSION: 2.0.6
-- The C compiler identification is Clang 17.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Arch detected: 'aarch64-none-linux-android21'
-- Basearch of 'aarch64-none-linux-android21' has been detected as: 'arm'
-- Using CMake toolchain: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/build/cmake/android.toolchain.cmake
-- Performing Test FNO_LTO_AVAILABLE
-- Performing Test FNO_LTO_AVAILABLE - Success
-- Architecture supports unaligned reads
-- Architecture supports unaligned reads of > 4 bytes
-- Looking for sys/sdt.h
-- Looking for sys/sdt.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Performing Test HAVE_NO_INTERPOSITION
-- Performing Test HAVE_NO_INTERPOSITION - Success
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_HIDDEN
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_HIDDEN - Success
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_INTERNAL
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_INTERNAL - Success
-- Performing Test HAVE_BUILTIN_CTZ
-- Performing Test HAVE_BUILTIN_CTZ - Success
-- Performing Test HAVE_BUILTIN_CTZLL
-- Performing Test HAVE_BUILTIN_CTZLL - Success
-- Performing Test HAVE_PTRDIFF_T
-- Performing Test HAVE_PTRDIFF_T - Success
-- Architecture-specific source files: arch/arm/armfeature.c;arch/arm/crc32_acle.c;arch/arm/insert_string_acle.c;arch/arm/adler32_neon.c;arch/arm/chunkset_neon.c;arch/arm/slide_neon.c
-- The following features have been enabled:

 * CMAKE_BUILD_TYPE, Build type: Release (selected)
 * WITH_GZFILEOP, Compile with support for gzFile related functions
 * ZLIB_COMPAT, Compile with zlib compatible API
 * WITH_OPTIM, Build with optimisation
 * WITH_NEW_STRATEGIES, Use new strategies
 * WITH_UNALIGNED, Support unaligned reads on platforms that support it
 * WITH_ACLE, Build with ACLE
 * WITH_NEON, Build with NEON intrinsics
 * ACLE_CRC, Support ACLE optimized CRC hash generation, using "-march=armv8-a+crc"
 * NEON_ADLER32, Support NEON instructions in adler32, using "-march=armv8-a+simd"
 * NEON_SLIDEHASH, Support NEON instructions in slide_hash, using "-march=armv8-a+simd"

-- The following OPTIONAL packages have been found:

 * PkgConfig
 * Git

-- The following REQUIRED packages have been found:

 * OpenSSL

-- The following features have been disabled:

 * ZLIB_ENABLE_TESTS, Build test binaries
 * ZLIB_DUAL_LINK, Dual link tests against system zlib
 * WITH_FUZZERS, Build test/fuzz
 * WITH_NATIVE_INSTRUCTIONS, Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)
 * WITH_MAINTAINER_WARNINGS, Build with project maintainer warnings
 * WITH_CODE_COVERAGE, Enable code coverage reporting
 * WITH_INFLATE_STRICT, Build with strict inflate distance checking
 * WITH_INFLATE_ALLOW_INVALID_DIST, Build with zero fill for inflate invalid distances
 * INSTALL_UTILS, Copy minigzip and minideflate during install

-- Enabled curl SSL
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/FetchContent.cmake:1331 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  CMakeLists.txt:235 (FetchContent_Declare)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- curl version=[8.4.0]
-- Picky compiler options: -Wextra -Wall -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Wcast-align -Wdeclaration-after-statement -Wempty-body -Wendif-labels -Wfloat-equal -Wignored-qualifiers -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wstrict-prototypes -Wtype-limits -Wvla -Wshift-sign-overflow -Wshorten-64-to-32 -Wdouble-promotion -Wenum-conversion -Wunused-const-variable -Wcomma -Wmissing-variable-declarations -Wassign-enum -Wextra-semi-stmt
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_ADDR
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_ADDR - Success
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - Success
-- Found Perl: /usr/bin/perl (found version "5.30.3")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- 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
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Looking for connect in socket;-pthread
-- Looking for connect in socket;-pthread - not found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for OPENSSL_IS_BORINGSSL
-- Looking for OPENSSL_IS_BORINGSSL - not found
-- Looking for OPENSSL_IS_AWSLC
-- Looking for OPENSSL_IS_AWSLC - not found
-- Found ZLIB: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libz.so (found version "1.2.13")
-- Looking for SSL_set0_wbio
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_SSL_LIBRARY
    linked by target "cmTC_77ecc" in directory /Users/zoujiaqing/projects/privchat/cpr-1.9.7/android-build/CMakeFiles/CMakeScratch/TryCompile-Mn8ZiU

CMake Error at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/CheckSymbolExists.cmake:140 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/CheckSymbolExists.cmake:66 (__CHECK_SYMBOL_EXISTS_IMPL)
  android-build/_deps/curl-src/CMakeLists.txt:646 (check_symbol_exists)
  android-build/_deps/curl-src/CMakeLists.txt:652 (openssl_check_symbol_exists)

-- Configuring incomplete, errors occurred!

Example/How to Reproduce

zoujiaqing@mac android-build % cmake .. \
    -DANDROID_NDK=$NDK_HOME \
    -DCMAKE_TOOLCHAIN_FILE=$NDK_HOME/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=arm64-v8a \
    -DANDROID_NATIVE_API_LEVEL=android-21 \
    -DANDROID_STL=c++_shared \
    -DCMAKE_BUILD_TYPE=Release \
    -DOPENSSL_CRYPTO_LIBRARY=/Users/zoujiaqing/projects/privchat/privchat-sdk-android/distribution/libs/arm64-v8a/libssl.so \
    -DOPENSSL_INCLUDE_DIR=/opt/homebrew/Cellar/[email protected]/1.1.1w/include
-- The CXX compiler identification is Clang 17.0.2
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- C++ Requests CMake Options
-- =======================================================
--   CPR_GENERATE_COVERAGE: OFF
--   CPR_CURL_NOSIGNAL: OFF
--   CPR_USE_SYSTEM_GTEST: OFF
--   CPR_FORCE_USE_SYSTEM_CURL: OFF
--   CPR_ENABLE_SSL: ON
--   CPR_FORCE_OPENSSL_BACKEND: OFF
--   CPR_FORCE_WINSSL_BACKEND: OFF
--   CPR_FORCE_DARWINSSL_BACKEND: OFF
--   CPR_FORCE_MBEDTLS_BACKEND: OFF
--   CPR_ENABLE_LINTING: OFF
--   CPR_ENABLE_CPPCHECK: OFF
--   CPR_BUILD_TESTS: OFF
--   CPR_BUILD_TESTS_SSL: OFF
--   CPR_BUILD_TESTS_PROXY: OFF
--   CPR_DEBUG_SANITIZER_FLAG_THREAD: OFF
--   CPR_DEBUG_SANITIZER_FLAG_ADDR: OFF
--   CPR_DEBUG_SANITIZER_FLAG_LEAK: OFF
--   CPR_DEBUG_SANITIZER_FLAG_UB: OFF
--   CPR_DEBUG_SANITIZER_FLAG_ALL: OFF
-- =======================================================
-- Automatically detecting SSL backend.
-- Detecting SSL backend...
-- Found OpenSSL: /Users/zoujiaqing/projects/privchat/privchat-sdk-android/distribution/libs/arm64-v8a/libssl.so (found version "1.1.1w")
-- SSL auto detect: Using OpenSSL.
-- Configuring build in curl...
-- Using CMake version 3.28.1
-- ZLIB_HEADER_VERSION: 1.2.11
-- ZLIBNG_HEADER_VERSION: 2.0.6
-- The C compiler identification is Clang 17.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Arch detected: 'aarch64-none-linux-android21'
-- Basearch of 'aarch64-none-linux-android21' has been detected as: 'arm'
-- Using CMake toolchain: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/build/cmake/android.toolchain.cmake
-- Performing Test FNO_LTO_AVAILABLE
-- Performing Test FNO_LTO_AVAILABLE - Success
-- Architecture supports unaligned reads
-- Architecture supports unaligned reads of > 4 bytes
-- Looking for sys/sdt.h
-- Looking for sys/sdt.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Performing Test HAVE_NO_INTERPOSITION
-- Performing Test HAVE_NO_INTERPOSITION - Success
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_HIDDEN
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_HIDDEN - Success
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_INTERNAL
-- Performing Test HAVE_ATTRIBUTE_VISIBILITY_INTERNAL - Success
-- Performing Test HAVE_BUILTIN_CTZ
-- Performing Test HAVE_BUILTIN_CTZ - Success
-- Performing Test HAVE_BUILTIN_CTZLL
-- Performing Test HAVE_BUILTIN_CTZLL - Success
-- Performing Test HAVE_PTRDIFF_T
-- Performing Test HAVE_PTRDIFF_T - Success
-- Architecture-specific source files: arch/arm/armfeature.c;arch/arm/crc32_acle.c;arch/arm/insert_string_acle.c;arch/arm/adler32_neon.c;arch/arm/chunkset_neon.c;arch/arm/slide_neon.c
-- The following features have been enabled:

 * CMAKE_BUILD_TYPE, Build type: Release (selected)
 * WITH_GZFILEOP, Compile with support for gzFile related functions
 * ZLIB_COMPAT, Compile with zlib compatible API
 * WITH_OPTIM, Build with optimisation
 * WITH_NEW_STRATEGIES, Use new strategies
 * WITH_UNALIGNED, Support unaligned reads on platforms that support it
 * WITH_ACLE, Build with ACLE
 * WITH_NEON, Build with NEON intrinsics
 * ACLE_CRC, Support ACLE optimized CRC hash generation, using "-march=armv8-a+crc"
 * NEON_ADLER32, Support NEON instructions in adler32, using "-march=armv8-a+simd"
 * NEON_SLIDEHASH, Support NEON instructions in slide_hash, using "-march=armv8-a+simd"

-- The following OPTIONAL packages have been found:

 * PkgConfig
 * Git

-- The following REQUIRED packages have been found:

 * OpenSSL

-- The following features have been disabled:

 * ZLIB_ENABLE_TESTS, Build test binaries
 * ZLIB_DUAL_LINK, Dual link tests against system zlib
 * WITH_FUZZERS, Build test/fuzz
 * WITH_NATIVE_INSTRUCTIONS, Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)
 * WITH_MAINTAINER_WARNINGS, Build with project maintainer warnings
 * WITH_CODE_COVERAGE, Enable code coverage reporting
 * WITH_INFLATE_STRICT, Build with strict inflate distance checking
 * WITH_INFLATE_ALLOW_INVALID_DIST, Build with zero fill for inflate invalid distances
 * INSTALL_UTILS, Copy minigzip and minideflate during install

-- Enabled curl SSL
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/FetchContent.cmake:1331 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  CMakeLists.txt:235 (FetchContent_Declare)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- curl version=[8.4.0]
-- Picky compiler options: -Wextra -Wall -pedantic -Wbad-function-cast -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-long-long -Wno-multichar -Wpointer-arith -Wshadow -Wsign-compare -Wundef -Wunused -Wwrite-strings -Wcast-align -Wdeclaration-after-statement -Wempty-body -Wendif-labels -Wfloat-equal -Wignored-qualifiers -Wno-format-nonliteral -Wno-sign-conversion -Wno-system-headers -Wstrict-prototypes -Wtype-limits -Wvla -Wshift-sign-overflow -Wshorten-64-to-32 -Wdouble-promotion -Wenum-conversion -Wunused-const-variable -Wcomma -Wmissing-variable-declarations -Wassign-enum -Wextra-semi-stmt
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_ADDR
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_ADDR - Success
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - Success
-- Found Perl: /usr/bin/perl (found version "5.30.3")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- 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
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Looking for connect in socket;-pthread
-- Looking for connect in socket;-pthread - not found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for OPENSSL_IS_BORINGSSL
-- Looking for OPENSSL_IS_BORINGSSL - not found
-- Looking for OPENSSL_IS_AWSLC
-- Looking for OPENSSL_IS_AWSLC - not found
-- Found ZLIB: /Users/zoujiaqing/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libz.so (found version "1.2.13")
-- Looking for SSL_set0_wbio
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENSSL_SSL_LIBRARY
    linked by target "cmTC_77ecc" in directory /Users/zoujiaqing/projects/privchat/cpr-1.9.7/android-build/CMakeFiles/CMakeScratch/TryCompile-Mn8ZiU

CMake Error at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/CheckSymbolExists.cmake:140 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/CheckSymbolExists.cmake:66 (__CHECK_SYMBOL_EXISTS_IMPL)
  android-build/_deps/curl-src/CMakeLists.txt:646 (check_symbol_exists)
  android-build/_deps/curl-src/CMakeLists.txt:652 (openssl_check_symbol_exists)

-- Configuring incomplete, errors occurred!

Possible Fix

No response

Where did you get it from?

GitHub (branch e.g. master), Other (specify in "Additional Context/Your Environment")

Additional Context/Your Environment

  • OS: macOS
  • Version: 1.9.7
@COM8
Copy link
Member

COM8 commented Mar 18, 2024

Closing in favour of #1007

@COM8 COM8 closed this as completed Mar 18, 2024
@COM8 COM8 added Build 👷 Duplicate 🔁 A duplicate of an other issue/PR. and removed Needs Investigation 🔍 labels Mar 18, 2024
@COM8 COM8 self-assigned this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 Build 👷 Duplicate 🔁 A duplicate of an other issue/PR.
Projects
None yet
Development

No branches or pull requests

2 participants