Installing older version of GCC from source - gcc

I have gcc4.6 installed. I need 4.2 to be installed without disturbing current version.
OS - Ubuntu 12.04 LTS

Either install using --prefix configure switch to choose another path to install to, or --program-suffix switch, e.g. --program--suffix=-4.2. The docs have more information.
Please note that by default, the prefix will be /usr/local/, but the Ubuntu package will install to just /usr/, so things should be fine. However, if your $PATH lists /usr/local/bin before /usr/bin, you might still run into problems.

Related

Why do I have two versions of sqlite?

On my iMac (10.13.6, which is as far as it can be upgraded), I typed sqlite3 and it said I was running version 3.19.3.
So I tried upgrading with brew upgrade sqlite3 but it said sqlite3 3.28.0 already installed. The SQLite site says 3.28.0 is currently the most up to date version.
How come I have two different versions of SQLite? Does Brew install to a different location than the standard OSX version? And if so, how do I either use the upgraded brew version or upgrade the OSX version?
In general, homebrew installs links for all binaries it installs in /usr/local/bin. You can see that by running:
ls -l /usr/local/bin
So, you need to add that directory to your PATH:
export PATH=/usr/local/bin:$PATH
You likely want to do this in your login profile, which is probably $HOME/.profile so that it gets set every time you login.
I ended up creating alias command in the .zshrc file like so:
alias sqlite=/usr/local/opt/sqlite/bin/sqlite3
Don't know if that was the best way, though.

Installing latest version of gmsh

