How to install the latest version of GCC on Mac OS? - macos

I've tried googling but it all just confuses me.
Does anyone know how to do this?

Using homebrew you can install version 7.2.0 of gcc pretty easily.
Follow the installation instructions on https://brew.sh/. After installing, run the following command in your terminal (Terminal.app):
brew install gcc
That will install version 7.2.0 using the current gcc forumla which appears to currently be the latest version.

Related

Install older version of gcc cross compiler for arm on Ubuntu

I need to use gcc-arm-linux-gnueabi version 6.5, along with a version of libc that came out around the same period (I believe is libc-2.26). My host system is Ubuntu 18.04.
If I go with just a simple
sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi binutils-arm-linux-gnueabi
I'll get v7 for the gcc cross compiler and v2.30 for binutills, which does not work for me, since I'll end up with errors similar to the one described here.
If I try to download the deb packages, I get unmet dependencies.
I have also tried to force apt-get to install specific versions, using something like described here but I get error messages that the version I'm looking for cannot be found.
Is there a way to force ubuntu to install specific (older) version of gcc, libc, etc.?
I know that gcc v 6 is obsolete, but I cannot do otherwise.
You could give a try to the Linaro release of gcc 6.5, available here, which comes with glibc version 2.23.

How to install everything natively without rosetta 2 in M1 macs?

I have been using M1 macbook for almost half a year and initially, I installed many packages under rosetta 2 and many natively (I assume). I run my terminal under rosetta 2 but whenever I install any package using brew, I do it using arch -arm64 brew install <pkg-name>. Now, I have no clue if all this time, I had been installing the packages under rosetta 2 or natively.
Anyways, now I want to install the native versions of all the packages and software since now, most of them are available natively. Please help me to figure out how can I do this. All I want to do is remove everything and then install then natively without rosetta 2.
Some of the things which I want to reinstall are:-
Homebrew
Mini conda and the python libraries.
gcc and g++
MySQL
Node and npm
Also, in future, if I want to install anything natively then how should I do it?
If you used Homebrew to install all of the packages, try to uninstall them as you where using brew. Then uninstall the x86 version of Homebrew
And for the native versions, install the new Homebrew with the ARM terminal. And reinstall everything.

How to change gfortran version

I am using Bellhop ray tracing algorithm for MacOS. I have downloaded the source code for MacOS without the binaries.
I want to change my gfortran version from 9.2.0 to 8.3.0.
I installed it using homebrew. I have version 9.2.0 installed. I have it installed at /usr/bin/
I cannot seem to find any commands online to change the version.
gfortran -dumpversion
This gave me my version number but I cannot seem to find a command to get a different version.
I am working on macOS (Mojave V 10.14.6). I installed it using homebrew in /usr/local/bin/gfortran. I have version 9.2.0 installed.
type gfortran
Gives me the output:
/usr/local/bin/gfortran
Update: I believe I have 8.3.0 now downloaded by erasing 9.2.0 and downloading gfortran-8. I needed to completely remove it from my system before downloading a different version.

Debugging Qt app with Qt Creator: <no such value>

I'm using Qt Creator with Qt 5.1.1 in Ubuntu 12.04.
When I'm using the debugger to show content of any variable, the window always show "no such value" on every variable. Also on variables of type QString, int etc.
Is there a configuration problem on my Ubuntu?
Can anybody help me please?
It's been a year and a half ago, but the problem still remains actual for Ubuntu 12.04, Qt Creator 3.4.0 based on Qt 5.4.1.
As mentioned in Qt Creator Manual
Starting with version 3.1, Qt Creator requires the Python scripting extension. GDB builds without Python scripting are not supported anymore and will not work. The minimal supported version is GDB 7.5 using Python version 2.7, or 3.3, or newer.
I suppose that gdb --version gives you 7.4 (the last version of gdb for Ubuntu 12.04). That's why you have no such value issue.
1. Install a fresh gdb (7.8)
Remove the current gdb (to avoid conflicts with new one) and install development packet for python (to build gdb with Python scripting)
sudo apt-get remove gdb
sudo apt-get install python2.7-dev
Install gdb from the sources
wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz
tar -xf gdb-7.8.tar.xz
cd gdb-7.8/
./configure --prefix=/usr/local --with-python
make
sudo make install
Now gdb 7.8 is in /usr/local.
2. Update Qt Creator settings
Open menu Tools > Options ...
Select Build&Run, tab Debuggers
Click Add
Type Name you like, write Path: /usr/local/bin/gdb
In tab Kits change Debugger: with that you just created
Hope this help someone who still love Ubuntu 12.04 and Qt.

Set default GCC to Fink-installed GCC 4.5?

I've got GCC 4.2 that came with my installation of Mac OS X 10.6.4, plus GCC 4.5 installed via Fink. I wanted to use gcc_select to change the default compiler to GCC 4.5, but was told gcc_select does not exist.
Is there another way to set the default compiler? Or do I need to do so manually? If so, how?
Thanks!!
I used MacPorts to install my GCC 4.4, and also told MacPorts to download gcc_select:
sudo port install gcc_select
then I typed
gcc_select -l
to list the available versions. Then
gcc_select mp-gcc44
to switch. I haven't used Fink but hopefully you can install gcc_select from there :)

Resources