0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

雪豹でgitをビルドした

Last updated at Posted at 2018-03-02

2018年の2月後半にgithubがtlsの設定を変えたようで、Mac OS X(雪豹)からアクセスできなくなりました。

bash-3.2$ git clone https://github.com/yamori813/I2CREMOCON.git
Cloning into 'I2CREMOCON'...
error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol v
ersion while accessing https://github.com/yamori813/I2CREMOCON.git/info/refs?ser
vice=git-upload-pack
fatal: HTTP request failed

実はsoucefogeがこれよりちょっと前に設定変えてsvnのアクセスができなくなり、どうしようか考えている矢先でした。

いろいろ思案したのですが、gitをビルドする事にしてみました。

gitは以下のような依存があります。

git_depend.png

古いgitはシステムのcurlとopensslを使っていたために、アクセス不能になりました。

まずopensslをビルドします。コンパイラーも古いので、システムに入っている物と近い1.0.2nをダウンロードしてコンパイルしました。

bash-3.2$ ./Configure darwin64-x86_64-cc -shared
bash-3.2$ make
bash-3.2$ sudo make install

これで/usr/local/sslにファイルがコピーされます。デフォルトではdylibが作られないようだったので-sharedを指定しました。

次はcurl(7.58.0)をビルドします。

bash-3.2$ LDFLAGS=-L/usr/local/ssl/lib;export LDFLAGS
bash-3.2$ CFLAGS=-I/usr/local/ssl/include;export CFLAGS
bash-3.2$ ./configure --with-ca-bundle=/usr/local/share/curl/curl-ca-bundle.crt
bash-3.2$ make
bash-3.2$ sudo make install

CAのファイルは/usr/local/share/curl/curl-ca-bundle.crtがデフォルなんですが、何故か指定しないと見てくれないようだったので設定しました。

ところがCAのファイルですが元々のcurlだとそもそも拾えません。

bash-3.2$ /usr/bin/curl https://curl.haxx.se/ca/cacert.pem
curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protoc
ol version

新しくビルドしたcurlでもCAファイルがなくてそのままではアクセスできず、-kオプションで取得しました。これで/usr/local/share/curl/curl-ca-bundle.crtを作るとcurlが使えるようになります。

/usr/localにcurlが入ったのでgit(2.16.2)をビルドします。

bash-3.2$ LDFLAGS="-L/usr/local/ssl/lib -L/usr/local/lib";export LDFLAGS
bash-3.2$ CFLAGS="-I/usr/local/ssl/include -I/usr/local/include";export CFLAGS
bash-3.2$ ./configure --prefix=/usr/local/git
bash-3.2$ make 
bash-3.2$ sudo make install

/usr/local/gitに古いバイナリあってパスが通っていて、install前にgitコマンドを確認すると古いコマンドファイルが使われてエラーがでます。あらかじめmvなどしてから確認すると良いです。

これで元通り使えるようになりました。

bash-3.2$ git clone https://github.com/yamori813/I2CREMOCON.git
Cloning into 'I2CREMOCON'...
remote: Counting objects: 20, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 20 (delta 4), reused 20 (delta 4), pack-reused 0
Unpacking objects: 100% (20/20), done.

昔はオープンソースをコンパイルするとコンパイラーのバージョンなどでコンパイルエラーとか良く出ていましたが、このビルドでエラーは一つもありませんでした。ほんとgcc4の功績は偉大だと思います。

まだまだ雪豹。

後日追記:subversion-1.9.7のビルドを試したのですが、autogen.shがエラーで実行できずビルドできませんでした。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?