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

Native libs for iOS aarch64/x86_64 #745

Open
philip-han opened this issue Jul 15, 2022 · 7 comments
Open

Native libs for iOS aarch64/x86_64 #745

philip-han opened this issue Jul 15, 2022 · 7 comments
Labels
platform request Request for support for a new platform/os/architecture

Comments

@philip-han
Copy link

I've tried latest release on iOS using GraalVM but it crashes because iOS native libs are not included.

A simple insert worked with the last pure Java version but I doubt that it will work much beyond that.

Is it possible to to build native iOS native libs using Intel Mac? I could give it a try if someone could give me some pointers.

@gotson
Copy link
Collaborator

gotson commented Jul 18, 2022

to make the builds reproducible and updatable to future versions, this project tries to always build the native libs using Docker containers with cross-compilation (https://github.com/dockcross/dockcross).

The exception is M1 macs, which are compiled by Xerial directly (since there is no cross-compilation containers for that yet).

@gotson gotson added the platform request Request for support for a new platform/os/architecture label Jul 26, 2022
@gotson
Copy link
Collaborator

gotson commented Aug 6, 2022

@philip-han I'm not familiar with ios, what does it run exactly in terms of cpu architecture and OS?

Do you have logs from the graalvm execution?

@philip-han
Copy link
Author

philip-han commented Aug 8, 2022

@gotson I get this error message from xerial when running on iOS simulator on Intel Mac

"No native library found for os.name=iOS, os.arch=x86_64"

I believe this error is coming from OSInfo.java.

On real iPhone, os.arch would be aarch64. My code works when I'm targeting Mac desktop since Mac native libs are included.

Also, xerial 3.7.2 pure java mode works too on iOS but I don't want to use such outdated version.

@gotson
Copy link
Collaborator

gotson commented Aug 9, 2022

OSInfo maps the OS and architecture to a native library on disk.

iOS is not a known OS so it returns iOS but can't find a library for that value.

If iOS can run macOS binaries, you could try to add a check for iOS here, it would then load the macOS native library.

@philip-han
Copy link
Author

philip-han commented Aug 9, 2022

iOS cannot run mac binaries, hence my request for iOS/x86_64 and iOS/aarch64 native libs.

I'm going to research if I can cross compile iOS libs on my Mac at some time.

iOS sdk does provide sqlite libs in it's own format which contains both aarch64 and x86_64, going to see if that could be used here.

@gotson
Copy link
Collaborator

gotson commented Aug 10, 2022

iOS sdk does provide sqlite libs in it's own format

what format is that ?

@philip-han
Copy link
Author

iOS sdk distributes .tdb files which turns out to be just a stub file in yaml format. Ultimately, it resolves to .dylib file which is standard.

It loaded but results in unsatisfied link error in NativeDB.java

java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open_utf8([BI)V [symbol: Java_org_sqlite_core_NativeDB__1open_1utf8 or Java_org_sqlite_core_NativeDB__1open_1utf8___3BI] at com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:153) at com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:52) at org.sqlite.core.NativeDB._open_utf8(NativeDB.java:-1) at org.sqlite.core.NativeDB._open(NativeDB.java:72) at org.sqlite.core.DB.open(DB.java:211)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform request Request for support for a new platform/os/architecture
Projects
None yet
Development

No branches or pull requests

2 participants