GDC on psptoolchain

Vince toto at toto.fr
Fri Jul 25 05:07:13 PDT 2008


Hi Kostas,

I am interested in your PSP port and I would like to add it to my cegdc 
(gdc for window CE), it could be interesting to have a gcc for embedded 
targets.
I am working on scripts to build differents versions, something like :


sh build-gdc.sh --target psp or
sh build-gdc.sh --target arm-mingw32ce
...










Kostas Karanikolas a écrit :
> John Grindstaff wrote:
> 
>> Thanks. How exactly do you compile libgphobos.a for the PSP? I tried it
>> but got errors about missing files. What directory should I be in and
>> what command do I type?
> 
> Build instructions
> 
> First of all I'm running OSX Leopard on a PowerPC, so what you need to
> do may vary, not by much on a Unix system but potentially a lot on Windows.
> 
> I assume you have the latest and complete psp toolchain. If not I
> suggest you try downloading & installing a prebuilt one or preferably
> use the "psptoolchain" build scripts found on:
> svn://svn.ps2dev.org/psp/trunk/psptoolchain
> 
> Ok, here we go:
> 
> 1. Make a temporary directory for your build
> mkdir pspd
> cd pspd
> 
> 2. Setup environment paths
> export PSPDEV=/the/path/where/the/pspsdk/is/already/installed
> export PATH=$PATH:$PSPDEV/bin
> 
> # If your native compiler tools are in some extra non standard path
> # also export these variables.
> # In my case I use macports, installed on /opt/local
> export C_INCLUDE_PATH="/opt/local/include"
> export CPLUS_INCLUDE_PATH="/opt/local/include"
> export LIBRARY_PATH="/opt/local/lib"
> 
> 3. Download and unpack gcc
> wget --continue ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.0/gcc-4.1.0.tar.bz2
> 
> tar -xvjf gcc-4.1.0.tar.bz2
> 
> 4. Download and apply psp toolchain patches to gcc
> svn export
> svn://svn.ps2dev.org/psp/trunk/psptoolchain/patches/gcc-4.1.0-PSP.patch
> cd gcc-4.1.0
> patch -p1 <../gcc-4.1.0-PSP.patch
> 
> 5. Download and setup gdc
> cd gcc
> # we now must be in directory ...../pspd/gcc-4.1.0/gcc
> 
> # Checkout dgcc from svn
> svn co https://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d
> 
> cd ..
> 
> # setup dgcc
> ./gcc/d/setup-gcc.sh --d-language-version=1
> 
> 5.5 Optional step, for those compiling GCC under Leopard/PowerPC. Apply 
> a patch to fix some GCC compiler errors
> 
> cd gcc/config/rs6000/
> wget 
> "http://trac.macports.org/attachment/ticket/13191/gcc_patch?format=raw" 
> -Oleopard_ppc.patch
> patch -p1 <leopard_ppc.patch
> cd ../../../
> 
> 
> 6. Configure, build, and install gcc (gdc & libgphobos included)
> # Make a separate build subdirectory
> # we must be ...../pspd/gcc-4.1.0
> mkdir build-psp
> cd build-psp
> 
> # Configure GCC
> ../configure --prefix="$PSPDEV" --target="psp" 
> --enable-languages="c,d,c++" --with-newlib --enable-cxx-flags="-G0" 
> --disable-libssp --enable-static --disable-shared
> 
> # Compile GCC
> CFLAGS_FOR_TARGET="-G0" make
> 
> # Install GCC
> make install
> 
> And that should be enough to get a funcional GCC with D/libgphobos
> 
> As far as my small libgphobos patch is concerned, I agree that it might 
> not be necessary. However given the temperamental behaviour of the 
> linker (especially when it comes to the order of the PSPSDK libraries) I 
> removed the extra definition of main, to make sure that if no main is 
> declared a linker error would be raised. At any rate it works fine 
> without the change.
> 
> Have fun !
> 
> Kostas
> 
> 
> FreekSh0w86 wrote:
>> Oh yeah that's true... I forgot because I made an example without 
>> libgphobos but that _would_ interfere. I don't have libgphobos.a 
>> compiled yet so I wouldn't know directly. David Friedman wrote:
>>> Assuming the C main() in libgphobos is not actually interfering with 
>>> the  PSP SDK (e.g., duplicate symbols), you do not have to rename it. 
>>> You can call the following function which exists for exactly this 
>>> purpose.
>>>
>>> extern (C) int _d_run_Dmain(int argc, char **argv);
>>>
>>> David
>>>
> 
> 
> 
> 


More information about the D.gnu mailing list