joaovarelas / Obfuscator-LLVM-16.0

GNU General Public License v3.0
84 stars 16 forks source link

Not supported aarch64-linux-android #7

Closed androiddisk closed 3 months ago

androiddisk commented 4 months ago
RUSTCFLAGS="-Cllvm-args=-enable-allobf" cargo +ollvm-rust-1.70.0 build --target aarch64-linux-android --release
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/usr/local/rustup/toolchains/ollvm-rust-1.70.0/bin/rustc - --crate-name ___ --print=file-names --target aarch64-linux-android --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  error: could not create LLVM TargetMachine for triple: aarch64-linux-android: No available targets are compatible with triple "aarch64-unknown-linux-android"

May I ask how to solve it

androiddisk commented 4 months ago
root@0d112bc30355:/projects# rustup target add aarch64-linux-android
error: toolchain 'ollvm-rust-1.70.0' does not support components: ollvm-rust-1.70.0 is a custom toolchai
joaovarelas commented 3 months ago

Hello

Current targets specified in https://github.com/joaovarelas/Obfuscator-LLVM-16.0/blob/main/Dockerfile#L102

are ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-gnu"]

I don't know if it works for android. You can test and let me know

EDIT: look into https://obfuscator.re/omvll/

androiddisk commented 3 months ago
--- config.toml.example 2024-03-07 21:01:34.072409871 +0800
+++ config.toml 2024-03-08 02:40:51.750035970 +0800
@@ -207,7 +207,7 @@
 # host triples to this list as well in order for those host toolchains to be
 # able to compile programs for their native target.
 #target = ["x86_64-unknown-linux-gnu"] (as an example)
-
+target = ["x86_64-unknown-linux-gnu", "aarch64-linux-android"]
 # Use this directory to store build artifacts.
 # You can use "$ROOT" to indicate the root of the git repository.
 #build-dir = "build"
@@ -400,7 +400,7 @@
 #       "maximally debuggable" environment (notably libstd) takes
 #       hours to build.
 #
-#debug = false
+debug = false

 # Whether to download the stage 1 and 2 compilers from CI.
 # This is mostly useful for tools; if you have changes to `compiler/` they will be ignored.
@@ -527,7 +527,7 @@
 # The "channel" for the Rust build to produce. The stable/beta channels only
 # allow using stable features, whereas the nightly and dev channels allow using
 # nightly features
-#channel = "dev"
+channel = "nightly"

 # A descriptive string to be appended to `rustc --version` output, which is
 # also used in places like debuginfo `DW_AT_producer`. This may be useful for
@@ -617,7 +617,7 @@
 #thin-lto-import-instr-limit = if incremental { 10 } else { LLVM default (currently 100) }

 # Map debuginfo paths to `/rust/$sha/...`, generally only set for releases
-#remap-debuginfo = false
+remap-debuginfo = true

 # Link the compiler against `jemalloc`, where on Linux and OSX it should
 # override the default allocator for rustc and LLVM.
@@ -757,6 +757,11 @@
 # These options are related to distribution, mostly for the Rust project itself.
 # You probably won't need to concern yourself with any of these options
 # =============================================================================
+
+[target.aarch64-linux-android]
+android-ndk = "/root/kooapk/kooapk-kitchen/tmp/android-ndk-r25b/android-ndk"
+ar = "/root/kooapk/kooapk-kitchen/tmp/android-ndk-r25b/android-ndk/bin/llvm-ar"
+linker = "/root/kooapk/kooapk-kitchen/tmp/android-ndk-r25b/android-ndk/bin/aarch64-linux-android-clang"
 [dist]

 # This is the folder of artifacts that the build system will sign. All files in

need

target = ["x86_64-unknown-linux-gnu", "aarch64-linux-android"]
[target.aarch64-linux-android]
android-ndk = "/root/kooapk/kooapk-kitchen/tmp/android-ndk-r25b/android-ndk"
ar = "/root/kooapk/kooapk-kitchen/tmp/android-ndk-r25b/android-ndk/bin/llvm-ar"
linker = "/root/kooapk/kooapk-kitchen/tmp/android-ndk-r25b/android-ndk/bin/aarch64-linux-android-clang"
androiddisk commented 3 months ago

@joaovarelas Compilation requires referencing android NDK files