Thanks @sevarch, should be fixed here as well.
I tried several ideas (--disable-sjlj-exceptions, changing only CXXFLAGS, ...) but none of them had any effect so in the end I went with your -O1 workaround.
Btw not sure why you added -std=c17 there considering that gcc-3.3.6 was released in 2005. -std=gnu99 did the trick and as a bonus, got rid of all that annoying warnings about using the K&R format.
gcc15 is now available on Manjaro but it doesn't matter. Even with my fixes this won't compile on gcc15 or gcc14 addon or gcc12 addon. It will build downgrading to gcc14 and using the gcc15 builds of glibc gcc-libs and binutils. It will not build with gcc15 and the same. The build fails with an xgcc "configure:3969: internal compiler error: Segmentation fault". I think it's a bug in gcc15 producing faulty C++ code that should be fixed soon.
Got it! It's a bug in gcc15 -O2 and -O3. Change to O1 and it builds. See lib32-libstdc++5 for the changes.
I experience the same issue as others in the comment section.
gcc -Wno-implicit-int -Wno-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-int-conversion -c -DHAVE_CONFIG_H -march=x86-64 -O2 -I. -I../../gcc-3.3.6/libibn -c -DHAVE_CONFIG_H -march=x86-64 -O2 -I. -I../../gcc-3.3.6/libiberty/../include -W -fpic ../../gcc-3.3.6/libiberty/getpwd.c -o pic/getpwd.o; \ libiberty/getpwd.c -o pic/getpwd.o; \ else true; fi
else true; fi ../../gcc-3.3.6/libiberty/getpwd.c:41:14: error: conflicting types
../../gcc-3.3.6/libiberty/getpwd.c:41:14: error: conflicting types for ‘getwd’; have ‘char *(void)’ 41 | extern char *getwd ();
41 | extern char *getwd (); | ^~~~~
| ^~~~~ In file included from ../../gcc-3.3.6/libiberty/getpwd.c:30:
In file included from ../../gcc-3.3.6/libiberty/getpwd.c:30: /usr/include/unistd.h:545:14: note: previous declaration of ‘getwd
/usr/include/unistd.h:545:14: note: previous declaration of ‘getwd’ with type ‘char *(char *)’ 545 | extern char *getwd (char *__buf)
545 | extern char *getwd (char *__buf) | ^~~~~
| ^~~~~ make[1]: *** [Makefile:127: getpwd.o] Error 1
make[1]: *** [Makefile:127: getpwd.o] Error 1 make[1]: Leaving directory '/home/filip/.cache/yay/libstdc++5/src/
make[1]: Leaving directory '/home/filip/.cache/yay/libstdc++5/src/gcc-build/libiberty' make: *** [Makefile:1293: all-libiberty] Error 2
make: *** [Makefile:1293: all-libiberty] Error 2 ==> ERROR: A failure occurred in build().
==> ERROR: A failure occurred in build().
getcwd is easily fixed by adding -std=gnu17 to export CC=. The next error "unable to detect exception model" I haven't yet found a fix for.
However my Manjaro still uses gcc 14.2.1 so I can't test it (yet). Will get back to it once I have gcc 15 installed.
Likely you can test using the Manjaro equivalent of devtools (manjaro-chroot I guess) for building in a chroot using the unstable branch where there is already gcc 15
@pobrn thanks for the build log. Indeed, this looks like an issue to be fixed. However my Manjaro still uses gcc 14.2.1 so I can't test it (yet). Will get back to it once I have gcc 15 installed.
Does not build with GCC 15: https://gcc.gnu.org/gcc-15/porting_to.html#c23-fn-decls-without-parameters
../../gcc-3.3.6/libiberty/getpwd.c:41:14: error: conflicting types for ‘getwd’; have ‘char *(void)’
41 | extern char *getwd ();
| ^~~~~
In file included from ../../gcc-3.3.6/libiberty/getpwd.c:30:
/usr/include/unistd.h:545:14: note: previous declaration of ‘getwd’ with type ‘char *(char *)’
545 | extern char *getwd (char *__buf)
| ^~~~~
make[1]: *** [Makefile:127: getpwd.o] Error 1
Please don't flag it as "out of date only because you've experienced a build error. I built and installed this package in March 2025 without any issue so it's hardly out of date.
Unless you provide a more comprehensive bug report, I can't help you.
No possible compile :
gcc-3.3.6/libiberty/getpwd.c:41:14: error: conflicting types for ‘getwd’; have ‘char *(void)’