xcode - 如何在 MacOS10.12 下安装 libcurl 并用于 Xcode?

标签 xcode macos curl libcurl

Building libCURL for iOS 4.2

大家好:
这是我的第一个堆栈溢出问题。我已经阅读了之前发布的博客,但我仍然无法完成构建。我对终端编程不熟悉。首先让我向您展示一些关于我的 mac 上 xcode 的基本信息。

`Wuqians-MBP:~ wuqianzhong$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
Wuqians-MBP:~ wuqianzhong$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin`

然后我输入了从博客Building libCURL for iOS 4.2.中学到的以下4行
export CC=“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang”

export CFLAGS="-arch x86_64 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Deveoper/SDKs/iPhoneOS10.2.sdk"

export LDFLAGS="-arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk"

 ./configure --host=x86_64-apple-darwin --with-zlib --disable-shared --enable-static --disable-ipv6 --disable-manual --disable-verbose 

但是,结果表明我没有正确构建。甚至 C 编译器也不工作。
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking whether to enable debug build options... no
checking whether to enable compiler optimizer... (assumed) yes
checking whether to enable strict compiler warnings... no
checking whether to enable compiler warnings as errors... no
checking whether to enable curl debug memory tracking... no
checking whether to enable hiding of library internal symbols... yes
checking whether to enable c-ares for DNS lookups... no
checking whether to disable dependency on -lrt... (assumed no)
checking for path separator... :
checking for sed... /usr/bin/sed
checking for grep... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for x86_64-apple-darwin-ar... no
checking for ar... /usr/bin/ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for x86_64-apple-darwin-gcc... “/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang”
checking whether the C compiler works... no
configure: error: in `/Users/wuqianzhong/Desktop/curl-7.52.1':
configure: error: C compiler cannot create executables
See `config.log' for more details

最佳答案

How to install libcurl in Mac
嘿,我想我已经找到了答案并且它有效!

  • 下载curl安装包并解压
  • 使用终端进入curl安装包文件夹根目录
  • 设置安装路径:./configure --prefix=/usr/local/curl
  • 编译:make
  • 安装:sudo make install

  • 然后你会在路径/usr/local/curl 中发现 curl 有四个文件
    bin、包含、lib、共享。

    关于xcode - 如何在 MacOS10.12 下安装 libcurl 并用于 Xcode?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41580504/

    相关文章:

    objective-c - 如何使用 Objective C 查找和替换文件中的文本?

    macos - 错误 : Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)

    ios - 根据构建配置嵌入不同的框架

    json - 联接字段(多类型索引错误)-Elasticsearch

    Facebook - Curl 错误 SSL_CACERT SSL 证书

    ios - Xcode 8's simulator won' t 工作

    xcode - 如何填充 TableView 而不是 TableView Controller ?

    objective-c - Cocoa 中的分布式对象

    docker - 在 docker-compose.yml 文件中指定用于 SSL 的证书?

    ios - 如何将 SCNView 更改回 UIView?