Problems building C++ with Pixel's new gcc patch.

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Problems building C++ with Pixel's new gcc patch.

Post by ooPo »

So I'm trying to build ps2-gcc with C++ support. Here's what I do:
## gcc-3.2.2 (C++)
cd $TMPDIR; tar xfvz $SRCDIR/gcc-3.2.2.tar.gz; cd gcc-3.2.2
cat $SRCDIR/gcc-3.2.2-PS2.patch | patch -p1
mkdir build; cd build; ../configure --prefix=$PS2DEV/ps2 --target=ps2 --enable-languages="c,c++" --enable-cxx-flags="-G0"
make CFLAGS_FOR_TARGET="-G0"; make install
cd $TMPDIR; rm -Rf gcc-3.2.2
And here's the result:
In file included from ../../../../libstdc++-v3/libsupc++/eh_alloc.cc:33:
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:86: `div_t' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:87: `ldiv_t' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:97: `div' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:102: `ldiv' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:104: `mblen' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:105: `mbstowcs' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:106: `mbtowc' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:115: `wcstombs' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:116: `wctomb' not declared
/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/include/cstdlib:122: syntax error before `(' token
make[2]: *** [eh_alloc.lo] Error 1
make[2]: Leaving directory `/tmp/gcc-3.2.2/build/ps2/libstdc++-v3/libsupc++'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/tmp/gcc-3.2.2/build/ps2/libstdc++-v3'
Inside the file, it seems the problem is in this blurb of code:
namespace std
{
using ::div_t;
using ::ldiv_t;

using ::abort;
using ::abs;
using ::atexit;
using ::atof;
using ::atoi;
using ::atol;
using ::bsearch;
using ::calloc;
using ::div;
using ::exit;
using ::free;
using ::getenv;
using ::labs;
using ::ldiv;
using ::malloc;
using ::mblen;
using ::mbstowcs;
using ::mbtowc;
using ::qsort;
using ::rand;
using ::realloc;
using ::srand;
using ::strtod;
using ::strtol;
using ::strtoul;
using ::system;
using ::wcstombs;
using ::wctomb;

inline long
abs(long __i) { return labs(__i); }

inline ldiv_t
div(long __i, long __j) { return ldiv(__i, __j); }
}
Any suggestions? I'm not a C++ monkey.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

After talking with pixel on irc:

../configure --prefix=$PS2DEV/ps2 --target=ps2 --enable-languages="c,c++" --with-headers=$PS2DEV/ps2/ps2/include --enable-cxx-flags="-G0"

Next time people want me to change my script, the answer is no.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Having to specify --with-headers is either a bug in GCC 3.2.2 (or the patch), or an toolchain environment config issue -- GCC *always* checks <prefix>/<target>/include/ for its include files (among other directories, some of which you can configure on the configure line). This is the reason that newlib installs its includes into <prefix>/<target>/include/.

When I get to the tools, I'll take a look at this (note: I have never had to explicitly use --with-headers on the commandline on any of the systems I use [cygwin or linux]). --with-headers is for giving GCC an include path outside of its normal realm.

Also .. didn't you say this broke for you with pixel's latest patch? And what's your bootstrap configure line again?
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

For reference, I'm doing this all under linux. There's something mysterious at work here. When I'm done getting stuff compiled, I'll give you a copy of the autobuild script to toy with.

The conversation I was having with pixel about the broken thing was a miscommunication. He was talking about the stuff he had to do to build as non-root as part of a debian source package script, I was talking about something else. Ignore it. :)
Post Reply