llvm-swift / LLVMSwift

A Swift wrapper for the LLVM C API (version 11.0)
MIT License
743 stars 55 forks source link

iOS Build #236

Open franktinsley opened 3 years ago

franktinsley commented 3 years ago

Trying to build to iOS with LLVMSwift included and I hit the error 'shared_timed_mutex' is unavailable: introduced in iOS 10.0. I assume iOS isn't supported by LLVMSwift but it does appear that it's possible to include LLVM in iOS apps. Any hints on how I might use LLVMSwift in an iOS build would be most appreciated. Trying to make my own toy programming language that works on iOS. Thanks!

matthewseaman commented 3 years ago

Indeed, LLVMSwift is not currently designed with iOS support in mind.

That said, it looks like virtually all the warnings and errors that result from trying to build for iOS lie in LLVM's header files, not LLVMSwift. So, although I do not know exactly what would be involved in adding that support, I suspect it requires getting an iOS-specific version of LLVM (or at least one compiled for iOS). When you do brew install llvm, it's giving you the macOS version compiled specifically for the host OS/arch of your host machine.

I myself am not sure how to obtain a version of cllvm compiled for iOS, nor do I know the best way to guarantee or rely on its availability in an iOS app, but this might be something worth asking the LLVM community.

If you do figure this out and it's simple enough to enable iOS support in LLVMSwift (or perhaps it's just a matter of how to install LLVM that can be added to the README), feel free to post a PR here!