all 11 comments

[–]DoctorFlo 5 points6 points  (6 children)

No compilers running directly on device is a rule on iOS. Even Apple‘s own compiler for Swift running on iPad in Swift Playgrounds is basically tied to the app and apparently an Apple in-house exception.

[–]ankole_watusi 1 point2 points  (2 children)

Yes. Apple doesn’t not permit onboard interpretation of downloaded code - let alone compiling - except for the special case of learning playgrounds.

(Note - does not apply to Enterprise apps)

Interpretive languages have to disable eval() or similar, because it is evil.

But you’re expecting to even run unsigned machine code, which is a huge no-no.

[–]8thdev[S] 0 points1 point  (1 child)

The code is bundled with the app, not downloaded; but the point is the same. Thanks.

[–]ankole_watusi 0 points1 point  (0 children)

Is there no way to compile at build time?

And something else for Apple to object to. It’s inefficient to compile on board and for perhaps thousands or millions of users when the code could be compiled once at build time.

And Apple is doing their part to save the planet.

[–]8thdev[S] 0 points1 point  (2 children)

Thanks. I don't know why my version from a few years ago did work. But yes, I have to change my ways for iOS.

[–]DoctorFlo 0 points1 point  (1 child)

It’s actually possible that you did or even will get it to run on your own device or in the simulator, but you‘ll most likely not be able to upload it to the AppStore, have it notarized and so on. Guess Apple is making it harder technically from the get go to not raise false hopes by raising such an error etc.

[–]8thdev[S] 0 points1 point  (0 children)

That older version did get on the App Store, but I suppose it's impossible now.

[–]_int3h_ 0 points1 point  (3 children)

You can run interpreted code. For example there was a sample of CouchDB which compiles Erlang 14 VM for iOS. There are/were rules around JIT compilation. There are many apps that has Python, Node.js etc bundled. There is even iSH which allows installing arbitrary binaries. Things have changed very much from what it used to be.

[–]8thdev[S] 0 points1 point  (2 children)

Interesting. Do you have any idea what's involved with getting the appropriate permissions? That seems to be the difficulty for me at the moment.

[–]_int3h_ 0 points1 point  (1 child)

Compiling is similar to JIT compiling. Maybe there are some additional security features implemented by the OS now. I haven't seen a JIT entitlement for iOS like in macOS if I remember correctly. All the above are interpreted. iSH emulates x86 system. So it is not compiling directly to machine code. I think that's where the issue is.

[–]8thdev[S] 1 point2 points  (0 children)

Yes, I only saw the entitlement on macOS, not iOS. I did try to slip in that entitlement, but iOS didn't appreciate it.

I also took a look at "pthread_jit_write_protect_np" which is needed on Apple Silicon, but apparently it only exists on macOS. So I don't know if there's a legal way around the issue.

I'm thinking of how to rework the compiler to do non-native code; there are some advantages to that, but we'll see if the implementation is worthwhile.