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

Possible to declare which compilation command for targeting android platform in VSCode? #18111

Open
ospfranco opened this issue Sep 13, 2024 · 10 comments
Labels
A-flycheck issues with flycheck a.k.a. "check on save" C-support Category: support questions

Comments

@ospfranco
Copy link

ospfranco commented Sep 13, 2024

Hi! I have a project that targets many platforms. Among them iOS and Android. Among my dependencies I have C++ projects like Ring. When I change the target on my VSCode settings like this:

  "rust-analyzer.cargo.target": "aarch64-apple-ios",

Everything works and I get inline type hints. However for Android, when I do:

  "rust-analyzer.cargo.target": "aarch64-linux-android",

Rust analyzer fails to start (understandably) because it needs android's Clang to compile my projects dependencies:

2024-09-13T14:19:54.594825Z ERROR rust_analyzer::main_loop: FetchBuildDataError:
The following warnings were emitted during compilation:


error: failed to run custom build command for `ring v0.17.8`

Caused by:
  process didn't exit successfully: `/Users/osp/Developer/opacity-core/target/debug/build/ring-cd73c4e37520cc47/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
  OPT_LEVEL = Some(0)
  TARGET = Some(aarch64-linux-android)
  OUT_DIR = Some(/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/ring-e8de625d4415f3f7/out)
  HOST = Some(aarch64-apple-darwin)
  cargo:rerun-if-env-changed=CC_aarch64-linux-android
  CC_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CC_aarch64_linux_android
  CC_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed?
  RUSTC_WRAPPER = Some(/Users/osp/.vscode/extensions/rust-lang.rust-analyzer-0.3.2002-darwin-arm64/server/rust-analyzer)
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(true)
  cargo:rerun-if-env-changed=CFLAGS_aarch64-linux-android
  CFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_linux_android
  CFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed?

  --- stderr


  error occurred: Failed to find tool. Is `aarch64-linux-android-clang` installed?


The following warnings were emitted during compilation:


error: failed to run custom build command for `blake3 v1.5.4`

Caused by:
  process didn't exit successfully: `/Users/osp/Developer/opacity-core/target/debug/build/blake3-916a5c2d8e5744f7/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-check-cfg=cfg(blake3_sse2_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_sse2_rust, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_sse41_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_sse41_rust, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_avx2_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_avx2_rust, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_avx512_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_neon, values(none()))
  cargo:rerun-if-env-changed=CARGO_FEATURE_PURE
  cargo:rerun-if-env-changed=CARGO_FEATURE_NO_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NO_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_PURE
  cargo:rustc-cfg=blake3_neon
  OUT_DIR = Some(/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/blake3-3beac549cae80608/out)
  TARGET = Some(aarch64-linux-android)
  OPT_LEVEL = Some(0)
  HOST = Some(aarch64-apple-darwin)
  CC_aarch64-linux-android = None
  CC_aarch64_linux_android = None
  TARGET_CC = None
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed?
  RUSTC_WRAPPER = Some(/Users/osp/.vscode/extensions/rust-lang.rust-analyzer-0.3.2002-darwin-arm64/server/rust-analyzer)
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(true)
  CFLAGS_aarch64-linux-android = None
  CFLAGS_aarch64_linux_android = None
  TARGET_CFLAGS = None
  CFLAGS = None

  --- stderr


  error occurred: Failed to find tool. Is `aarch64-linux-android-clang` installed?


The following warnings were emitted during compilation:


error: failed to run custom build command for `openssl-sys v0.9.103`

