How do I compile libffi for iOS & macOS?

China☆狼群 提交于 2019-12-10 15:52:57

问题


I'm trying to use libffi in one of my projects, but I can't seem to compile for iOS (or macOS, for that matter). Here is one of the various errors I've encountered while building for the iOS Simulator:

bash: src/arm/gentramp.sh: No such file or directory

Update 1: Since the question remains unanswered, I've decided to open an issue at the official repository as well.

Update 2: Question has been answered and the issue has been closed!


回答1:


generate-darwin-source-and-headers.py and the libffi.xcodeproj need to be updated to include all currently relevant source files.

The gentramp.sh script is not needed anymore and the current upstream xcodeproj is not up to date either with compilation settings and to be included source files for 64-bit on iOS. A patched fork can be found at https://github.com/ksjogo/libffi




回答2:


If you check the repository you will see that the file you require was deleted in this commit. You can find the last version of this file here.




回答3:


Please make sure you are following the installing libffi instructions released on the TBD or git project: https://github.com/libffi/libffi

Here some of the main Highlights:

First you must configure the distribution for your particular system. Go to the directory you wish to build libffi in and run the "configure" program found in the root directory of the libffi source distribution.

If you're building libffi directly from version control, configure won't exist yet; run ./autogen.sh first.

You may want to tell configure where to install the libffi library and header files. To do that, use the --prefix configure switch. Libffi will install under /usr/local by default.

If you want to enable extra run-time debugging checks use the the --enable-debug configure switch. This is useful when your program dies mysteriously while using libffi.

Another useful configure switch is --enable-purify-safety. Using this will add some extra code which will suppress certain warnings when you are using Purify with libffi. Only use this switch when using Purify, as it will slow down the library.

For iOS builds, the 'libffi.xcodeproj' Xcode project is available.

Configure has many other options. Use "configure --help" to see them all.

Once configure has finished, type "make". Note that you must be using GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make .

To ensure that libffi is working as advertised, type "make check". This will require that you have DejaGNU installed.

To install the library and header files, type "make install".

Alternatively, try merging one of the following git projects to your project in order to include the missing files. Please make sure the files are not outdated before merging.

1 https://github.com/pandamonia/libffi-iOS

2 https://github.com/influitive/libffi-iOS

3 https://github.com/landonf/libffi-ios



来源:https://stackoverflow.com/questions/32156260/how-do-i-compile-libffi-for-ios-macos

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!