irondash / cargokit

Integrate cargo build with flutter plugins and applications.
Other
51 stars 16 forks source link

Building for android on Linux using ndk r23 and newer, builtin symbols cannot be found #24

Closed julian-CStack closed 9 months ago

julian-CStack commented 9 months ago

dlopen failed: cannot locate symbol "__extenddftf2" specifically

Discussion of the issue: https://github.com/termux/termux-packages/issues/8029

https://github.com/termux/termux-packages/issues/8029#issuecomment-976716012 may work. What would the best way be to pass something like this LDFLAGS through to cargokit?

I believe it would only be required for Android when Linux is the host system. I did not run into this while building for Android on MacOS.

Possibly related to https://github.com/irondash/cargokit/issues/23

julian-CStack commented 9 months ago

Using ndkVersion "21.1.6352462" does seem to work fine when running on Android from AndroidStudio on either Linux or MacOS. However doing flutter build apk fails with (on both MacOS and Linux):

...
SEVERE:           SEVERE: /Users/julian/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: fatal error: out of file descriptors and couldn't close any
...

I can paste the whole error out if that short snippet doesn't mean anything

julian-CStack commented 9 months ago

A couple more links: https://github.com/mozilla/application-services/pull/5442 https://github.com/edgeguard-dev/rusqlite/pull/1/files

knopp commented 9 months ago

Linker flags are not something cargokit should interfere with. You can specify linker flag in build.rs similar to how https://github.com/mozilla/application-services/pull/5442 does it. This is at crate level, not cargokit level.

As for the number of file descriptor, this is again not cargokit related. There are commands for for both systems that increase maximum number of descriptors, but if it's not a problem with newer NDK version it means it's a problem with older ld version.