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

rust version 1.66.1 build android-jni cdylib Command error 127 #1830

Open
dingwujiang opened this issue Mar 2, 2023 · 12 comments
Open

rust version 1.66.1 build android-jni cdylib Command error 127 #1830

dingwujiang opened this issue Mar 2, 2023 · 12 comments
Labels

Comments

@dingwujiang
Copy link

/Users/wolf/Library/Android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar: creating libcrypto.a
/bin/sh: arm-linux-androideabi-ranlib: command not found
/Users/wolf/Library/Android/sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar: creating libssl.a
/bin/sh: arm-linux-androideabi-ranlib: command not found
/bin/sh: arm-linux-androideabi-ranlib: command not found
make: *** [install_dev] Error 127
thread 'main' panicked at '

Error installing OpenSSL:
Command: "make" "install_dev"
Exit status: exit status: 2

  ', /Users/wolf/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-src-111.25.1+1.1.1t/src/lib.rs:509:13

stack backtrace:
0: 0x10f422982 - std::backtrace_rs::backtrace::libunwind::trace::hf6d6e64f9b264809
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x10f422982 - std::backtrace_rs::backtrace::trace_unsynchronized::h83629c2e54dbbc12
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x10f422982 - std::sys_common::backtrace::_print_fmt::h40995e5769fa5524
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:65:5
3: 0x10f422982 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8d94e552d95b28cc
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:44:22
4: 0x10f43d0ea - core::fmt::write::h421d4212716e9716
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/fmt/mod.rs:1209:17
5: 0x10f41ee7c - std::io::Write::write_fmt::hdc28b71c2d62dad8
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/io/mod.rs:1682:15
6: 0x10f42274a - std::sys_common::backtrace::_print::habfe2bb38db219c3
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:47:5
7: 0x10f42274a - std::sys_common::backtrace::print::he11eab6b959c3b5b
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:34:9
8: 0x10f424b86 - std::panicking::default_hook::{{closure}}::ha68ba8cbe26bbbe3
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:267:22
9: 0x10f4248d7 - std::panicking::default_hook::h5cf85224a4df5bc6
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:286:9
10: 0x10f4252cd - std::panicking::rust_panic_with_hook::hed342721bf9addfa
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:688:13
11: 0x10f425083 - std::panicking::begin_panic_handler::{{closure}}::h3d9af89e51f2fba9
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:579:13
12: 0x10f422e18 - std::sys_common::backtrace::__rust_end_short_backtrace::hfb9719355016e93f
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:137:18
13: 0x10f424d4d - rust_begin_unwind
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:575:5
14: 0x10f448043 - core::panicking::panic_fmt::h1965fc2159be50bb
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/panicking.rs:65:14
15: 0x10f389506 - openssl_src::Build::run_command::h6991af1d576b92d7
at /Users/wolf/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-src-111.25.1+1.1.1t/src/lib.rs:509:13
16: 0x10f388d78 - openssl_src::Build::build::hb6edb64db113f4eb
at /Users/wolf/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-src-111.25.1+1.1.1t/src/lib.rs:485:13
17: 0x10f3512e0 - build_script_main::find_vendored::get_openssl::ha26c352685bfe126
at /Users/wolf/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-sys-0.9.80/build/find_vendored.rs:5:21
18: 0x10f34b5e3 - build_script_main::find_openssl::hdbcf41a57083f469
at /Users/wolf/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-sys-0.9.80/build/main.rs:57:20
19: 0x10f34b734 - build_script_main::main::h0a2ca7b608a884ff
at /Users/wolf/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/openssl-sys-0.9.80/build/main.rs:80:35
20: 0x10f35569e - core::ops::function::FnOnce::call_once::h157f0a473180b5eb
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:251:5
21: 0x10f34fd91 - std::sys_common::backtrace::__rust_begin_short_backtrace::hafda41898ebc51fc
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/sys_common/backtrace.rs:121:18
22: 0x10f356fa4 - std::rt::lang_start::{{closure}}::hb8748a6b6d83ec08
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:166:18
23: 0x10f41a2c4 - core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once::h876a81bfbfbf7dbd
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/ops/function.rs:286:13
24: 0x10f41a2c4 - std::panicking::try::do_call::hb6eb6d47c9dfec1f
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:483:40
25: 0x10f41a2c4 - std::panicking::try::h414888b29889cbcb
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:447:19
26: 0x10f41a2c4 - std::panic::catch_unwind::h7afb8146105b2697
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panic.rs:137:14
27: 0x10f41a2c4 - std::rt::lang_start_internal::{{closure}}::ha2ee572c3866be4c
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:148:48
28: 0x10f41a2c4 - std::panicking::try::do_call::h82662207cd7c76a9
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:483:40
29: 0x10f41a2c4 - std::panicking::try::hed70fec8d8e154f7
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:447:19
30: 0x10f41a2c4 - std::panic::catch_unwind::h3a1314c401e90464
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panic.rs:137:14
31: 0x10f41a2c4 - std::rt::lang_start_internal::haf0419567751b65f
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:148:20
32: 0x10f356f77 - std::rt::lang_start::hc6cfc96f56a15748
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/rt.rs:165:17
33: 0x10f34f1e8 - _main
34: 0x7ff817cc8310 -

