{"id":172,"date":"2014-03-30T04:16:41","date_gmt":"2014-03-29T20:16:41","guid":{"rendered":"http:\/\/sinofool.net\/blog\/?p=172"},"modified":"2014-03-30T05:45:24","modified_gmt":"2014-03-29T21:45:24","slug":"openssl-and-curl-for-ios","status":"publish","type":"post","link":"https:\/\/sinofool.net\/blog\/archives\/172","title":{"rendered":"OpenSSL and cURL for iOS"},"content":{"rendered":"<p>\u6628\u5929\u5347\u7ea7iOS\u7a0b\u5e8f\uff0c\u987a\u4fbf\u5347\u7ea7\u4e86\u4f9d\u8d56\u5230\u7684\u4e24\u4e2a\u5e93\uff0cOpenSSL\u548ccURL\u3002<br \/>\n\u5347\u7ea7\u4e86\u7248\u672c\uff0c\u589e\u52a0\u4e86\u65b0\u7684iPhone5s\u768464\u4f4dCPU\u7684\u652f\u6301\u3002<\/p>\n<p>I have updated the dependency libraries of my iPhone app, OpenSSL and cURL.<br \/>\nAdded support of iPhone5s new 64bit arm64 CPU.<br \/>\nUpgraded to latest version.<\/p>\n<h2>Approach<\/h2>\n<p>\u4ea4\u53c9\u7f16\u8bd1\u8fd9\u4e24\u4e2a\u5e93\u7684\u5173\u952e\u662f\u4e24\u4e2a\u53c2\u6570\uff1a-isysroot\u548c-miphoneos-version-min<br \/>\ncURL\u662f\u62fc\u4e0a\u4e0d\u540c\u7684\u53c2\u6570\u5b9e\u73b0\u7684\uff0cOpenSSL\u5df2\u7ecf\u5185\u5efa\u6709iphoneos-cross\u652f\u6301\uff0c\u4fee\u6539\u4e00\u4e9b\u53c2\u6570\u6765\u652f\u6301arm64\u548c\u6a21\u62df\u5668\u3002<\/p>\n<p>The key of cross compiling are two parameters: -isysroot and -miphoneos-version-min<br \/>\ncURL is configured using parameters.<br \/>\nWhile OpenSSL has a build-in target called iphoneos-cross, I added 64 bit support based on it.<\/p>\n<h2>Code<\/h2>\n<p>\u8fd9\u4e24\u4e2a\u9879\u76ee\u7684\u4ee3\u7801\u63d0\u4ea4\u5728\u4e86GitHub,\u76ee\u524d\u7528iOS SDK7.1\u5728MacOSX 10.8\u9a8c\u8bc1\u901a\u8fc7.<br \/>\nHere are two projects on GitHub, tested on iOS SDK 7.1 and MacOSX 10.8 .<br \/>\n<a title=\"https:\/\/github.com\/sinofool\/build-openssl-ios\" href=\"https:\/\/github.com\/sinofool\/build-openssl-ios\" target=\"_blank\">https:\/\/github.com\/sinofool\/build-openssl-ios<\/a><br \/>\n<a title=\"https:\/\/github.com\/sinofool\/build-libcurl-ios\" href=\"https:\/\/github.com\/sinofool\/build-libcurl-ios\" target=\"_blank\">https:\/\/github.com\/sinofool\/build-libcurl-ios<\/a><\/p>\n<h2>Usage<\/h2>\n<p>\u8fd9\u4e24\u4e2a\u811a\u672c\u4e0d\u9700\u8981git clone\u518d\u4f7f\u7528\uff0c\u4e0b\u8f7d\u597dOpenSSL\u548ccURL\u7684\u6e90\u4ee3\u7801\u5e76\u89e3\u538b\u7f29\uff0c\u76f4\u63a5\u8fd0\u884cgithub\u4e0a\u7684\u811a\u672c\uff0c\u5c31\u4f1a\u7f16\u8bd1\u597d\u653e\u5728\u684c\u9762\u4e0a\u3002<br \/>\nIt is not necessary clone the code locally, download the sources from OpenSSL and cURL official website.<br \/>\nRun following scripts, results will be on the desktop.<\/p>\n<pre>curl -O http:\/\/www.openssl.org\/source\/openssl-1.0.1f.tar.gz\r\ntar xf openssl-1.0.1f.tar.gz\r\ncd openssl-1.0.1f\r\ncurl https:\/\/raw.githubusercontent.com\/sinofool\/build-openssl-ios\/master\/build_openssl_dist.sh |bash<\/pre>\n<p>cURL\u4e5f\u662f\u4e00\u6837\uff1a<\/p>\n<pre>curl -O http:\/\/curl.haxx.se\/download\/curl-7.35.0.tar.gz\r\ntar xf curl-7.35.0.tar.gz\r\ncd curl-7.35.0\r\ncurl https:\/\/raw.githubusercontent.com\/sinofool\/build-libcurl-ios\/master\/build_libcurl_dist.sh |bash<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6628\u5929\u5347\u7ea7iOS\u7a0b\u5e8f\uff0c\u987a\u4fbf\u5347\u7ea7\u4e86\u4f9d\u8d56\u5230\u7684\u4e24\u4e2a\u5e93\uff0cOpenSSL\u548ccURL\u3002 \u5347\u7ea7\u4e86\u7248\u672c\uff0c\u589e\u52a0\u4e86\u65b0\u7684iPhone5s\u768464\u4f4dCPU\u7684\u652f\u6301\u3002 I have updated the dependency libraries of my iPhone app, OpenSSL and cURL. Added support of iPhone5s new 64bit arm64 CPU. Upgraded to latest version. Approach \u4ea4\u53c9\u7f16\u8bd1\u8fd9\u4e24\u4e2a\u5e93\u7684\u5173\u952e\u662f\u4e24\u4e2a\u53c2\u6570\uff1a-isysroot\u548c-miphoneos-version-min cURL\u662f\u62fc\u4e0a\u4e0d\u540c\u7684\u53c2\u6570\u5b9e\u73b0\u7684\uff0cOpenSSL\u5df2\u7ecf\u5185\u5efa\u6709iphoneos-cross\u652f\u6301\uff0c\u4fee\u6539\u4e00\u4e9b\u53c2\u6570\u6765\u652f\u6301arm64\u548c\u6a21\u62df\u5668\u3002 The key of cross compiling are two parameters: -isysroot and -miphoneos-version-min cURL is configured using parameters. While OpenSSL has a build-in target called iphoneos-cross, I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[15,5],"tags":[18,19,16,13,25,17,14,12],"class_list":["post-172","post","type-post","status-publish","format-standard","hentry","category-ios","category-tech","tag-arm64","tag-armv7s","tag-compile","tag-curl","tag-ios","tag-iphone","tag-libcurl","tag-openssl"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/posts\/172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":4,"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"predecessor-version":[{"id":176,"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions\/176"}],"wp:attachment":[{"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sinofool.net\/blog\/wp-json\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}