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

[Question] Is it possible to create a shared library/framework that works in both iOS and MacOs arm64? #124

Open
ceztko opened this issue Jan 3, 2022 · 3 comments

Comments

@ceztko
Copy link

ceztko commented Jan 3, 2022

I was wondering if it could be theoretically possible for XCode to produce non-FAT binaries that works in both iOS/MacOS. Provided there's an ABI that works in both the operating systems and that the binaries only use hardware instructions/OS API(s) that are available in both CPU/OS(es), this would be feasible and would help reducing the matrix of builds to support. The question is if such cross-platform target actually exists and can be used in XCode toolchains hence ios-cmake.

@kambala-decapitator
Copy link

impossible afaik because libraries contain platform info which they were built against. Sample output from otool -l on a dylib:

Load command 9
      cmd LC_VERSION_MIN_IPHONEOS
  cmdsize 16
  version 9.0
      sdk 14.5

@kambala-decapitator
Copy link

also check this: https://bogo.wtf/arm64-to-sim-dylibs.html

@ceztko
Copy link
Author

ceztko commented Feb 15, 2022

Ok, let's assume having cross iOS/macos binaries is not feasible. My point was trying to reduce compilation times by reducing the build matrix of a complex project that has many open source 3rd party dependencies (9 deps and still growing...). If I have to support both macos and iOS experience + simulators (no watch/tv OSes) this means, using @leetal architectures:

MAC (macox_x86_64)
MAC_ARM64 (macox_arm64)
OS64 (ios-arm64)
SIMULATOR64 (ios-simulator-x86_64)
SIMULATORARM64 (ios-simulator-arm64)

If I could create arm64 macos framework and hack them to work in the simulator, and the hack is easily scriptable, I could technically have one arch less to compile project+dependencies. If I could similarly hack a x86_64 macos framework to work in the simulator that would mean in total 2 architectures less to compile.

This is definitely out of project purpose but if @leetal has other suggestions as well that would be very appreciated. In the mean time I can verify if the hacks work.

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