@niuhuan
Copy link

niuhuan commented Mar 9, 2023

I also met this problem on ubuntu.
Macos does not have this problem.

@Skepfyr
Copy link
Collaborator

Skepfyr commented Mar 12, 2023

This isn't really enough information to debug the issue, what platform are you on, what are you platform targeting, how are you expecting to source OpenSSL. At a guess M1/M2 Mac, targeting android, using the vendored attribute to automatically build the right OpenSSL. How have you installed the android SDK, has this ever worked?

@niuhuan Note that the original reporter is probably on macOS, so your comment directly contradicts theirs. Any ideas how you've set up your environment differently?

My best guess for what's happening here is that it's the same issue as #1839, that is it's caused by alexcrichton/openssl-src-rs#173. Do you know what ranlib was being used prior to openssl-src 111.25.1+1.1.1t?

@Skepfyr Skepfyr added the bug label Mar 12, 2023
@niuhuan
Copy link

niuhuan commented Mar 13, 2023

I am so sorry English is difficult for me.

my android ndk version is 25.2.9519653 . (I tried both 22 and 25). using latest cargo-ndk

I'm say mean, I try to keep the same variable, but it doesn't reappear in macos m1.

I not dependency openssl-src, Maybe I should try it


       host: ubuntu-latest

      - name: Setup java
        uses: actions/setup-java@v3
        with:
          java-version: 8
          distribution: 'zulu'

      - name: Setup android tools
        uses: maxim-lobanov/setup-android-tools@v1
        with:
          packages: |
            platform-tools
            platforms;android-33

      - name: shell
        run: |
          cargo install cargo-ndk
          cargo ndk -t armeabi-v7a build --release

[target.'cfg(any(target_os = "ios", target_os = "android", target_os = "macos"))'.dependencies]
openssl = { version = "0.10.45", features = ["vendored"] }

@dingwujiang
Copy link
Author

This isn't really enough information to debug the issue, what platform are you on, what are you platform targeting, how are you expecting to source OpenSSL. At a guess M1/M2 Mac, targeting android, using the vendored attribute to automatically build the right OpenSSL. How have you installed the android SDK, has this ever worked?

@niuhuan Note that the original reporter is probably on macOS, so your comment directly contradicts theirs. Any ideas how you've set up your environment differently?

My best guess for what's happening here is that it's the same issue as #1839, that is it's caused by alexcrichton/openssl-src-rs#173. Do you know what ranlib was being used prior to openssl-src 111.25.1+1.1.1t?

I will have a try , thank you

@ArthurKValladares
Copy link

Also running into this problem, on an intel mac, targeting Android. Running OpenSSL 10.52, with the vendored feature:
openssl = { version = "0.10.52", features = ["vendored"] }

@n-prat
Copy link

n-prat commented Jun 22, 2023

I also hit this issue with NDK 25 (on Arch, but not relevant), and also using vendored.

That is because since NDK > 22 (so 23+), ranlib is not "cross-compile specific" anymore; it is a simple symlink.
CHECK with eg find -L ~/Android/Sdk/ -type f -name "*ranlib*"

To compile, you need to make sure the correct env var is set: e.g. export RANLIB_$cargo_target=${toolchains_prebuilt_bin_path}/llvm-ranlib
Not sure how to do it if using cargo-ndk, because I am using a custom script.

@nickming
Copy link

nickming commented Jul 6, 2023

Hello, have you solved this problem? I use ndk21 and I keep compiling and reporting errors.

@nickming
Copy link

nickming commented Jul 6, 2023

@n-prat can you share the custom script,thank you!

@n-prat
Copy link

n-prat commented Jul 6, 2023

Yes, but this is not going to be that useful to you because I cross compiling via Gradle.
A better starting point would be to set the same env vars as cargo-ndk[which are mostly the same env vars I am using].

Also the RANLIB_ env var is only needed for NDK 22+ so this is probably not related to your error. What is your error anyway? Are you sure it is related to this issue?

Also also, you should update your NDK because using an unsupported one will cause you trouble.

@nickming
Copy link

Yes, but this is not going to be that useful to you because I cross compiling via Gradle. A better starting point would be to set the same env vars as cargo-ndk[which are mostly the same env vars I am using].

Also the RANLIB_ env var is only needed for NDK 22+ so this is probably not related to your error. What is your error anyway? Are you sure it is related to this issue?

Also also, you should update your NDK because using an unsupported one will cause you trouble.
Finally, I had solve this error cause I pinned the rust version to 1.67.0

@sleeyax
Copy link

sleeyax commented Aug 5, 2023

Same issue using NDK 21.0.6113669...

@nickming
Copy link

nickming commented Aug 9, 2023

Finally, I had solve this error cause I pinned the rust version to 1.67.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants