Install GCC 5.X on Xcode 6 - xcode

I need to use/integrate GCC 5.X (in my case 5.3, and it is already installed) on Xcode 6.2.
I've found a lot of outdated tutorials about GCC 4.X and Xcode 5 (or lower), but all of them are outdated and do not work anymore.
I've also found this tutorial, but I have not the 5.3.xcplugin file that the tuto recommend to copy.
I am still on Mac OS X Maverick, and I can install Xcode 7 if necessary.
Anybody would know how to do it?

MacPorts still has an installer for Mavericks. It will likely add /opt/local/bin:/opt/local/sbin to your $PATH in .profile, or whatever shell startup file you use, and leave a backup of the old file you can probably get rid of once you're satisfied.
I would suggest upgrading to the latest Xcode release - and to El Capitan unless you have some specific reason not to. AFAIK, if you can run Mavericks, you can run the latter. I will avoid any arguments about the merits of Brew vs. MacPorts here. There's plenty of documentation on the MacPorts pages.
Make sure the package database is up to date:
sudo port -v selfupdate`
Have a look at the existing gcc ports:
port list | grep gcc
note: you might as well install the stable gcc6 (6.1.0) package.
Install the package - this may also install dependency packages:
sudo port install gcc6 [-universal]
This may take a while, as it might need to build from source. For most packages, the -universal flag says that you don't care about 32-bit (IA32) builds, etc.
You can see various package versions with port select ... options, e.g.,
port select --list gcc
And enable the installed gcc:
sudo port select --set gcc mp-gcc6
You may need to rehash so the shell adds the new binaries to its search. Or just start a new shell. gcc -v should yield something like:
gcc version 6.1.0 (MacPorts gcc6 6.1.0_0)

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.

Replacing old Xcode command line tool with newer Brew version

I'm trying to build a binary from source code which has a dependency on the package" NASM 2.12.02 or later. However, I have an earlier version already installed on my Mac via Xcode:
/usr/local/bin/nasm -v
NASM version 0.98.40 (Apple Computer, Inc. build 11) compiled on May 1 2018
So to (attempt to) rectify this, I used Homebrew to install a much newer version of the package
brew info nasm
nasm: stable 2.13.03 (bottled), HEAD
However, now my PATH is only pointed to the old NASM executable, while the new tool seems to be sitting in Homebrew's Cellar (ie. /usr/local/Cellar/nasm/2.13.03).
Is there a nice way of "switching" between these versions so that the system PATH views only the newer version and disregards the older one? So far I've thought of rm -rf-ing the old version and exporting the new version to my PATH, but that seems very destructive.
Also, I have run the command: brew doctor and have resolved all linker errors, but that has not seemed to help.
Any help would be greatly appreciated!
To fix this, I used the following command:
export PATH=/usr/local/Cellar/nasm/2.13.03/bin:$PATH
This modifies the PATH variable to point to the /usr/local/Cellar/nasm/2.13.03/bin directory and find the nasm executable there before looking in /usr/local/bin.

Uninstalling gcc completely in Mac OS X Yosemite?

I am trying to uninstall gcc completely from my mac but unable to do so.
Current status :
➜ ~ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0 /5.0.0/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-5-20141005/configure --enable languages=c++,fortran
Thread model: posix
gcc version 5.0.0 20141005 (experimental) (GCC)
~ which gcc
/usr/local/bin/gcc
I had xcode installed and I removed that completely and also I tried to uninstall using brew. I think I had two different versions installed one using brew and other directly from hpc.sourceforge.net .
Since you have your gcc in /usr/local, it is not part of your operating system. The cleanest - but brute force - way is to delete /usr/local completely, and then reinstall the things you want to have there. See also here.
/usr/local is a directory that doesn't come from OSX, but is used by tools like Homebrew. If you delete it, you will lose everything you installed with Homebrew, including Homebrew itself, but you can reinstall it afterwards. You will also lose other tools that install themselves in there. Depending on how much you have there, it may be a quick or a very long procedure.
If you don't want to do this, you have to consult the source that provided you with your gcc. Or you could just rm gcc and its related binaries under /usr/local/bin and everything under /usr/local/libexec/gcc. This will not harm your OS, but it will probably leave you behind with unnecessary files littering your /usr/local. I strongly advice against doing this unless you know what you're doing.

Downgrade or remove GCC 4.8 from Mac OS X Mountain Lion

I am in the process of trying to essentially start from scratch with getting homebrew, GCC and RVM 1.9.3 on to my mac OS x 10.8.2 after determining that my problems with RVM were "related to a messy environment which can not be fixed automatically without what we plan for RVM2" in a thread that began here on SO and ended as a github for ticket RVM.
I had XCode 4.6 with Command Line Tools installed as was recommended here but at this point have completely deleted XCode (by trashing it- due to the version sudo /Developer/Library/uninstall-devtools --mode=all did not work), I uninstalled homebrew by running
cd `brew --prefix`
brew install libtool
rm -rf Cellar
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
and imploded my rvm. However, I am not sure how to go about 'refreshing' my GCC situation. Which is as follows:
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-apple-darwin12.2.0
Configured with: ../gcc-4.8-20130113/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.8.0 20130113 (experimental) (GCC)
I have Time Machine backups from various stages of my undoing and made a bootable USB of Mountain Lion but was hoping to try reinstalling a fresh copy of Xcode or running the GCC-10.7 program installer before using either of those methods. However, I don't know if I can or how I would rectify the GCC situation before doing so.
From reading Change to GCC 4.7.., it seems that there might be a way of pointing/directing my system to a different version of GCC, but I don't know how to do that without MacPorts or homebrew.
Is there a way to get rid of the experimental GCC 4.8 so it doesn't come back in the future?
I have run a VM of my system with a copy of /usr/local/ from before I had ever installed XCode CLT or any of these other libraries, but my $ gcc -v still came back with gcc version 4.8.0
Sorry if I omitted and/or added necessary/unnecessary information and thank you in advance for any help.
This is a confusing dump of information. You don't want to use MacPorts or Homebrew? I seriously recommend you go with Homebrew. That should get the latest GCC 4.8 onto OR OFF OF your box with ease. If you can't figure out where your current gcc 4.8 is, try typing "which gcc" and that will tell you where it's located. It's not coming back. Clearly you never removed it if typing gcc brings up gcc. It's probably in /usr/local/opt.
If you insist on wiping out ALL the homebrew stuff manually, you COULD just zap /usr/local/opt to get rid of the symlinks, and /usr/local/Cellar to get rid of the real stuff, but I don't recommend it. Why? Zapping directories by hand could cause you to lose data especially if you're prone to making mistakes. Use MacPorts or Homebrew to REMOVE whatever you used it to install.

Compiling sphinx search on Mac OSX Lion

I am trying to install sphinx on Lion.
I've tried versions 0.9.9, 2.0.2, and trunk (as of now).
However, ./configure breaks: "universal endianness not supported".
I have only seen this configure error on Lion; Snow Leopard and earlier OSX versions work fine.
I've tried forcing little endian via CFLAGS etc., but I'm not sure what flag needs tweaking. Can anyone help?
You can install it via MacPorts. Caveat is that your mysql / postgres must also have been installed from ports to satisfy a dependency.
If you're on Lion, the comment in this bug report is useful:
https://trac.macports.org/ticket/31666
sudo port clean sphinx;
sudo port install sphinx configure.compiler=llvm-gcc-4.2

Resources