Caused by:
  process didn't exit successfully: `/Users/osp/Developer/opacity-core/target/debug/build/openssl-sys-d4bd324d6435d934/build-script-main` (exit status: 101)
  --- stdout
  cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO"))
  cargo:rustc-check-cfg=cfg(openssl)
  cargo:rustc-check-cfg=cfg(libressl)
  cargo:rustc-check-cfg=cfg(boringssl)
  cargo:rustc-check-cfg=cfg(libressl250)
  cargo:rustc-check-cfg=cfg(libressl251)
  cargo:rustc-check-cfg=cfg(libressl252)
  cargo:rustc-check-cfg=cfg(libressl261)
  cargo:rustc-check-cfg=cfg(libressl270)
  cargo:rustc-check-cfg=cfg(libressl271)
  cargo:rustc-check-cfg=cfg(libressl273)
  cargo:rustc-check-cfg=cfg(libressl280)
  cargo:rustc-check-cfg=cfg(libressl281)
  cargo:rustc-check-cfg=cfg(libressl291)
  cargo:rustc-check-cfg=cfg(libressl310)
  cargo:rustc-check-cfg=cfg(libressl321)
  cargo:rustc-check-cfg=cfg(libressl332)
  cargo:rustc-check-cfg=cfg(libressl340)
  cargo:rustc-check-cfg=cfg(libressl350)
  cargo:rustc-check-cfg=cfg(libressl360)
  cargo:rustc-check-cfg=cfg(libressl361)
  cargo:rustc-check-cfg=cfg(libressl370)
  cargo:rustc-check-cfg=cfg(libressl380)
  cargo:rustc-check-cfg=cfg(libressl381)
  cargo:rustc-check-cfg=cfg(libressl382)
  cargo:rustc-check-cfg=cfg(libressl390)
  cargo:rustc-check-cfg=cfg(libressl400)
  cargo:rustc-check-cfg=cfg(ossl101)
  cargo:rustc-check-cfg=cfg(ossl102)
  cargo:rustc-check-cfg=cfg(ossl102f)
  cargo:rustc-check-cfg=cfg(ossl102h)
  cargo:rustc-check-cfg=cfg(ossl110)
  cargo:rustc-check-cfg=cfg(ossl110f)
  cargo:rustc-check-cfg=cfg(ossl110g)
  cargo:rustc-check-cfg=cfg(ossl110h)
  cargo:rustc-check-cfg=cfg(ossl111)
  cargo:rustc-check-cfg=cfg(ossl111b)
  cargo:rustc-check-cfg=cfg(ossl111c)
  cargo:rustc-check-cfg=cfg(ossl111d)
  cargo:rustc-check-cfg=cfg(ossl300)
  cargo:rustc-check-cfg=cfg(ossl310)
  cargo:rustc-check-cfg=cfg(ossl320)
  cargo:rustc-check-cfg=cfg(ossl330)
  cargo:rerun-if-env-changed=AARCH64_LINUX_ANDROID_OPENSSL_NO_VENDOR
  AARCH64_LINUX_ANDROID_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=AARCH64_LINUX_ANDROID_OPENSSL_CONFIG_DIR
  AARCH64_LINUX_ANDROID_OPENSSL_CONFIG_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_CONFIG_DIR
  OPENSSL_CONFIG_DIR unset
  OUT_DIR = Some(/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out)
  cargo:rerun-if-env-changed=CC_aarch64-linux-android
  CC_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CC_aarch64_linux_android
  CC_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `aarch64-linux-android-clang` installed?
  RUSTC_WRAPPER = Some(/Users/osp/.vscode/extensions/rust-lang.rust-analyzer-0.3.2002-darwin-arm64/server/rust-analyzer)
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(true)
  cargo:rerun-if-env-changed=CFLAGS_aarch64-linux-android
  CFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_linux_android
  CFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=AR_aarch64-linux-android
  AR_aarch64-linux-android = None
  cargo:rerun-if-env-changed=AR_aarch64_linux_android
  AR_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_AR
  TARGET_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_aarch64-linux-android
  ARFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=ARFLAGS_aarch64_linux_android
  ARFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_ARFLAGS
  TARGET_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=RANLIB_aarch64-linux-android
  RANLIB_aarch64-linux-android = None
  cargo:rerun-if-env-changed=RANLIB_aarch64_linux_android
  RANLIB_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_RANLIB
  TARGET_RANLIB = None
  cargo:rerun-if-env-changed=RANLIB
  RANLIB = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_aarch64-linux-android
  RANLIBFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_aarch64_linux_android
  RANLIBFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=TARGET_RANLIBFLAGS
  TARGET_RANLIBFLAGS = None
  cargo:rerun-if-env-changed=RANLIBFLAGS
  RANLIBFLAGS = None
  running cd "/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src" && env -u CROSS_COMPILE AR="aarch64-linux-android-ar" CC="aarch64-linux-android-clang" RANLIB="aarch64-linux-android-ranlib" "perl" "./Configure" "--prefix=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-stdio" "linux-aarch64" "-O2" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer"
  Configuring OpenSSL version 3.3.2 for target linux-aarch64
  Using os-specific seed configuration
  Created configdata.pm
  Running configdata.pm
  Created Makefile.in
  Created Makefile
  Created include/openssl/configuration.h

  **********************************************************************
  ***                                                                ***
  ***   OpenSSL has been successfully configured                     ***
  ***                                                                ***
  ***   If you encounter a problem while building, please open an    ***
  ***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
  ***   and include the output from the following command:           ***
  ***                                                                ***
  ***       perl configdata.pm --dump                                ***
  ***                                                                ***
  ***   (If you are new to OpenSSL, you might want to consult the    ***
  ***   'Troubleshooting' section in the INSTALL.md file first)      ***
  ***                                                                ***
  **********************************************************************
  running cd "/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src" && "make" "depend"
  running cd "/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,9 --jobserver-auth=8,9" "make" "build_libs"
  perl util/mkinstallvars.pl PREFIX=. BINDIR=apps APPLINKDIR=ms LIBDIR= INCLUDEDIR=include "INCLUDEDIR=./include" ENGINESDIR=engines MODULESDIR=providers "VERSION=3.3.2" "LDLIBS=-ldl -pthread " > builddata.pm
  perl "-I." "-Iutil/perl" "-Mconfigdata" "-MOpenSSL::paramnames" "util/dofile.pl" "-oMakefile" crypto/params_idx.c.in > crypto/params_idx.c
  perl util/mkinstallvars.pl "PREFIX=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install" BINDIR=bin "LIBDIR=lib" "libdir=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib" INCLUDEDIR=include APPLINKDIR=include/openssl "ENGINESDIR=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3" "MODULESDIR=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules" "PKGCONFIGDIR=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/pkgconfig" "CMAKECONFIGDIR=/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/cmake/OpenSSL" "LDLIBS=-ldl -pthread " "VERSION=3.3.2" > installdata.pm
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
  perl "-I." "-Iutil/perl" "-Mconfigdata" "-MOpenSSL::paramnames" "util/dofile.pl" "-oMakefile" include/internal/param_names.h.in > include/internal/param_names.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/asn1.h.in > include/openssl/asn1.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/asn1t.h.in > include/openssl/asn1t.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/bio.h.in > include/openssl/bio.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/cmp.h.in > include/openssl/cmp.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/cms.h.in > include/openssl/cms.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/conf.h.in > include/openssl/conf.h
  perl "-I." "-Iutil/perl" "-Mconfigdata" "-MOpenSSL::paramnames" "util/dofile.pl" "-oMakefile" include/openssl/core_names.h.in > include/openssl/core_names.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/crmf.h.in > include/openssl/crmf.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/crypto.h.in > include/openssl/crypto.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ct.h.in > include/openssl/ct.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/err.h.in > include/openssl/err.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ess.h.in > include/openssl/ess.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/fipskey.h.in > include/openssl/fipskey.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/lhash.h.in > include/openssl/lhash.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ocsp.h.in > include/openssl/ocsp.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/opensslv.h.in > include/openssl/opensslv.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/pkcs12.h.in > include/openssl/pkcs12.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/pkcs7.h.in > include/openssl/pkcs7.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/safestack.h.in > include/openssl/safestack.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/srp.h.in > include/openssl/srp.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ssl.h.in > include/openssl/ssl.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ui.h.in > include/openssl/ui.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/x509.h.in > include/openssl/x509.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/x509_vfy.h.in > include/openssl/x509_vfy.h
  perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/x509v3.h.in > include/openssl/x509v3.h
  perl "-I." "-Mconfigdata" "-Mbuilddata" "util/dofile.pl" "-oMakefile" exporters/pkg-config/libcrypto.pc.in > libcrypto.pc
  perl "-I." "-Mconfigdata" "-Mbuilddata" "util/dofile.pl" "-oMakefile" exporters/pkg-config/libssl.pc.in > libssl.pc
  perl "-I." "-Mconfigdata" "-Mbuilddata" "util/dofile.pl" "-oMakefile" exporters/cmake/OpenSSLConfig.cmake.in > OpenSSLConfig.cmake
  perl "-I." "-Mconfigdata" "-Minstalldata" "util/dofile.pl" "-oMakefile" exporters/cmake/OpenSSLConfig.cmake.in > exporters/OpenSSLConfig.cmake
  perl "-I." "-Mconfigdata" "-Minstalldata" "util/dofile.pl" "-oMakefile" exporters/pkg-config/libcrypto.pc.in > exporters/libcrypto.pc
  perl "-I." "-Mconfigdata" "-Minstalldata" "util/dofile.pl" "-oMakefile" exporters/pkg-config/libssl.pc.in > exporters/libssl.pc
  perl "-I." "-Mconfigdata" "-Mbuilddata" "-Mbuilddata" "-Mbuilddata" "util/dofile.pl" "-oMakefile" exporters/pkg-config/openssl.pc.in > openssl.pc
  perl "-I." "-Mconfigdata" "-Mconfigdata" "-Mbuilddata" "util/dofile.pl" "-oMakefile" exporters/cmake/OpenSSLConfigVersion.cmake.in > OpenSSLConfigVersion.cmake
  perl "-I." "-Mconfigdata" "-Mconfigdata" "-Mconfigdata" "-Minstalldata" "util/dofile.pl" "-oMakefile" exporters/pkg-config/openssl.pc.in > exporters/openssl.pc
  perl "-I." "-Mconfigdata" "-Mconfigdata" "-Minstalldata" "util/dofile.pl" "-oMakefile" exporters/cmake/OpenSSLConfigVersion.cmake.in > exporters/OpenSSLConfigVersion.cmake
  "/Applications/Xcode.app/Contents/Developer/usr/bin/make" depend && "/Applications/Xcode.app/Contents/Developer/usr/bin/make" _build_libs
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_cbc.o crypto/aes/aes_cbc.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_cfb.o crypto/aes/aes_cfb.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_core.o crypto/aes/aes_core.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_ecb.o crypto/aes/aes_ecb.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_ige.o crypto/aes/aes_ige.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_misc.o crypto/aes/aes_misc.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_ofb.o crypto/aes/aes_ofb.c
  aarch64-linux-android-clang  -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include  -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID  -c -o crypto/aes/libcrypto-lib-aes_wrap.o crypto/aes/aes_wrap.c
  CC="aarch64-linux-android-clang" perl crypto/aes/asm/aesv8-armx.pl "linux64" -Icrypto -I. -Iinclude -Iproviders/common/include -Iproviders/implementations/include -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -gdwarf-2 -fno-omit-frame-pointer -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3\"" -DMODULESDIR="\"/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DANDROID -DBSAES_ASM -DECP_NISTZ256_ASM -DECP_SM2P256_ASM -DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DOPENSSL_SM3_ASM -DPOLY1305_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DSM4_ASM -DSTATIC_LEGACY -DVPAES_ASM -DVPSM4_ASM  crypto/aes/aesv8-armx.S

  --- stderr
  DEBUG: all keys: APPLINKDIR, BINDIR, CMAKECONFIGDIR, ENGINESDIR, INCLUDEDIR, LDLIBS, LIBDIR, MODULESDIR, PKGCONFIGDIR, PREFIX, VERSION, libdir
  DEBUG: PREFIX = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install => PREFIX = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install
  DEBUG: libdir = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib => libdir = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib
  DEBUG: BINDIR = bin => BINDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/bin, BINDIR_REL_PREFIX = bin
  DEBUG: LIBDIR = lib => LIBDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib, LIBDIR_REL_PREFIX = lib
  DEBUG: INCLUDEDIR = include => INCLUDEDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/include, INCLUDEDIR_REL_PREFIX = include
  DEBUG: APPLINKDIR = include/openssl => APPLINKDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/include/openssl, APPLINKDIR_REL_PREFIX = include/openssl
  DEBUG: ENGINESDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3 => ENGINESDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/engines-3, ENGINESDIR_REL_LIBDIR = engines-3
  DEBUG: MODULESDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules => MODULESDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/ossl-modules, MODULESDIR_REL_LIBDIR = ossl-modules
  DEBUG: PKGCONFIGDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/pkgconfig => PKGCONFIGDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/pkgconfig, PKGCONFIGDIR_REL_LIBDIR = pkgconfig
  DEBUG: CMAKECONFIGDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/cmake/OpenSSL => CMAKECONFIGDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/install/lib/cmake/OpenSSL, CMAKECONFIGDIR_REL_LIBDIR = cmake/OpenSSL
  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 = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src
  DEBUG: libdir = . => libdir = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src
  DEBUG: BINDIR = apps => BINDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src/apps, BINDIR_REL_PREFIX = apps
  DEBUG: LIBDIR =  => LIBDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src, LIBDIR_REL_PREFIX = 
  DEBUG: INCLUDEDIR = [ include, ./include ] => INCLUDEDIR = [ /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src/include, /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src/include ], INCLUDEDIR_REL_PREFIX = [ include, ./include ]
  DEBUG: APPLINKDIR = ms => APPLINKDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src/ms, APPLINKDIR_REL_PREFIX = ms
  DEBUG: ENGINESDIR = engines => ENGINESDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src/engines, ENGINESDIR_REL_LIBDIR = engines
  DEBUG: MODULESDIR = providers => MODULESDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src/providers, MODULESDIR_REL_LIBDIR = providers
  DEBUG: PKGCONFIGDIR = . => PKGCONFIGDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src, PKGCONFIGDIR_REL_LIBDIR = .
  DEBUG: CMAKECONFIGDIR = . => CMAKECONFIGDIR = /Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src, CMAKECONFIGDIR_REL_LIBDIR = .
  /bin/sh: aarch64-linux-android-clang: command not found
  /bin/sh: aarch64-linux-android-clang: command not found
  make[1]: *** [crypto/aes/libcrypto-lib-aes_core.o] Error 127
  make[1]: *** Waiting for unfinished jobs....
  make[1]: *** [crypto/aes/libcrypto-lib-aes_cbc.o] Error 127
  /bin/sh: aarch64-linux-android-clang: command not found
  /bin/sh: aarch64-linux-android-clang: command not found
  make[1]: *** [crypto/aes/libcrypto-lib-aes_ecb.o] Error 127
  make[1]: *** [crypto/aes/libcrypto-lib-aes_ige.o] Error 127
  /bin/sh: aarch64-linux-android-clang: command not found
  make[1]: *** [crypto/aes/libcrypto-lib-aes_cfb.o] Error 127
  /bin/sh: aarch64-linux-android-clang: command not found
  make[1]: *** [crypto/aes/libcrypto-lib-aes_misc.o] Error 127
  /bin/sh: aarch64-linux-android-clang: command not found
  make[1]: *** [crypto/aes/libcrypto-lib-aes_ofb.o] Error 127
  /bin/sh: aarch64-linux-android-clang: command not found
  make[1]: *** [crypto/aes/libcrypto-lib-aes_wrap.o] Error 127
  make: *** [build_libs] Error 2
  thread 'main' panicked at /Users/osp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.3.2+3.3.2/src/lib.rs:633:9:



  Error building OpenSSL:
      Command: cd "/Users/osp/Developer/opacity-core/target/aarch64-linux-android/debug/build/openssl-sys-18fedb2de2f98f34/out/openssl-build/build/src" && MAKEFLAGS="-j --jobserver-fds=8,9 --jobserver-auth=8,9" "make" "build_libs"
      Exit status: exit status: 2


      
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
     1: core::panicking::panic_fmt
               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
     2: openssl_src::Build::run_command
               at /Users/osp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.3.2+3.3.2/src/lib.rs:633:9
     3: openssl_src::Build::build
               at /Users/osp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-src-300.3.2+3.3.2/src/lib.rs:600:13
     4: build_script_main::find_vendored::get_openssl
               at ./build/find_vendored.rs:14:21
     5: build_script_main::find_openssl
               at ./build/main.rs:53:20
     6: build_script_main::main
               at ./build/main.rs:128:35
     7: core::ops::function::FnOnce::call_once
               at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

