Here are some advises for people like me learning how to cross-compile a project for the gcw0. My aim was to compile a command line friendly PC Engine emulator. I choosed mednafen for it's very good pce_fast core.
This post lists the steps I did to successfully compile it.
1/ Install the toolchain as explained on the gcw0 website
2/ Get mednafen latest code source
3/ export correct PATh to the toolchain and compiler:
4/ configure (note: for the moment we don't care about libsndfile)
./configure --host mipsel-gcw0-linux-uclibc --prefix=/tmp --with-sysroot=/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot --without-libsndfile
5/ make and install in /tmp as I don't want to mess with my host fs nor the toolchain sysroot
make install DESTDIR=/tmp/
6/ You should have some errors in the compilation, like glu.h not found. We require opengl to build mednafen, but that doesn't imply we will run opengl
apt-get install libglu1-mesa-dev
[email protected]:/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include# cp -r /usr/include/GL .
7/ Some more errors:
mednafen.cpp: In function ‘void LoadCustomPalette()’:
mednafen.cpp:673:15: error: ‘to_string’ is not a member of ‘std’
vfszs += std::to_string(3 * *vec);
in mednafen.cpp add and replace the call to std::to_string by "to_string" we will create:
template <typename T>
std::string to_string(T value)
//create an output string stream
std::ostringstream os ;
//throw the value into the string stream
os << value ;
//convert the string stream into a string and return
return os.str() ;
You should now have a working binary in /tmp
Use the following cfg file in /media/data/local/home/.mednafen/mednafen-09x.cfghttp://pastebin.com/pJaz2Nqn
Launch through telnet or ssh with the term opened:
./mednafen -force_module pce_fast -video.driver sdl -video.fs 1 -video.frameskip 0 -pce_fast.xres 0 -pce_fast.yres 0 /media/data/roms/pcengine/super\ star\ soldier\ \(japan\).pce
The good news: the pce_fast core is running
The bad news: in super star soldier you can see an awfull screen tearing effect (sort of horizontal line wrapping repeating every 1/5th of the screen). I tried to enable triple buffering, IPU scaling, even compiled against SDL2 lib (lot of patches!!!) but nothing fixes the problem. I suspect the problem might be in the core code and maybe only affects mips cpu?
Edit: fixed, see below.