MAC OS compiles apple cross-platform Libevent library (can be enshin to other third libraries)

Source: Internet
Author: User

The cross-platform under Apple refers to different versions of the Apple system on different devices and the same system in different CPU architectures.

The previous article describes how to use the NDK to compile a third library of Android cross-platform, but the method cannot be applied to Apple.

You can find such a script on the web, its main processes and functions such as:

The script relies primarily on the XCRUN-SDK command to search out the compiler and SDK directory locations associated with the platform. Unlike the NDK directory structure, Apple's directory structure is not clear and some are not unified, Xcrun is this consultation, ask it is.

As long as the corresponding container changes in the script can be applied to the compilation of other third libraries.

The next step in the compilation process is a strange problem.

I compiled the Libevent library to use on mobile devices, but strange things happen. Kqueue can be used in the Darwin version, but the mobile system version cannot be used kqueue only with poll. The reason is that there are two configugre in the detection of kqueue can not be passed, the culprit is irrelevant header file stdlib.h. Because of the processing of--host for Darwin in Configure, Stdlib.h was included before the project was detected, so there was no stdlib.h included in the code snippet for the detection project. The problem is that configure did not customize the processing of--host for Apple's other systems, so when it comes to detecting items, the function reference does not allow implicit declaration, i.e. no header file declaration, which results in the failure of the detection project. As long as the corresponding place in the Configure with the stdlib.h of the inclusion, fix, all versions of libevent can use Kqueue.

MAC OS compiles apple cross-platform Libevent library (can be enshin to other third libraries)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.