Bus errorとSegmentation faultに困ったら見るブログ

物理の研究者による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)

【Haskell】古いversionのパッケージをcabalインストールしたい

(過去記事のコピペなので内容が古いです、2014/06/07)

例えば今、hmatrixというパッケージを使いたいとする

最新versionは

hmatrix: Numeric Linear Algebra


を見ると、0.15.2.1 が最新らしい

cabal update
cabal info hmatrix

として、詳細を確認すると、

* hmatrix (library)
Synopsis: Linear algebra and numerical computation
Versions available: 0.13.0.0, 0.13.1.0, 0.14.0.0, 0.14.0.1, 0.14.1.0,
0.15.0.0, 0.15.0.1, 0.15.2.0, 0.15.2.1 (and 31 others)
Versions installed: 0.14.0.1
Homepage: https://github.com/albertoruiz/hmatrix
Bug reports: [ Not specified ]
Description: Purely functional interface to basic linear algebra and other
numerical computations, internally implemented using GSL,
BLAS and LAPACK.

The Linear Algebra API is organized as follows:

- "Data.Packed": structure manipulation

- "Numeric.Container": simple numeric functions

- "Numeric.LinearAlgebra.Algorithms": matrix computations

- "Numeric.LinearAlgebra": everything + instances of standard
Haskell numeric classes
Category: Math
License: GPL
Author: Alberto Ruiz
Maintainer: Alberto Ruiz <aruiz@um.es>
Source repo: https://github.com/albertoruiz/hmatrix
Flags: dd, mkl, unsafe, finit, debugfpu, debugnan
Dependencies: base ==4.*, array -any, storable-complex -any, process -any,
random -any, vector >=0.8, binary -any, deepseq -any
Documentation: [ Not installed ]
Cached: No
Modules:
Data.Packed
Data.Packed.Development
Data.Packed.Matrix
Data.Packed.ST
Data.Packed.Vector
Graphics.Plot
Numeric.Container
Numeric.GSL
Numeric.GSL.Differentiation
Numeric.GSL.Fitting
Numeric.GSL.Fourier
Numeric.GSL.Integration
Numeric.GSL.Minimization
Numeric.GSL.ODE
Numeric.GSL.Polynomials
Numeric.GSL.Root
Numeric.LinearAlgebra
Numeric.LinearAlgebra.Algorithms
Numeric.LinearAlgebra.LAPACK
Numeric.LinearAlgebra.Util

表示された情報は上に貼ったURLリンクからも見ることができる
古いversionのパッケージをインストールしても他のパッケージのdependencyが満たされていることを確認しておく必要がある
portコマンドとかと違って、そういった整合性はユーザー自身が見なければならないらしい

最新versionをインストールしたいならば、

cabal install hmatrix

とすればよい
もしかしたらGSLが必要と言われるかもしれないが、そのときは別にインストールする

        • -

次に古いversionのパッケージをcabalインストールする方法について説明する

先ほどと同じ

hmatrix: Numeric Linear Algebra


のページに行き、インストールしたいversionをPropertiesの下のVersionsから選択する
例えば今、0.14.0.1がインストールしたい場合は

hmatrix: Linear algebra and numerical computation


そしてDownloadsの下にある.tarをダウンロードする
あとは解凍して、中にあるINSTALLとかREADMEとかその辺りを参考にしてインストールすればよい

今回のhmatrixの場合はGSLがすでにインストールされていれば

cabal install

でオーケーでした