Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iMacker20

macrumors newbie
Original poster
May 12, 2020
20
7
Download link: GCC 14

installer.png


This is an installer for GCC 14 x86. It works on these operating systems:
- Mac OS 10.4
- Mac OS 10.5
- Mac OS 10.6
- Mac OS 10.7

It will create x86 (32-bit software).

This is what comes with the installer:
- cctools
- gcc_select
- gettext-runtime
- gmp
- isl
- ld64
- ld64-97
- libgcc
- libgcc14
- libiconv
- libmpc
- lz4
- mpfr
- xz
- zlib
- zstd
- gcc14

It installed to /opt/local/bin/.
The compiler itself is named g++-mp-14.
It implements C++23 and C++26 features.
This can be shortened to g++ by using the alias command like this: alias g++=/opt/local/bin/g++-mp-14
If you want to make this change permanent, add the above command to your ~/.profile file.

Setup Directions:
Open the Terminal.
Use this command to open the ./profile file: pico ~/.profile
Then add this command to the file: alias g++=/opt/local/bin/g++-mp-14
Use Control-o to save your changes.
Use Control-x to exit the program.

How to use:
/opt/local/bin/g++-mp-14 -o program -std=c++23 main.cpp && ./program

Example:
Save this program to a file called main.cpp and run the command above.

Code:
#include <print>

int main()
{
    std::println("Hello from C++23");
    return 0;
}

You should see the output "Hello from C++23".

Enjoy!
 
Hi! This is kind of neither here nor there, but how does this work to enable C++23 features? When I built NodeJS 24 for OS X 10.9 a few weeks ago, I had to first patch macports-libcxx in order to get a C++20 standard library, and then set the environment very carefully so it would use that library.

I assume the difference is that I was compiling with clang/libcxx vs gcc, but why is it seemingly easier with gcc? Could I have just used gcc instead to make my life easier?

Semi-separately, will software compiled with this GCC 14 in Tiger work on a vanilla copy of Tiger?
 
I assume the difference is that I was compiling with clang/libcxx vs gcc, but why is it seemingly easier with gcc? Could I have just used gcc instead to make my life easier?
Honestly I think GCC is better than Clang. There are times where using GCC does make life easier. I use a version of GCC that can use C++ 17 features for a program that can run on System 6. Lets see Clang do that.

Semi-separately, will software compiled with this GCC 14 in Tiger work on a vanilla copy of Tiger?
That is a good question. It is a matter of bundling all the dylib files that binary depends on. Once you do that then you should expect your program to run on a vanilla copy of Tiger.

This command will show you a list of dylib files your program depends on:
otool -L <your program>

Are you the same Wowfunhappy who works on the Firefox Dynasty project on Github? If you are you commented on one of my issues. Small world.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.