Question

So I've been cutting my teeth on another coding project, and figured that the best thing that I could try is to port RetroArch all in one Emulator into Native Client, so that it could very well be a packaged app with cloud saves entirely within a browser. Look up the project on Github since I don't have enough links.

The way RetroArch is built on linux is to run a configure script, then make, then sudo make install. Altering the configure agent to select the Native Client compilers, I was able to get a couple seconds into the build when this happened,

http://pastebin.com/0WtrY6aU

using this custom Makefile here.

http://pastebin.com/iv6RmQVr

I figure it's gonna be a long hard road building and debugging this puppy, but where do you recommend I get started?

Was it helpful?

Solution

You're starting from a good place, you've just hit your first compile error.

Here it is:

In file included from settings.c:23:
input/input_common.h:73: error: redefinition of typedef ‘rarch_joypad_driver_t’
driver.h:327: note: previous declaration of ‘rarch_joypad_driver_t’ was here

Here is an excerpt from input_common.h:

typedef struct rarch_joypad_driver
{
   ...
} rarch_joypad_driver_t;

Here is an excerpt from driver.h:

typedef struct rarch_joypad_driver rarch_joypad_driver_t;

Just as the error says, the typedef is being redefined. I ran a test using gcc 4.6.3 from Ubuntu 12.04:

typedef struct foo { int bar; } foo_t;
typedef struct foo foo_t;
int main() { return 0; }

This compiles and links fine. The same code compiled with x86_64-nacl-gcc (which is using gcc 4.4.3), gives the following error:

typedef.c:2: error: redefinition of typedef ‘foo_t’
typedef.c:1: note: previous declaration of ‘foo_t’ was here

It seems that this error has been relaxed in more recent versions of gcc. I did some searching and found this stackoverflow link: Why "Redefinition of typedef" error with GCC 4.3 but not GCC 4.6?.

It's worth noting that x86_64-nacl-g++ will compile this code unmodified. Here are two things to try:

  1. Compile with CC using x86_64-nacl-g++ instead of x86_64-nacl-gcc
  2. ifdef out the definition in driver.h, and replace the other use in that file with struct rarch_joypad_driver.

For #2, you can use the following:

#ifndef __native_client__
...
#endif

Good luck, there likely will be more compile failures to fix. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top