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

Executables compiled by Android NDK cannot compile the schema files #2023

Open
WhiredPlanck opened this issue May 3, 2024 · 3 comments
Open

Comments

@WhiredPlanck
Copy link

The Android NDK version is "25.2.9519653".

The log will report like:

 /bin/sh: 1: /data/Projects/Android/trime/app/build/intermediates/cxx/Debug/1z5n4h2v/obj/x86/capnp: not found

I tried to ldd the generated executables and reports:

$ ldd capnp 
    linux-gate.so.1 (0xf7f3e000)
    libm.so => not found
    libdl.so => not found
    libc.so => not found
@WhiredPlanck WhiredPlanck changed the title Executables compiled by Android NDK cannot to compile the schema files Executables compiled by Android NDK cannot compile the schema files May 3, 2024
@kentonv
Copy link
Member

kentonv commented May 6, 2024

Hmm, why do you need to run the capnp binary on Android? Seems unusual to be running CLI tools on a phone...

Our CI verifies that all the unit tests pass on Android, but admittedly it cross-compiles the tests, so it doesn't attempt to run the capnp binary on Android directly.

In any case, I'm happy to accept a PR to fix this but I don't have bandwidth to investigate it myself.

@WhiredPlanck
Copy link
Author

WhiredPlanck commented May 7, 2024

Hmm, why do you need to run the capnp binary on Android? Seems unusual to be running CLI tools on a phone...

Our CI verifies that all the unit tests pass on Android, but admittedly it cross-compiles the tests, so it doesn't attempt to run the capnp binary on Android directly.

In any case, I'm happy to accept a PR to fix this but I don't have bandwidth to investigate it myself.

Well, I actually just need the binary to build the schema files on the build time.

In my case, the Android app project uses a native library whose APIs are able to return the data in Can'Proto format, and I would like to utilize them to get data in the app frontend from the native backend (via JNI or else). Naturally I want to just add_subdirectory(/path/to/capnproto/source)in CMakeLists.txt before to build the library itself and hope everything works fine, but it seems that I need to use the binary on the host. But I have no idea about the cross-architecture stuffs.

@kentonv
Copy link
Member

kentonv commented May 8, 2024

Oh, your problem is that you've built a binary targeting Android but you're trying to run it on your build host which is not Android?

What you should do is first build the binaries for the host system, install them, and then when you build for android, use ./configure --with-external-capnp. This tells the build to use the installed version of capnp instead of the version it compiles. (If you don't want to install the binaries into your PATH, you can instead set the environment variable CAPNP to point at its location.)

Unfortunately I don't know how the cmake build works so I don't know how to do the equivalent with cmake, but it's probably possible.

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

No branches or pull requests

2 participants