LIBUV website only provides the method of compiling OS X, without iOS. Since OS X is about the same as the iOS system kernel,
and the compilation tool is Xcode, so we can just re-specify the CPU architecture, we will be able to compile the iOS version.
1. Install Python, the official website has OS X version: python.org/download, download Python 3.x Mac Installer disk image
2. Open image, inside the installation file is pythom.mpkg, double-click is not open, to right--open mode--installer.
3. After installation, open terminal, enter Python to see if the installation is successful
4. Download the latest source code on the LIBUV website: https://github.com/joyent/libuv
5. Enter the LIBUV in the terminal and enter
$ mkdir-p Build
$ git clone https://git.chromium.org/external/gyp.git Build/gyp
If you don't have git, install git first.
6.$./gyp_uv.py-f Xcode
Generate the Xcode project file uv.xcodeproj. I made a mistake in this step, the error comes from subprocess.py,
I changed it. gyp_uv.py's get_compiler_version () function simply returns the compiler's version information.
$ xcodebuild-archs= "x86_64 i386"-project uv.xcodeproj \
-configuration Release-target All
Build the OS X version of the Library
7. The theory is to change-archs to "ARMv7 armv7s arm64" can be generated on the iOS version, but for the sake of insurance, or open
Uv.xcodeproj, then modify the architecture information in build setting:
Basesdk:latest IOS
Architecture:armv7,armv7s,arm64
Supported Platform:ios
Valid architecture:arm64 armv7 armv7s
8. We first compile with iOS Device, generate the real machine version of the library, in the Debug-iphoneos directory
Then compile with Simulater, generate the emulator version of the library, in the Debug-iphonesimulater directory
9 in order to be convenient for later use, we need to synthesize the above two libraries into one
Lipo-create DEBUG-IPHONEOS/LIBUV.A debug-iphonesimulater/libuv.a-output LIBUV.A
Done
Libuv porting to iOS