[bug] Android build on Arch Linux: 'getentropy' is unavailable: introduced in Android 28
silent-rain opened this issue · 0 comments
Describe the bug
I used reqwest in the project and needed to compile it to Android, but reqwest relies on 'opensl-sys', which reported an error when compiling Android.
`When compiling Android "openssl-sys" read the"aarch64-linux-android24-clang" version, but we followed the error message and requested to use a version higher than 28.
Therefore, if the CC variable is passed separately when compiling "opensl-sys" for Android, it can be successfully compiled, for example, “CC=$HOME/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android35-clang cargo build -p mobile --target aarch64-linux-android”,
But passing CC variables during Tauri compilation doesn't seem to take effect? Or are there any other solutions?
Reproduction
No response
Expected behavior
I hope to compile it into an Android app in archLinux.
Full tauri info
output
cargo tauri info
[✔] Environment
- OS: Arch Linux 20240721.0.248532 x86_64 (X64)
✔ webkit2gtk-4.1: 2.46.4
✔ rsvg2: 2.59.2
✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
- node: 23.1.0
- pnpm: 9.12.3
- npm: 10.9.0
[-] Packages
- tauri 🦀: 2.1.1
- tauri-build 🦀: 2.0.3
- wry 🦀: 0.47.2
- tao 🦀: 0.30.8
- tauri-cli 🦀: 2.0.4
[-] Plugins
- tauri-plugin-shell 🦀: 2.0.2
- tauri-plugin-websocket 🦀: 2.2.0
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../../mobile-web/dist
- devUrl: http://localhost:1420/
Stack trace
/home/one/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang -I. -Icrypto -Iinclude -Iproviders/implementations/include -Iproviders/common/include -Iproviders/fips/include -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wa,--noexecstack -Qunused-arguments -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID -MMD -MF providers/implementations/rands/seeding/libdefault-lib-rand_win.d.tmp -c -o providers/implementations/rands/seeding/libdefault-lib-rand_win.o providers/implementations/rands/seeding/rand_win.c
/usr/bin/perl "-I." "-Iproviders/common/der" "-Mconfigdata" "-Mconfigdata" "-Moids_to_c" "util/dofile.pl" "-oMakefile" providers/common/include/prov/der_dsa.h.in > providers/common/include/prov/der_dsa.h
/home/one/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang -Iproviders/common/include/prov -I. -Icrypto -Iinclude -Iproviders/implementations/include -Iproviders/common/include -Iproviders/fips/include -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wa,--noexecstack -Qunused-arguments -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID -MMD -MF providers/implementations/signature/libdefault-lib-ecdsa_sig.d.tmp -c -o providers/implementations/signature/libdefault-lib-ecdsa_sig.o providers/implementations/signature/ecdsa_sig.c
/usr/bin/perl "-I." "-Iproviders/common/der" "-Mconfigdata" "-Mconfigdata" "-Moids_to_c" "util/dofile.pl" "-oMakefile" providers/common/include/prov/der_ecx.h.in > providers/common/include/prov/der_ecx.h
/home/one/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang -I. -Icrypto -Iinclude -Iproviders/implementations/include -Iproviders/common/include -Iproviders/fips/include -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wa,--noexecstack -Qunused-arguments -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID -MMD -MF providers/implementations/signature/libdefault-lib-mac_legacy_sig.d.tmp -c -o providers/implementations/signature/libdefault-lib-mac_legacy_sig.o providers/implementations/signature/mac_legacy_sig.c
/home/one/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang -Iproviders/common/include/prov -I. -Icrypto -Iinclude -Iproviders/implementations/include -Iproviders/common/include -Iproviders/fips/include -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wa,--noexecstack -Qunused-arguments -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID -MMD -MF providers/implementations/signature/libdefault-lib-rsa_sig.d.tmp -c -o providers/implementations/signature/libdefault-lib-rsa_sig.o providers/implementations/signature/rsa_sig.c
make[1]: Leaving directory '/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src'
cargo:warning=building OpenSSL: 'make' reported failure with exit status: 2
cargo:warning=openssl-src: failed to build OpenSSL from source
--- stderr
DEBUG: all keys: APPLINKDIR, BINDIR, CMAKECONFIGDIR, ENGINESDIR, INCLUDEDIR, LDLIBS, LIBDIR, MODULESDIR, PKGCONFIGDIR, PREFIX, VERSION, libdir
No value given for CMAKECONFIGDIR
No value given for PKGCONFIGDIR
No value given for libdir
DEBUG: PREFIX = . => PREFIX = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src
DEBUG: libdir = . => libdir = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src
DEBUG: BINDIR = apps => BINDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src/apps, BINDIR_REL_PREFIX = apps
DEBUG: LIBDIR = => LIBDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src, LIBDIR_REL_PREFIX =
DEBUG: INCLUDEDIR = [ include, ./include ] => INCLUDEDIR = [ /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src/include, /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src/include ], INCLUDEDIR_REL_PREFIX = [ include, ./include ]
DEBUG: APPLINKDIR = ms => APPLINKDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src/ms, APPLINKDIR_REL_PREFIX = ms
DEBUG: ENGINESDIR = engines => ENGINESDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src/engines, ENGINESDIR_REL_LIBDIR = engines
DEBUG: MODULESDIR = providers => MODULESDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src/providers, MODULESDIR_REL_LIBDIR = providers
DEBUG: PKGCONFIGDIR = . => PKGCONFIGDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src, PKGCONFIGDIR_REL_LIBDIR = .
DEBUG: CMAKECONFIGDIR = . => CMAKECONFIGDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src, CMAKECONFIGDIR_REL_LIBDIR = .
DEBUG: all keys: APPLINKDIR, BINDIR, CMAKECONFIGDIR, ENGINESDIR, INCLUDEDIR, LDLIBS, LIBDIR, MODULESDIR, PKGCONFIGDIR, PREFIX, VERSION, libdir
DEBUG: PREFIX = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install => PREFIX = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install
DEBUG: libdir = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib => libdir = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib
DEBUG: BINDIR = bin => BINDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/bin, BINDIR_REL_PREFIX = bin
DEBUG: LIBDIR = lib => LIBDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib, LIBDIR_REL_PREFIX = lib
DEBUG: INCLUDEDIR = include => INCLUDEDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/include, INCLUDEDIR_REL_PREFIX = include
DEBUG: APPLINKDIR = include/openssl => APPLINKDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/include/openssl, APPLINKDIR_REL_PREFIX = include/openssl
DEBUG: ENGINESDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/engines-3 => ENGINESDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/engines-3, ENGINESDIR_REL_LIBDIR = engines-3
DEBUG: MODULESDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/ossl-modules => MODULESDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/ossl-modules, MODULESDIR_REL_LIBDIR = ossl-modules
DEBUG: PKGCONFIGDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/pkgconfig => PKGCONFIGDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/pkgconfig, PKGCONFIGDIR_REL_LIBDIR = pkgconfig
DEBUG: CMAKECONFIGDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/cmake/OpenSSL => CMAKECONFIGDIR = /home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/install/lib/cmake/OpenSSL, CMAKECONFIGDIR_REL_LIBDIR = cmake/OpenSSL
providers/implementations/rands/seeding/rand_unix.c:355:9: error: 'getentropy' is unavailable: introduced in Android 28
355 | if (getentropy != NULL) {
| ^
/home/one/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/getentropy.h:51:11: note: 'getentropy' has been explicitly marked unavailable here
51 | __wur int getentropy(void* _Nonnull __buffer, size_t __buffer_size) __INTRODUCED_IN(28);
| ^
providers/implementations/rands/seeding/rand_unix.c:356:13: error: 'getentropy' is unavailable: introduced in Android 28
356 | if (getentropy(buf, buflen) == 0)
| ^
/home/one/Android/Sdk/ndk/28.0.12433566/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/bits/getentropy.h:51:11: note: 'getentropy' has been explicitly marked unavailable here
51 | __wur int getentropy(void* _Nonnull __buffer, size_t __buffer_size) __INTRODUCED_IN(28);
| ^
2 errors generated.
make[1]: *** [Makefile:13097: providers/implementations/rands/seeding/libdefault-lib-rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2356: build_libs] Error 2
Error building OpenSSL:
'make' reported failure with exit status: 2
Command failed: cd "/home/one/code/mobile-llm/apps/target/aarch64-linux-android/release/build/openssl-sys-1795d91a965d6ea0/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,9 --jobserver-auth=8,9" "make" "build_libs"
Error `Failed to run `cargo build`: command ["cargo", "build", "--package", "mobile", "--manifest-path", "/home/one/code/mobile-llm/apps/mobile/Cargo.toml", "--target", "aarch64-linux-android", "--features", "tauri/custom-protocol tauri/rustls-tls", "--lib", "--release"] exited with code 101
Additional context
No response