In order to compile my project I don't use a pure cargo build command, but I use the cargo-ndk package which handles a lot of the compiler discovery for me quite nicely.

cargo ndk --target $@ --platform 31 build --release --all-features

Is there any way I can tell Rust-Analyzer which command it should use to compile my project when targeting Android?

@ospfranco ospfranco added the C-support Category: support questions label Sep 13, 2024
@ospfranco
Copy link
Author

ospfranco commented Sep 13, 2024

Searching around and reading the docs I found the overrideCommand option. I seemed to be passing the arguments wrong. This appeared to work at first:

  "rust-analyzer.cargo.target": "aarch64-linux-android",
  "rust-analyzer.cargo.buildScripts.overrideCommand": [
    "cargo",
    "ndk",
    "--target=aarch64-linux-android",
    "--platform=31",
    "check",
    "--message-format=json",
    "--all-features"
  ],

However, Rust-Analyzer is stuck in:

OSP 000341

Any idea what could be the issue? Or how to get more verbose outputs?

@ospfranco
Copy link
Author

Ok, got it working, disabling scanning of some of the folders made it work:

  "rust-analyzer.cargo.target": "aarch64-linux-android",
  "rust-analyzer.cargo.buildScripts.overrideCommand": [
    "cargo",
    "ndk",
    "--target=aarch64-linux-android",
    "--platform=31",
    "check",
    "--quiet",
    "--workspace",
    "--message-format=json",
    "--all-features"
  ],
  "rust-analyzer.files.excludeDirs": [
    "opacity-ios",
    "react-native-opacity",
    "opacity-android",
    "android",
    ".build",
    "scripts",
    "generated"
  ],

