I made this installer for installing GCC 7 on Mac OS 10.4 and 10.5 (x86). Building it from source took about 8 hours. Installing it using this supplied installer will take about a minute.
GCC 7 Installer for Mac OS 10.4 and 10.5 (x86)
It comes with this software:
- cctools
- gcc_select
- gmp
- isl
- ld64
- ld64-97
- libgcc
- libgcc7
- libiconv
- libmpc
- mpfr
- zlib
- gcc7
It has been tested and works on Mac OS 10.4 and 10.5. It does not work on Mac OS 10.6 and higher.
The installer will install to /opt/local/bin/.
To test out the C++ compiler you can use this program:
Save this C++ code to a file called main.cpp.
Then use g++-mp-7 to build this program: /opt/local/bin/g++-mp-7 -o program main.cpp
Then run the program: ./program
Suggestions
Add /opt/local/bin to your PATH variable.
This can be done by adding this line to the ~/.profile file: export PATH=/opt/local/bin:$PATH
The ~/.profile file can't be seen normally from the Finder so using a UNIX text editor might be required.
I use pico to do this: pico ~/.profile
If you don't like having to type g++-mp-7 every time and instead would like to use something else, then you would want to use the alias command. This example would call g++-mp-7 when g++ is entered: alias g++='/opt/local/bin/g++-mp-7'
This command can also be saved into your ~/.profile file to have it run every time the Terminal application is ran.
GCC 7 Installer for Mac OS 10.4 and 10.5 (x86)
It comes with this software:
- cctools
- gcc_select
- gmp
- isl
- ld64
- ld64-97
- libgcc
- libgcc7
- libiconv
- libmpc
- mpfr
- zlib
- gcc7
It has been tested and works on Mac OS 10.4 and 10.5. It does not work on Mac OS 10.6 and higher.
The installer will install to /opt/local/bin/.
To test out the C++ compiler you can use this program:
C++:
// C++11 test program
#include <iostream>
#include <memory>
using namespace std;
// Prints a message when an instance is created and destroyed
class Tester
{
private:
string ptrType;
public:
Tester(string ptrType) { this->ptrType = ptrType; cout << "Object " << this << " created using " << ptrType << endl; }
~Tester() { cout << "Object " << this << " destroyed using " << ptrType << endl; }
};
int main()
{
// C++11 pointers
// shared_ptr test
shared_ptr<Tester> ptr2(new Tester("shared_ptr"));
// unique_ptr test
unique_ptr<Tester> ptr3(new Tester("unique_ptr"));
// C++11 lambda
// print a message
auto lambdaTest = []() { cout << "Hello from a lambda" << endl; };
lambdaTest();
return 0;
}
Save this C++ code to a file called main.cpp.
Then use g++-mp-7 to build this program: /opt/local/bin/g++-mp-7 -o program main.cpp
Then run the program: ./program
Suggestions
Add /opt/local/bin to your PATH variable.
This can be done by adding this line to the ~/.profile file: export PATH=/opt/local/bin:$PATH
The ~/.profile file can't be seen normally from the Finder so using a UNIX text editor might be required.
I use pico to do this: pico ~/.profile
If you don't like having to type g++-mp-7 every time and instead would like to use something else, then you would want to use the alias command. This example would call g++-mp-7 when g++ is entered: alias g++='/opt/local/bin/g++-mp-7'
This command can also be saved into your ~/.profile file to have it run every time the Terminal application is ran.