Tuesday, July 21, 2015

FreeBSD 10.1: Cabal Update Version Issues

Sometimes there is an issue with % cabal update, where after updating and testing the update with % cabal --version, you will still see the previous version. I had this issue when I was running Mac OS X 10.9 and 10.10 but they were easily resolved by just pointing to the correct PATH, e.g: export PATH="$HOME/Library/Haskell/ghc-7.8.3-x86_64/lib/cabal-install-1.20.0.3/bin:$PATH"

On FreeBSD, it's also an easy fix, again by ensuring you set your $PATH correctly, but this time ensuring it's ~/.cabal/bin:/usr/local/bin: . An issue I found with this, is that during some cabal installs, I'd see an error message gcc -not found even though whereis gcc reports /usr/local/bin/gcc48. To resolve this, I set my $PATH thus: /usr/local/bin:~/.cabal/bin:, which lead to 'cabal --version' not displaying the correct version number.

On a side note, I could just use the --with-gcc=/usr/local/bin/gcc48 flag, but I'm too lazy to type all that and too forgetful to remember.

This is how I chose to resolve it.

% sudo mv /usr/local/bin/cabal /usr/local/bin/cabal-1.18.0.5
% sudo ln -s ~/.cabal/bin/cabal /usr/local/bin/cabal

Effectively, I renamed the original cabal to include it's version number, in case I may ever need it later, then I created a symbolic link which pointed to my user copy of cabal, which will always be the updated version. So, I can now do cabal updates and cabal installs knowing that gcc will always be found and I'll always be using the most up to date cabal version.

No comments:

Post a Comment