@ospfranco
Copy link
Author

OSP 000342

Ah oops, nvm, this is not working...

@ospfranco ospfranco reopened this Sep 13, 2024
@ChayimFriedman2
Copy link
Contributor

If cargo ndk has an option to emit JSON similar to cargo, you can override the command rust-analyzer runs.

If not, well... you probably need to replicate what cargo ndk is doing.

@ospfranco
Copy link
Author

cargo ndk is emitting JSON correctly. I can the the proc-macros on the output. It still somehow fails to expand them.

@ChayimFriedman2
Copy link
Contributor

Do you have check on save enabled? Did you change it too to cargo ndk? If not that could come from it.

@Veykril Veykril added the A-flycheck issues with flycheck a.k.a. "check on save" label Sep 24, 2024
@ospfranco
Copy link
Author

ospfranco commented Oct 1, 2024

Here is all the rust-analyzer the config that I use:

  "rust-analyzer.cargo.target": "aarch64-linux-android",
  "rust-analyzer.cargo.buildScripts.overrideCommand": [
    "cargo",
    "ndk",
    "--target=aarch64-linux-android",
    "--platform=31",
    "check",
    "--quiet",
    "--workspace",
    "--message-format=json",
    "--all-features"
  ],
  "rust-analyzer.files.excludeDirs": [
    "opacity-ios",
    "react-native-opacity",
    "opacity-android",
    "android",
    "scripts",
    "generated"
  ],
  "rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro"],
  "rust-analyzer.files.watcher": "server",
  "rust-analyzer.cargo.features": "all",

