Giter VIP home page Giter VIP logo

Comments (7)

knopp avatar knopp commented on July 28, 2024

The target (and minimum version) is specified in cflags (i.e. --target=aarch64-linux-android21). If you look at the aarch64-linux-android21-clang file it's just a wrapper that adds the --target argument.

from cargokit.

knopp avatar knopp commented on July 28, 2024

Also the linker error looks like you need to link with libc++, so a missing linker flag, but Rust doesn't use libc++ so I'd assume that whichever crate is compiling and linking c++ code should take care of that.

from cargokit.

ig-garcia avatar ig-garcia commented on July 28, 2024

Also the linker error looks like you need to link with libc++, so a missing linker flag, but Rust doesn't use libc++ so I'd assume that whichever crate is compiling and linking c++ code should take care of that.

The C library I am compiling is not compiling inside Rust itself, it is compiled in the build.rs file of my Rust crate but I am using the Rust std::process::Command crate to actually call the make and make install commands of the C library, passing to it the parameters needed for each Android arch.

from cargokit.

knopp avatar knopp commented on July 28, 2024

I think on Android you can either manually link with libc++_static.a, or have to include libc++_shared.so in your APK.

https://developer.android.com/ndk/guides/cpp-support#selecting_a_c_runtime

from cargokit.

ig-garcia avatar ig-garcia commented on July 28, 2024

The target (and minimum version) is specified in cflags (i.e. --target=aarch64-linux-android21). If you look at the aarch64-linux-android21-clang file it's just a wrapper that adds the --target argument.

Finally I verified our C library does not like the format of the compiler + flags from Cargokit, so I will set them manually from paths.

I see there is a env var called CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER, is it supposed to be used as the LD (linker) in the environment or similar?

from cargokit.

ig-garcia avatar ig-garcia commented on July 28, 2024

I think on Android you can either manually link with libc++_static.a, or have to include libc++_shared.so in your APK.

https://developer.android.com/ndk/guides/cpp-support#selecting_a_c_runtime

I actually included the libc++_shared.so in the APK, in the arm64-v8a folder, but somehow when is packaged into the APK the library loses all its symbols. On the other hand, if I copy same library to an aarch64 folder the symbols are kept, but of course Android does not use it.

from cargokit.

knopp avatar knopp commented on July 28, 2024

Finally I verified our C library does not like the format of the compiler + flags from Cargokit, so I will set them manually from paths.

I have no idea what that means. The --target argument is a clang argument, nothing to do with your library, unless there is no way to pass custom compile flags, which woould be very weird.

I actually included the libc++_shared.so in the APK, in the arm64-v8a folder, but somehow when is packaged into the APK the library loses all its symbols.

gradle strips libraries (there is a way to configure it not to at project level), but public symbols should not get stripped.

from cargokit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.