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

cargo cinstall fails on Android and iOS because there's no shared libs #278

Closed
nirbheek opened this issue Sep 2, 2022 · 10 comments
Closed
Labels
A-Cargo-problem A problem related to cargo itself

Comments

@nirbheek
Copy link
Contributor

nirbheek commented Sep 2, 2022

Error: CliError { error: Some(failed to copy `/home/nirbheek/projects/repos/cerbero.git/rust/build/sources/android_universal/armv7/gst-plugins-rs-0.8.4.9999/_builddir/armv7-linux-androideabi/release/libgstrsjson.so` to `/home/nirbheek/projects/repos/cerbero.git/rust/build/dist/android_universal/armv7/lib/gstreamer-1.0/libgstrsjson.so`

Caused by:
    No such file or directory (os error 2)), exit_code: 101 }
Error: CliError { error: Some(failed to copy `/Users/nirbheek/projects/repos/cerbero.git/rust/build/sources/ios_universal/arm64/gst-plugins-rs-0.8.4.9999/_builddir/aarch64-apple-ios/release/libgstrsaudiofx.dylib` to `/Users/nirbheek/projects/repos/cerbero.git/rust/build/dist/ios_universal/arm64/lib/gstreamer-1.0/libgstrsaudiofx.dylib`

Caused by:
    No such file or directory (os error 2)), exit_code: 101 }

Cross-compiling to macOS arm64 works fine, and explicitly passing --library-type cdylib --library-type staticlib doesn't change anything.

@lu-zero
Copy link
Owner

lu-zero commented Sep 2, 2022

Looks like upstream decided that making cdylibs is not supported somehow.

@nirbheek
Copy link
Contributor Author

nirbheek commented Sep 2, 2022

Did you find some issues / PRs that should be linked from here?

@lu-zero
Copy link
Owner

lu-zero commented Sep 2, 2022

Sadly not, if you run cargo build --target {*-ios} or such you'll see the warning.

@nirbheek
Copy link
Contributor Author

nirbheek commented Sep 2, 2022

The main issue for iOS seems to be rust-lang/rust#21727, the major blocker is rust-lang/rust#95847 (comment). One potential fix would be rust-lang/cargo#4881.

Cargo doesn't seem to emit any warnings for Android though, and I can't find any issues about that either.

@lu-zero
Copy link
Owner

lu-zero commented Sep 2, 2022

the lib in android is somehow missing in target or the naming logic got a quirk? Thank you a lot for testing :)

@lu-zero
Copy link
Owner

lu-zero commented Sep 2, 2022

I tested locally and the ndk21 works fine and it installs for android...

❯ cargo cinstall --manifest-path=example-project/Cargo.toml --target aarch64-linux-android --destdir=/tmp/android21
   Compiling proc-macro2 v1.0.43
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.3
   Compiling syn v1.0.99
   Compiling serde_derive v1.0.144
   Compiling serde v1.0.144
   Compiling semver v1.0.13
   Compiling serde_json v1.0.85
   Compiling camino v1.1.1
   Compiling ryu v1.0.11
   Compiling itoa v1.0.3
   Compiling libc v0.2.132
   Compiling cargo-platform v0.1.2
   Compiling cargo_metadata v0.14.2
   Compiling example-project v0.1.0 (/Users/lu_zero/Sources/rust/cargo-c/example-project)
    Finished release [optimized] target(s) in 15.82s
    Building pkg-config files
    Building header file using cbindgen
  Populating uninstalled header directory
  Installing pkg-config file
  Installing header file
  Installing static library
  Installing shared library
❯ tree /tmp/android21/
/tmp/android21/
└── usr
    └── local
        ├── include
        │   ├── example-project-0.1
        │   │   └── example_project
        │   │       ├── example_project.h
        │   │       ├── file.h
        │   │       ├── generated.h
        │   │       └── subdir
        │   │           └── in_subdir.h
        │   └── otherplace
        │       └── other_file.h
        └── lib
            ├── libexample-project.a
            ├── libexample-project.so -> libexample-project.so.0.1.0
            ├── libexample-project.so.0 -> libexample-project.so.0.1.0
            ├── libexample-project.so.0.1.0
            └── pkgconfig
                └── example_project.pc

@lu-zero lu-zero added the A-Cargo-problem A problem related to cargo itself label Sep 2, 2022
@lu-zero
Copy link
Owner

lu-zero commented Sep 2, 2022

Also cargo-c already sets the crate-type so all you need is to revert the revert (and point whoever is developing cargo-mobile now here)

@lu-zero
Copy link
Owner

lu-zero commented Jul 18, 2023

@nirbheek is this still a problem?

@lu-zero
Copy link
Owner

lu-zero commented Oct 10, 2023

@nirbheek is there anything left to be done about this?

@nirbheek
Copy link
Contributor Author

Seems to be fixed! Thanks for checking in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Cargo-problem A problem related to cargo itself
Projects
None yet
Development

No branches or pull requests

2 participants