https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105599
Bug ID: 105599
Summary: g++ binary: undefined symbols _main referenced from
__start in crt1.0
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mario_grgic at hotmail dot com
Target Milestone: ---
I have compiled gcc 12.1.0 from source on macOS 10.15.7 (Catalina) with XCode
12.1. I used the following configuration:
```
../configure --prefix=/usr/local --with-gmp=/usr/local --with-mpfr=/usr/local
--with-mpc=/usr/local --with-isl-prefix=/usr/local --with-cloog=/usr/local
--enable-checking=release --enable-languages=c,c++,fortran
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
--with-system-zlib --with-zsstd=/usr/local --disable-multilib --disable-nls
```
Everything builds and installs correctly. gcc and other binaries work, however
invoking g++ without any arguments produces
```
$ /usr/local/bin/g++
Undefined symbols for architecture x86_64:
"_main", referenced from:
__start in crt1.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
```
Note that g++ works correctly and compiles and produces working binaries when
invoked with correct arguments.
Similar thing happens with c++ binary.