Source code compilation Libcurl in MAC OS x environment

Source: Internet
Author: User
Tags automake

Reprint please indicate the source, otherwise the pursuit of responsibility

In the libcurl of the source code compilation, reference to the official documents and Google search out of always compile failed, simply follow the failure of the prompt step by step to find out the reason, plainly, is OS X lacks GNU several tools, but also need to initialize the Config line, libcurl the official did not mention OK, let's get it done by myself.

First, you need to 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 Libcurl source code, run libcurl init script

git clone https://github.com/bagder/curl.git

CD Curl

./buildconf

6) Compile simulator version, first need to set up a lot of compilation environment, my Mac environment is Xcode 6.4, SDK is 8.4 for example

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.A ~/DESKTOP/LIBCURL-I386.A

Make clean

7) build arm version 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.a ~/desktop/libcurl-[ARCH]. A

Make clean

Special attention here [ARCH] stands for armv7,armvs7 and arm64, but [Arch]-apple-darwin here does not exist Arm64-apple-darwin, Need to change to Arm-apple-darwin can be config pass.

8) Merging Libcurl

CD ~/desktop

$ lipo-create-output LIBCURL.A libcurl*

Source code compilation Libcurl in MAC OS x environment

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.