{"id":254837,"date":"2014-09-28T18:05:14","date_gmt":"2014-09-28T10:05:14","guid":{"rendered":"http:\/\/blog.zhenglei.net\/?p=254837"},"modified":"2014-09-28T18:05:14","modified_gmt":"2014-09-28T10:05:14","slug":"android-repo-sync-issus-gnutls_handshake-failed","status":"publish","type":"post","link":"https:\/\/blog.zhenglei.net\/?p=254837","title":{"rendered":"Android repo sync issus:  gnutls_handshake failed"},"content":{"rendered":"<p>The issus was caused by gnutls library,\u00a0 if network bandwidth is low<\/p>\n<p>&nbsp;<\/p>\n<p>Fix:<\/p>\n<p>Build git with openssl from source:<\/p>\n<p>cat git_build.sh<\/p>\n<p><strong><em>GIT_MAJOR=1.7.9<\/em><\/strong><br \/>\n<strong><em>GIT_MINOR=7<\/em><\/strong><br \/>\n<strong><em>GIT_VER=${GIT_MAJOR}.${GIT_MINOR}<\/em><\/strong><br \/>\n<strong><em>GIT_NAME=git-${GIT_VER}<\/em><\/strong><\/p>\n<p><strong><em>OPENSSL_VER=1.0.1i<\/em><\/strong><br \/>\n<strong><em>OPENSSL_NAME=openssl-${OPENSSL_VER}<\/em><\/strong><\/p>\n<p><strong><em>CURL_VER=7.38.0<\/em><\/strong><br \/>\n<strong><em>CURL_NAME=curl-${CURL_VER}<\/em><\/strong><\/p>\n<p><strong><em>EXPAT_VER=2.1.0<\/em><\/strong><br \/>\n<strong><em>EXPAT_NAME=expat-${EXPAT_VER}<\/em><\/strong><\/p>\n<p><strong><em>TARGET_DIR=\/usr\/local\/git-${GIT_MAIN}<\/em><\/strong><br \/>\n<strong><em>TARGET_DIR=\/tmp\/local<\/em><\/strong><\/p>\n<p><strong><em>BUILD_OPENSSL=0<\/em><\/strong><br \/>\n<strong><em>BUILD_CURL=0<\/em><\/strong><br \/>\n<strong><em>BUILD_EXPAT=0<\/em><\/strong><br \/>\n<strong><em>BUILD_GIT=1<\/em><\/strong><\/p>\n<p><strong><em>if [ &#8220;${BUILD_OPENSSL}&#8221; == &#8220;1&#8221; ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0 if [ ! -f ${OPENSSL_NAME}.tar.gz ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 wget http:\/\/www.openssl.org\/source\/${OPENSSL_NAME}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 if [ -d ${OPENSSL_NAME} ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 rm -rf ${OPENSSL_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 tar xvfz ${OPENSSL_NAME}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 cd ${OPENSSL_NAME}<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 .\/config no-shared no-dso &#8211;prefix=${TARGET_DIR}<\/em><\/strong><br \/>\n<strong><em>\u00a0 make -j4<\/em><\/strong><br \/>\n<strong><em>\u00a0 #make test<\/em><\/strong><br \/>\n<strong><em>\u00a0 sudo make install<\/em><\/strong><br \/>\n<strong><em>\u00a0 cd ..<\/em><\/strong><br \/>\n<strong><em>fi<\/em><\/strong><\/p>\n<p><strong><em>if [ &#8220;${BUILD_CURL}&#8221; == &#8220;1&#8221; ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0 if [ ! -f ${CURL_NAME}.tar.gz ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 wget http:\/\/curl.haxx.se\/download\/${CURL_NAME}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 if [ -d ${CURL_NAME} ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 rm -rf ${CURL_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 tar xvfz ${CURL_NAME}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 cd\u00a0 ${CURL_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 env PKG_CONFIG_PATH=${TARGET_DIR}\/lib\/pkgconfig .\/configure\u00a0 &#8211;disable-shared &#8211;prefix=${TARGET_DIR} &#8211;without-gnutls &#8211;with-ssl<\/em><\/strong><br \/>\n<strong><em>\u00a0 make -j4<\/em><\/strong><br \/>\n<strong><em>\u00a0 sudo make install<\/em><\/strong><br \/>\n<strong><em>\u00a0 cd ..<\/em><\/strong><br \/>\n<strong><em>fi<\/em><\/strong><\/p>\n<p><strong><em>if [ &#8220;${BUILD_EXPAT}&#8221; == &#8220;1&#8221; ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0 if [ ! -f ${EXPAT_NAME}.tar.gz ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 wget http:\/\/sourceforge.net\/projects\/expat\/files\/expat\/${EXPAT_VER}\/${EXPAT_NAME}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 if [ -d ${EXPAT_NAME} ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 rm -rf ${EXPAT_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><br \/>\n<strong><em>\u00a0 tar xvfz ${EXPAT_NAME}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 cd ${EXPAT_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 .\/configure &#8211;disable-shared &#8211;prefix=${TARGET_DIR}<\/em><\/strong><br \/>\n<strong><em>\u00a0 make <\/em><\/strong><br \/>\n<strong><em>\u00a0 sudo make install<\/em><\/strong><br \/>\n<strong><em>fi<\/em><\/strong><\/p>\n<p><strong><em>if [ &#8220;${BUILD_GIT}&#8221; == &#8220;1&#8221; ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0 if [ ! -f v${GIT_VER}.tar.gz ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 wget http:\/\/github.com\/git\/git\/archive\/v${GIT_VER}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 <\/em><\/strong><br \/>\n<strong><em>\u00a0 if [ -d ${GIT_NAME} ];then<\/em><\/strong><br \/>\n<strong><em>\u00a0\u00a0\u00a0 rm -rf ${GIT_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 fi<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 tar xvfz v${GIT_VER}.tar.gz<\/em><\/strong><br \/>\n<strong><em>\u00a0 cd ${GIT_NAME}<\/em><\/strong><br \/>\n<strong><em>\u00a0 make configure<\/em><\/strong><br \/>\n<strong><em>\u00a0 <\/em><\/strong><br \/>\n<strong><em>\u00a0 .\/configure &#8211;prefix=${TARGET_DIR}\u00a0 &#8211;with-curl &#8211;with-openssl=${TARGET_DIR} &#8211;with-lib=${TARGET_DIR}<\/em><\/strong><\/p>\n<p><strong><em>\u00a0 make -j4<\/em><\/strong><br \/>\n<strong><em>\u00a0 #make test<\/em><\/strong><br \/>\n<strong><em>\u00a0 sudo make install<\/em><\/strong><br \/>\n<strong><em>fi<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The issus was caused by gnutls library,\u00a0 &hellip; <a href=\"https:\/\/blog.zhenglei.net\/?p=254837\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6,2],"tags":[104,162],"class_list":["post-254837","post","type-post","status-publish","format-standard","hentry","category-android","category-internet","category-linux","tag-git","tag-repo"],"_links":{"self":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254837"}],"version-history":[{"count":1,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254837\/revisions"}],"predecessor-version":[{"id":254838,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254837\/revisions\/254838"}],"wp:attachment":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}