How can I install latest version of gmsh, which is gmsh 3.0.7 on ubuntu 16.04LTS please?
Using sudo apt install gmsh it only installs gmsh 2.10.1.
I also did update and upgrade my system but still only version 2.10.1.
Any suggestion please?
Cheers
First, I prefix this by saying I'm nothing like an expert, but this worked for me:
Uninstall the repository version:
sudo apt-get remove gmsh
Download a zipped copy of the latest stable release for linux from the gmsh website:
http://gmsh.info/#Download
Unzip gmsh:
tar -xvzf gmsh-3.0.6-Linux64.tgz (or whatever version you've downloaded)
This makes a folder gmsh-3.0.6-Linux64 containing gmsh which is portable. Put it somewhere you can find it. I put it in my home directory.
Navigate to the bin folder:
cd ~/gmsh-3.0.6-Linux64/bin
From the bin folder you can start gmsh by typing:
./gmsh
I made it generally available at the command line by editing my .bashrc, adding this line:
export PATH="$PATH:/home/bob/gmsh-3.0.6-Linux64/bin"
You will need to make the path appropriate for your location.
Hope this works.
if it can help someone here, I recently compiled GMSH from source without difficulty, simply with the typical combination of cmake and make; their GitLab repository explains these few steps to follow
https://gitlab.onelab.info/gmsh/gmsh
Although this may vary, pay attention to few libraries which weren't present on my fresh Ubuntu installation (libpng, libjpeg, and FLTK libraries), cmake properly highlighted these missing libraries. FLTK is needed for the UI.
Ubuntu 20.04 LTS has gmsh version 4.4.1 in the official repositories. So installation is again simply this:
sudo apt install gmsh

Why isn't cabal-install upgrading itself? [duplicate]

I just installed Haskell from it's official site. After that, following it's quick-start tutorial.
I run:
cabal update
Which shows this message:
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
I run:
cabal install cabal-install
and check if the update was successful with
cabal update
The result, it shows me the same message from the start:
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
So, did I upgrade the cabal-install or not? How do I check my cabal's version?
Important: I'm using the 64 bits version for Mac OS X.
In my case (and probably others?) cabal is initially installed in /usr/local/bin by homebrew when installing haskell-platform. When upgrading cabal, the version is installed to $HOME/.cabal/bin/cabal. You ought to place your cabal bins higher in your $PATH, like so:
export PATH=$HOME/.cabal/bin:$PATH
I had a similar issue after installing the Haskell platform 2012.4.0.0 on OSX. When I ran cabal install cabal-install, it ended with:
cabal: ../ghc-7.4.2/lib/cabal-install-1.16.0.2/bin/cabal: does not exist
So I guessed it got its paths mixed up somewhere. However the executable was actually built successfully (check for ~/Library/Haskell/ghc-7.4.2/lib/cabal-install-1.16.0.2/bin/cabal) and I just copied it from there to ~/Library/Haskell/bin which is on my path.
Thereafter everything ran OK:
$ which cabal
/Users/luke/Library/Haskell/bin/cabal
$ cabal update
Downloading the latest package list from hackage.haskell.org
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0.3 of the Cabal library
Everyone seems to experience a slightly different issue here. In my case, cabal was built successfully and installed to ~/Library/Haskell/bin.
As noted in ~/.cabal/config, adding ~/Library/Haskell/bin to PATH solved the issue.
Below is the description in ~/.cabal/config:
-- === Built executables will be installed in:
-- ~/Library/Haskell/bin
--
-- You may wish to place this on your PATH by adding the following
-- line to your ~/.bash_profile:
-- export PATH="$HOME/Library/Haskell/bin:$PATH"
On OS X 10.8 I had to add /Library/Haskell/bin to my PATH (put it before /usr/bin). Adding that fixed the error message
cabal --version gives you the version of cabal you're running. If you want to see the version of cabal-install you have, run cabal info cabal-install and look at the versions installed line.
For me on OS X, versions installed is [unknown], after running cabal install cabal-install, which is not great.
I had this problem too.
After running which cabal, I found that it was using /usr/bin/cabal. Deleting this solved the problem.
It seems that cabal by default installs packages locally for the current user and therefore will not be part of the PATH. Look at the
Cabal documentation specifically step 1.2.1 where you can change the configuration to install things globally by default (not recommended).
The way I installed cabal was cabal --global install cabal-install but still had problems with the path which since the default installation of Haskell puts the path in this order C:\Program Files\Haskell Platform\2013.2.0.0\lib\extralibs\bin;C:\Program Files\Haskell Platform\2013.2.0.0\bin; where the first path has precedence over the second one. With the --global flag cabal installed the binary to C:\Program Files\Haskell\bin which isn't in my path but must be added before the C:\Program Files\Haskell Platform\2013.2.0.0\lib\extralibs\bin path.
Taken from the documentation
You must put the cabal.exe in a directory that is on your %PATH%, for example C:\Program Files\Haskell\bin.
In my case, a combination of several answers here was required to get through this issue. I'll attempt to provide a more comprehensive solution in one answer for anyone else in my situation.
For starters, running which cabal showed me that /usr/bin/cabal was being loaded, which was a symlink to /Library/Haskell/ghc-7.8.3-x86_64/bin/cabal. I believe newer versions of cabal were being installed, but this path was specific to a single version so they were ignored. Adding /Library/Haskell/bin to the front of my $PATH remedied that situation.
Second, and more importantly, the new versions of cabal-install were being installed into my cabal sandbox instead of the system location. I didn't see any other answers suggesting this, but after a little monkeying around I found that moving outside of my application's directory allowed cabal to actually install to the system.
Finally, adding the --global flag to the command fixed the problem. My final command was cabal install --global cabal-install. After this, I was finally able to update properly.
TL;DR: if you use cabal sandboxes, move outside the directory of your project and run cabal install --global cabal-install. Also, check your $PATH variable as others have suggested.
In my case the new version of cabal was being installed in the .cabal-sandbox of the project I was in.
e.g. Checking the version:
./.cabal-sandbox/bin/cabal --version
So I needed to upgrade it outside of that. This was on OSX.

How can I force Homebrew to install 64-bit PostgreSQL on OSX SL? Specifically the libpg.dylib file

I have been trying to install the Ruby PG gem, but kept getting the "Failed to build gem native extension." error.
After sifting through a lot of google results, I tried nearly every recommendation I came across, all without luck. However, I believe I've tracked down the source of the problem ... Homebrew.
Homebrew installed PostgreSQL 9.0.4, but only with the 32-bit libraries. As I am running Snow Leopard (10.6.8) with XCode 3.26, I need the 64-bit libraries in order to compile everything without library mismatch errors. But I cannot seem to find out how to force Homebrew to install them, even with ARCHFLAGS and ENV set to "-arch x86_64".
Suggestions, please :)
p.s. I found out that I only had 32-bit libraries installed by running:
file /usr/local/Cellar/postgresql/9.0.4/lib/libpq.5.3.dylib
which returned:
/usr/local/Cellar/postgresql/9.0.4/lib/libpq.5.3.dylib: Mach-O dynamically linked shared library i386
Update: re-installed Homebrew, which installed postgresql/9.1.1 and 64-bit shared libraries.
But another problem emerged, while installing the PG gem. For some reason it was looking for ginstall in /opt/local/bin. As I had removed MacPorts, that directory was also removed. I did find this solution:
mkdir -p /opt/local/bin/
sudo ln -s /usr/bin/install /opt/local/bin/ginstall
And now everything seems to be working ....
So it looks like my first install, using Homebrew, must have been done with regular Leopard.
Removing the Homebrew "Cell" directory and all of its contents, running the install script again, then doing "brew install" and "brew update" with all needed packages, got me the latest version of PostgreSQL, with 64-bit developer library.
And creating the above symbolic link fixed any left over errors from the MacPorts removal.
Now all is well :)

