How to change gfortran version - macos

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.

Related

latest version glibc not configured properly on my Linux distro image

Recently, I have installed glibc-2.35 version on my Linux distribution, before I have glibc-2.27 version. After Installing I am not able to use latest version glibc as a default for compiling source code.
As a sample trail, I have successfully compiled sample program with the latest version glibc by using following command.
gcc sample.c -o out -Wl,--rpath=/usr/lib -Wl,--dynamic-linker=/usr/lib/ld-linux-riscv64-lp64d.so.1
Here, I am facing a big difficulty is how to set latest glibc as a default glibc so that I can compile source packages normally like .configure and make -j8 and make install.
Please help me to solve this issue. I am not aware of pathcelf stuff how to use exactly.

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.

Run or use GCC without install

Can I use GCC for e.g GCC4.0.3 without installation
In my macOS I have installed Clang xcode , and GCC from Homebrew
In my Linux they are installed as well
But I want to use GCC (Specially older version) besides most updated version
Like NVM that manage Node version and it lets you install many nodejs with different version on your system
I want to use GCC4 specially for science and compiling Old FORTRAN to make my Source codes run and see the results
In new OS both macOS and Linux when you install gcc it will install most updated and that is not useful for old fortran or old codes.
So In my solution i think its better to use gcc without install or even install gcc to custom directory folder and copy the codes in that directory and compile them but not to install as wide system and make incompatibility with default GCC and CLANG on system
Thanks in advance

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

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.

Clang version 1.6 cannot be updated

I have a very strange issue with clang. I'm running OSX 10.10.1 and have installed XCode 6.1.1 from here. For another project, I wanted to update Ruby from 2.1.2 to 2.2.0 via rbenv install 2.2.0. The command prints the following error:
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...
BUILD FAILED (OS X 10.10.1 using ruby-build 20141225)
Inspect or clean up the working tree at /var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502
Results logged to /var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502.log
Last 10 log lines:
Via: 1.1 2ce6276171358bf7d052aa190ed98f8d.cloudfront.net (CloudFront)
X-Amz-Cf-Id: 42q6Sa73ORpGbCgaHIpsBwTRP8ycUAhsdTolikEbyxqMrn9uePtfCA==
/var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502/ruby-2.2.0 /var/folders/4z/s4lwbd314_lg3hprgp72qsqr0000gn/T/ruby-build.20150112115924.6502 /usr/bin
checking build system type... x86_64-apple-darwin14.0.0
checking host system type... x86_64-apple-darwin14.0.0
checking target system type... x86_64-apple-darwin14.0.0
clang: error: invalid version number in '-mmacosx-version-min=10.10.0'
configure: error: clang version 3.0 or later is required
make: *** No targets specified and no makefile found. Stop.
Googled for invalid version number in '-mmacosx-version-min=10.10.0' but I did not find any helpful information. By running clang --version it turns out that my clang executable is version 1.6 (!):
Apple clang version 1.6 (tags/Apple/clang-70)
Target: x86_64-apple-darwin14
Thread model: posix
This seems very weird, because XCode is usually shipped with LLVM 6. I tried to (re)install the Command Line Tools (in which clang should be located), but XCode doesn't offer me the option to download/update them:
Trying to install them via xcode-select via the command line: xcode-select --install as suggested here results in showing the help message, indicating that the --install-command is unknown (xcode-select is version 895). I also tried to download and install it manually but it has absolutely no effect. The xcode-select-path is /Applications/Xcode.app/Contents/Developer but I also tried /Applications/Xcode.app.
I also tried to update clang via Homebrew:
$ brew install llvm --with-clang --with-asan
[...]
LLVM executables are installed in /usr/local/opt/llvm/bin.
Extra tools are installed in /usr/local/opt/llvm/share/llvm.
$ brew install llvm --with-clang --with-asan
Warning: llvm-3.5.0_2 already installed
but in none of the two paths is a clang executable.
So my question is: Is there a way to update clang? Or a workaround to install ruby 2.2.0 anyway? I'm stuck here for days, any help is greatly appreciated!
EDIT
I found out that newer XCode versions (I think from 5.0 upwards) come with LLVM/Clang inside the XCode.app-folder. A few months ago, I installed XCode 4.something for testing purposes - these versions overwrite system tools like clang and xcode-select. Reinstalling XCode 6 will not update them.
I fixed it by copying /usr/bin from another Mac, but there must be a way to fix it without this workaround.

Resources