Build libcurl and oslibcurl in Mac OS X
Reprinted please indicate the source
In the source code compilation of libcurl, the compilation always fails according to the official documentation and google search. Simply find out the cause step by step based on the prompted failure and make it clear, OS x lacks several gnu tools and requires config initialization. libcurl is not mentioned officially. OK, you can do it yourself.
First, install the autoconf and automake tools.
1) install m4
Http://www.gnu.org/software/m4/
Tar-xzvf m4-1.4.17.tar.gz
Cd m4-1.4.17
./Configure -- prefix =/usr/local
Make
Sudo make install
2) install autoconf
Http://www.gnu.org/software/autoconf/
Tar-xzvf autoconf-2.69.tar.gz
Cd autoconf-2.69
./Configure -- prefix =/usr/local
Make
Sudo make install
3) install automake
Http://www.gnu.org/software/automake/
Tar xzvf automake-1.14.tar.gz
Cd automake-1.14
./Configure -- prefix =/usr/local
Make
Sudo make install
4) install libtool
Http://www.gnu.org/software/libtool/
Tar xzvf libtool-2.4.2.tar.gz
Cd libtool-2.4.2
./Configure -- prefix =/usr/local
Make
Sudo make install
5) download the libcurl source code and run the libcurl initialization script.
Git clone https://github.com/bagder/curl.git
Cd curl
./Buildconf
6) to compile the simulator version, you must first set up many compiling environments. The mac environment is xcode 6.4, and the sdk is 8.4.
Export IPHONEOS_DEPLOYMENT_TARGET = "8.4"
Export CC = "/Applications/Xcode. app/Contents/Developer/Toolchains/XcodeDefault. xctoolchain/usr/bin/clang"
Export CFLAGS = "-arch i386-pipe-OS-gdwarf-2-isysroot/Applications/Xcode. app/Contents/Developer/Platforms/iPhoneSimulator. platform/Developer/SDKs/iPhoneSimulator8.4.sdk"
Export LDFLAGS = "-arch i386-isysroot/Applications/Xcode. app/Contents/Developer/Platforms/iPhoneSimulator. platform/Developer/SDKs/iPhoneSimulator8.4.sdk"
./Configure -- disable-shared -- enable-static -- host = "i386-apple-darwin" -- prefix =/usr/local -- with-darwinssl -- enable-threaded-resolver
Make-j 'sysctl-n hw. logicalcpu_max
Cp lib/. libs/libcurl. ~ // Desktop/libcurl-i386.a
Make clean
7) The compiled arm version is slightly different.
Export IPHONEOS_DEPLOYMENT_TARGET = "8.4"
$ Export CC = "/Applications/Xcode. app/Contents/Developer/Toolchains/XcodeDefault. xctoolchain/usr/bin/clang"
$ Export CFLAGS = "-arch [ARCH]-pipe-OS-gdwarf-2-isysroot/Applications/Xcode. app/Contents/Developer/Platforms/iPhoneOS. platform/Developer/SDKs/iPhoneOS8.4.sdk"
$ Export LDFLAGS = "-arch [ARCH]-isysroot/Applications/Xcode. app/Contents/Developer/Platforms/iPhoneOS. platform/Developer/SDKs/iPhoneOS8.4.sdk"
$. /Configure -- disable-shared -- enable-static -- host = "[ARCH]-apple-darwin" -- prefix =/usr/local -- with-darwinssl -- enable-threaded-resolver
$ Make-j 'sysctl-n hw. logicalcpu_max'
Cp lib/. libs/libcurl. ~ /Desktop/libcurl-[ARCH].
Make clean
Note that [ARCH] represents armv7, armvs7 and arm64, but [ARCH]-apple-darwin does not have a arm64-apple-darwin here, you need to change to arm-apple-darwin to config through.
8) Merge libcurl
Cd ~ /Desktop
$ Lipo-create-output libcurl. a libcurl *