Where is PyGTK for Mac OS X?

Is there a binary out there for the current mac os x, python for PyGTK? I work with multiple desktop environments (mac, windows, gnome) and really consider python's lack of cross platform GUI's a problem. Does anyone know where I can find a built version of PyGTK and GTK for Mac?
I cant clone the git repository, it keeps timing out.
brew install pygtk worked for me (requires homebrew).
Confirmed to work with OS X 10.10 too, but by default it will install it into brew's Python distribution, so if you are still using the native python, it will not find it.
I don't use macports but it seems that jhbuild works for me. Below is the steps that I've done.
download gtk-osx-build-setup.sh from: https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh and save it to your home directory.
fire up terminal and navigate to your home directory and run the command sh gtk-osx-build-setup.sh
the shell script will warn you that ~/.local/bin isn't added to your environment variable to do this, edit your .profile file located at your home directory and /Users/<username>/.local/bin to your environment variable. to know more on how to edit this file check out: http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
after that, do a ~/.local/bin/jhbuild bootstrap command. it will download and install some necessary utilities.
download and install the beta version of the gtk+ osx framework at: http://ftp.imendio.com/pub/imendio/gtk-osx/Gtk-Framework-2.14-LATEST.dmg
before installing the meta-gtk-osx-python, you need to build and install some other packages that jhbuild doesn't install automatically, so what i did was i installed libpng by doing the command: ~/.local/bin/jhbuild build libpng
you also need to install libtiff so do the command: ~/.local/bin/jhbuild build libtiff
and also gtk-doc is needed so: ~/.local/bin/jhbuild build gtk-doc
and finally you can now install meta-gtk-osx-python by doing a: ~/.local/bin/jhbuild build meta-gtk-osx-python
Let me know if it works.
There is an installer for PyGTK 2.24 in test here, announced on the PyGTK list.
UPDATE project has moved on macpkg's sourceforge page.
I couldn't make it work with meld (segmentation fault), but sample PyGTK programs work OK.
UPDATE 2 since then a new package Py3GTK3 appeared on the same sourceforge page. Haven't tested though.
There is now a mac package on sourceforge
Download the latest package from http://sourceforge.net/projects/macpkg/files/PyGTK/ and install.
If you're just trying to use the system python, this is all you'll have to do.
If you're not, the following is how to install it with pyenv, which can be installed with Homebrew. With brew installed, you can install version pyenv and Python 2.7.8 with:
brew install pyenv && pyenv install 2.7.8
After you've done that, you'll then have copy the gtk package and its dependencies into your python installation:
cd /opt/gtk/lib/python2.7/site-packages/ && \
cp * ~/.pyenv/versions/2.7.8/lib/python2.7/site-packages/
That's it. You can also similarly install the Py3GTK3 package which has packages for python 2.7 and 3.2 from http://sourceforge.net/projects/macpkg/files/Py3GTK3/.
Have you tried doing it using macports? This website shows how.

Resources