The "rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro"], is too prevent the errors with the macros I last described. checkOnSave is true by default, but even when setting it manually I still get No proc-macros present for crate

@Veykril
Copy link
Member

Veykril commented Oct 1, 2024

Take a look at #12335 which is I think about the same thing (I haven't read through it yet), maybe there is some info in there as well

@ospfranco
Copy link
Author

Just went through it and yeah, it basically does the same thing. I'm using overrideCommand instead of checkOnSave which I guess has been removed since I cannot find any other option on the settings. No new info though, pretty much does the same thing I do.

@Veykril
Copy link
Member

Veykril commented Oct 1, 2024

Are the logs still saying that build scripts are not building correctly? (that would explain the proc-macros not resolving).

Also it might be good to set RA_LOG env var to warn,project_model=info (you can do that via a vscode setting for ease):

    "rust-analyzer.server.extraEnv": {
        "RA_LOG": "warn,project_model=info",
    },

That should make your logs contain lines like


2024-10-01T05:08:14.363840Z  INFO C:\Users\lukas\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.208: BuildScriptOutput { cfgs: [], envs: Env { entries: {} }, out_dir: None, proc_macro_dylib_path: Some(AbsPathBuf("C:\\Users\\lukas\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\serde_derive-88bb7528765cefeb.dll")) }

when the build script step is successful, that might help figure out why you are lacking proc-macros. Either I imagine the ndk command might not be reporting the host build dependencies properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-flycheck issues with flycheck a.k.a. "check on save" C-support Category: support questions
Projects
None yet
Development

No branches or pull requests

3 participants