Cabal: where does `cabal update` store its package list? - haskell

(I'm on OS X 10.9)
I run this:
$ cabal update
$ cabal install haskell-platform
cabal: There is no package named 'haskell-platform'.
You may need to run 'cabal update' to get the latest list of available packages.
I installed cabal-install with user:
$ cabal install --user cabal-install
$ which cabal
/Users/sambo/.cabal/bin/cabal
after nuking my Haskell installation with with this that I found online:
$ sudo rm -rf /Library/Frameworks/GHC.framework
$ sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
$ sudo rm -rf /Library/Haskell
$ sudo rm -rf /usr/share/doc/ghc
$ sudo rm /usr/share/man/man1/ghc.1
$ sudo rm -rf /var/db/receipts/org.haskell.HaskellPlatform.*
$ sudo rm -rf ~/.cabal
$ sudo rm -rf ~/.ghc
$ sudo rm -rf ~/Library/Haskell
$ find /usr/bin /usr/local/bin -type l | \
xargs -If sh -c '/bin/echo -n f /; readlink f' | \
egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | \
cut -f 1 -d ' ' | \
xargs sudo rm -f
I'd be okay with a hard reinstall of Haskell, which I had installed with homebrew. Which is what I was trying to do, but seems botched.

I don't really understand your problem, but Cabal stores package list in:
.cabal/packages/hackage.haskell.org/00-index.tar.gz.etag
.cabal/packages/hackage.haskell.org/00-index.cache
.cabal/packages/hackage.haskell.org/00-index.tar.gz
.cabal/packages/hackage.haskell.org/00-index.tar
Here's a tip to manage your Haskell installation: Don't install Haskell Platform. Using your package manager(I guess that's brew on a Mac), install latest GHC(7.8.3), Cabal and cabal-install. After that run cabal update and cabal install Cabal cabal-install again, just to update your Cabal installations in case it's old. Then remove your system-wide installed Cabal, and add ~/.cabal/bin to your path. You should now have cabal sandbox functionality working, install everything in sandboxes.
UPDATE: If your package manager doesn't have GHC 7.8.3: Just install whatever version it has, and install Cabal and cabal-install as I described. Then remove package manager's GHC and install latest pre-compiled version from http://www.haskell.org/ghc/download_ghc_7_8_3.
If you package manager's GHC is not new enough to compile latest Cabal and cabal-install, then you need to boot libraries, starting from older GHC and older Cabal and then updating GHC, installing newer Cabal using up-to-date GHC and older Cabal etc.
Just don't install Haskell Platform, it's just not worth the pain.

Related

how to install gcc-12 on ubuntu

$ sudo apt search gcc-12
Sorting... Done
Full Text Search... Done
$ uname -a
Linux Han 5.10.81.1-microsoft-standard-WSL2 #1 SMP Mon Nov 22 18:52:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I am using the default sources.list file, I want to install gcc-12 but I can't find it in the mirror source, what should I do!
gcc-12 is not available in ubuntu 20.04, so we need to compile it from source code, here are the steps which I borrowed from this video:
Step 1: clone gcc source code and checkout gcc-12 branch
$ git clone https://gcc.gnu.org/git/gcc.git gcc-source
$ cd gcc-source/
$ git branch -a
$ git checkout remotes/origin/releases/gcc-12
Step 2: make another build dir
Note this is important as running ./configure from within the source directory is not supported as documented here.
$ mkdir ../gcc-12-build
$ cd ../gcc-12-build/
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
Step 3: installing GCC prequisites and run configure again
The missing libraries will be shown in above ./confgiure output, search and install them one by one.
$ apt-cache search MPFR
$ sudo apt-get install libmpfrc++-dev
$ apt-cache search MPC | grep dev
$ sudo apt-get install libmpc-dev
$ apt-cache search GMP | grep dev
$ sudo apt-get install libgmp-dev
$ sudo apt-get install gcc-multilib
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
An alternartive is to run the download_prerequisites script.
$ cd ../
$ cd gcc-source/
$ ./contrib/download_prerequisites
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
Step 4: compile gcc-12
$ make -j16
Still flex is missing:
$ sudo apt-get install flex
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
$ make -j16
$ make install
Another way is to use Ubuntu 22.04 where gcc-12 is available. In Ubuntu 22.04, gcc-12 can be installed with apt:
$ sudo apt install gcc-12
You can use Homebrew to install pre-built binaries.
Follow instructions to install Homebrew at https://brew.sh/, then
brew install gcc for default GCC (currently 11) or brew install gcc#12 for gcc-12.
Note that it may compile missing dependencies.
I would add if you are adding for 64 bit only, you'll want to add "--disable=multilib" to the end of your configure statement.

node js can't install right on my Ubuntu computer

I use the git to install node js, the method I use is below:
mkdir ~/local
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
git clone git://github.com/joyent/node.git
cd node
./configure --prefix=~/local
make install
cd ..
After this, I use node on my command line, it tell me no node.Any one can help me?
I got the method form https://gist.github.com/isaacs/579814, but can't work.
My path is here.
You have to make before you make install.
The wiki has more information about building from source.
I used NVM to install Node.js to my Ubuntu computer:
First install these packages
sudo apt-get install curl build-essential libssl-dev libxml2 libxml2-dev libexpat1-dev
Install nvm
git clone https://github.com/creationix/nvm.git ~/.nvm
To activate nvm, you need to source it from your bash shell (e.g, add to your ~/.bash_profile)
. ~/.nvm/nvm.sh
The following steps are also required when upgrading Node
Install Node (use whichever version you like, but v0.8.x works)
nvm install v0.8.23
nvm alias default v0.8.23
nvm use v0.8.23
Any issues, I would check out the NVM repo.
This is my build script for node.js on ubuntu. I don't build from the bleeding edge most recent code, but its close to your process.
sudo apt-get update
sudo apt-get -y install build-essential libssl-dev
wget http://nodejs.org/dist/latest/docs/
node_version=`grep -i 'current version' index.html | sed -E 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/'`
wget http://nodejs.org/dist/v$node_version/node-v$node_version.tar.gz
tar -xzf node-v$node_version.tar.gz
cd node-v$node_version
./configure
make
sudo make install
cd ..
rm -rf node-v$node_version.tar.gz node-v$node_version index.html

How to install libraries on jhbuild?

I want to start to use jhbuild. It creates an isolated system to compile unstable packages ant try them. But it's not clear to me how to add a missing library to it.
Steps:
$ sudo apt-get install jhbuild
$ mkdir -p /opt/gnome
$ chown `whoami`.`whoami` /opt/gnome
$ mkdir ~/checkout/gnome
$ jhbuild bootstrap
... all correct ...
$ jhbuild sysdeps --install
... problems ...
Required packages:
Packages too old:
(none)
No match with system package
soundtouch (soundtouch-1.4.pc, required=0)
libicu (icu-i18n.pc, required=4)
libunistring
yajl
device-mapper
...
I read something about installing libicu here, but It do not explain where to checkout an how to compile.
I have tried
$ svn checkout http://source.icu-project.org/repos/icu/icu/tags/release-4-8/
$ cd release-4-8/source
$ ./autogen.sh --prefix=/opt/gnome
$ make
$ make install
with no luck.
My system is a 64bits one. I say because I have made this hack already
If you have a 64bit system and jhbuild is installing into /opt/gnome then you need to set your libdir to install libraries into /opt/gnome/lib64
add --libdir=/opt/gnome/lib64 onto the autogen.sh line.
You can just run sudo-apt get install libicu. The sysdeps are system dependencies, so they don't need to be installed in the JHBuild checkout, just on your system.
You might find this wiki page helpful: https://wiki.gnome.org/HowDoI/Jhbuild

What's the best workaround for not having "cabal upgrade"?

I want to upgrade all packages, not just a specific one with cabal install --upgrade-dependencies.
This bit of shell hackery works for me on OS X:
cabal list --simple-output --installed | awk '{print $1}' | uniq | xargs -I {} cabal install {} --reinstall
EDIT: Now forces a reinstall, and avoids installing a package more than once when more than one version is present. Thanks for the comments!
EDIT YEARS LATER: Now that Cabal sandboxes and Stack exist, I strongly recommend against trying to upgrade packages in place. You'll end up with far fewer headaches if you instead can just wipe out an existing sandbox and reinstall up-to-date dependencies.
The .cabal/world file contains a list of every package you installed explicitly (listed in a cabal install command, as opposed to pulled through dependencies). Trim it to remove packages that are only useful as dependencies, packages that are deprecated, and version-locked packages that you'd rather upgrade.
Cabal doesn't know how to clean-up after itself, but you can remove almost everything. The next command will reinstall from .cabal/packages (a tarball cache):
cp -t bin .cabal/bin/cabal
rm -rf .cabal/{bin,lib,share} .ghc/*-*-*/
ghc-pkg check |&egrep -- '^[A-Za-z0-9-]+-[0-9]' |xargs -n1 --no-run-if-empty ghc-pkg unregister
Now reinstall everything that was manually installed:
cabal install world --upgrade-dependencies --force-reinstalls

Uninstall Node.JS using Linux command line?

How do you uninstall node.js using the cmd line in linux?
For Ubuntu 12.04:
sudo apt-get remove nodejs
This will uninstall nodejs as well as npm.
Edit: If you know which package manager was used to install, it is best to uninstall with the same package manager. Examples for apt, make, yum are in other answers.
This is a manual approach:
Running which node will return something like /path/bin/node.
Then run cd /path
This is all that is added by Node.JS.
rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1
Now the only thing I don't know about is npm and what it has installed. If you install npm again into a custom path that starts off empty, then you can see what it adds and then you will be able to make a list for npm similar to the above list I made for node.
If you installed from source, you can issue the following command:
sudo make uninstall
If you followed the instructions on https://github.com/nodejs/node/wiki to install to your $HOME/local/node, then you have to type the following before the line above:
./configure --prefix=$HOME/local/node
Sorry the answer of George Bailey does work very fine when you
want absolutely remove the node from your machine.
This answer is referred from : #tedeh
https://github.com/nodesource/distributions/issues/486
If you wanna install a new version of node you have to use the code below
sudo rm -rf /var/cache/yum
sudo yum remove -y nodejs
sudo rm /etc/yum.repos.d/nodesource*
sudo yum clean all
And add new nodejs version to "yum" an new version of node
#using this command for Node version 8
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
#using this command for Node version 10
curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
Install nodejs
sudo yum -y install nodejs
I hope it gonna help you guy!!!
To uninstall node I followed the accepted answer by #George, as I no longer have the sources, but before doing so I ran:
sudo npm rm npm -g
That seemed to get rid of npm from the system directories such as /usr/bin/npm and /usr/lib/npm. I got the command from here. I then found a ~/.npm directory, which I deleted manually. Honestly I don't know if every trace of npm has been removed, but I can't find anything else.
If you installed node using curl + yum:
sudo curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
sudo yum -y install nodejs
Then you can remove it using yum:
sudo yum remove nodejs
Note that using the curl script causes the wrong version of node to be installed. There is a bug that causes node v6.7 to be installed instead of v4.x intended by the path (../setup_4.x) used in the curl script.
This is better to remove NodeJS and its modules manually because installation leaves a lot of files, links and modules behind and later it create problems while we reconfigure another version of NodeJS and its modules.
Run the following commands.
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/include/node*
sudo rm -rf /usr/local/bin/node*
and this done.
A step by step guide with commands is at http://amcositsupport.blogspot.in/2016/07/to-completely-uninstall-node-js-from.html
This helped me resolve my problem.
I think Manoj Gupta had the best answer from what I'm seeing. However, the remove command doesn't get rid of any configuration folders or files that may be leftover. Use:
sudo apt-get purge --auto-remove nodejs
The purge command should remove the package and then clean up any configuration files. (see this question for more info on the difference between purge and remove). The auto-remove flag will do the same for packages that were installed by NodeJS.
See the accepted answer on this question for a better explanation.
Although don't forget to handle NPM! Josh's answer covers that.
The answer of George Bailey works fine.
I would just add the following flags and use sudo if needed:
sudo rm -rf bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node
if you want to just update node, there's a neat updater too
https://github.com/creationix/nvm
to use,
git clone git://github.com/creationix/nvm.git ~/.nvm
source ~/.nvm/nvm.sh
nvm install v0.4.1
I think this works, at least partially (have not investigated):
nvm uninstall <VERSION_TO_UNINSTALL>
eg:
nvm uninstall 4.4.5
If you have yum you could do:
yum remove nodesource-release* nodejs
yum clean all
And after that check if its deleted:
rpm -qa 'node|npm'
after installing using the "ROCK-SOLID NODE.JS PLATFORM ON UBUNTU" script, i get this output. Which tells you how to uninstall nodejs.
Done. The new package has been installed and saved to
/tmp/node-install/node-v0.8.19/nodejs_0.8.19-1_i386.deb
You can remove it from your system anytime using:
dpkg -r nodejs
Best way to go around this is to do it right from the BEGINNING:
INSTALL BREW
#HERE IS HOW: PASTE IN TERMINAL
sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
Then at the end of your .bashrc file(In your home directory press Ctrl + H)
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
Then restart terminal so the modification to .bashrc are reloaded
TO INSTALL NODE
brew install node
TO CHECK VERSION
node -v
npm -v
TO UPDATE NODE
brew update
brew upgrade node
TO UNINSTALL NODE
brew uninstall node
To Remove nodejs installed in centos 8:
From your home directory, run the below command
sudo yum remove nodejs
Enter y to confirm your command
In addition to apt or yum removal, clean any residual files to avoid conflicts if you ever install a new version:
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/share/man/man1/node*
sudo rm -rf /usr/local/lib/dtrace/node.d
sudo rm -rf ~/.npm
sudo rm -rf ~/.node-gyp
sudo rm -rf /opt/local/bin/node
sudo rm -rf opt/local/include/node
sudo rm -rf /opt/local/lib/node_modules
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/include/node*
sudo rm -rf /usr/local/bin/node*
For Centos 7 and 8
Remove NodeJS
sudo yum remove -y nodejs
sudo rm -rf /var/cache/yum
sudo rm /etc/yum.repos.d/nodesource*
sudo yum clean all
Remove residual files
whereis node
sudo rm -rfv /usr/bin/node /usr/local/bin/node /usr/share/man/man1/node.1.gz
sudo rm -rfv /usr/bin/npm /usr/local/bin/npm /usr/share/man/man1/npm.1.gz
sudo rm -rfv /usr/local/bin/npx
sudo rm -rfv /usr/local/lib/node*
sudo rm -rfv /usr/local/include/node*
sudo rm -rfv /usr/lib/node_modules/
Just remove these files. No need to do anything else.
rm -rf ~/.nvm
rm -rf ~/.npm
rm -rf ~/.bower

Resources