我可以将RetroArch移植到Native Client

时间:2013-10-02 18:47:45

标签: c++ google-chrome open-source google-nativeclient

所以我一直在关注另一个编码项目,并认为我可以尝试的最好的事情是将RetroArch全部放在一个模拟器中到Native Client中,这样它就可以很好地成为一个带云的打包应用程序完全保存在浏览器中。在Github上查找项目,因为我没有足够的链接。

RetroArch构建在linux上的方式是运行配置脚本,然后make,然后sudo make install。改变配置代理以选择Native Client编译器,当发生这种情况时,我能够在几秒钟内完成构建,

http://pastebin.com/0WtrY6aU

在这里使用这个自定义Makefile。

http://pastebin.com/iv6RmQVr

我认为这将是一条漫长而艰难的道路建设和调试这只小狗,但你建议我从哪里开始?

1 个答案:

答案 0 :(得分:2)

你是从一个好地方开始的,你刚刚遇到第一个编译错误。

这是:

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

以下是input_common.h的摘录:

typedef struct rarch_joypad_driver
{
   ...
} rarch_joypad_driver_t;

以下是来自driver.h的摘录:

typedef struct rarch_joypad_driver rarch_joypad_driver_t;

正如错误所说,typedef正在重新定义。我使用Ubuntu 12.04中的gcc 4.6.3进行了测试:

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

这个编译和链接很好。使用x86_64-nacl-gcc(使用gcc 4.4.3)编译的相同代码会出现以下错误:

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

似乎在更新版本的gcc中放宽了这个错误。我做了一些搜索,发现了这个stackoverflow链接:Why "Redefinition of typedef" error with GCC 4.3 but not GCC 4.6?

值得注意的是,x86_64-nacl-g ++将不加修改地编译此代码。以下是两件事:

  1. 使用x86_64-nacl-g ++而不是x86_64-nacl-gcc与CC进行编译
  2. ifdef out driver.h中的定义,并用struct rarch_joypad_driver替换该文件中的其他用途。

  3. 对于#2,您可以使用以下内容:

    #ifndef __native_client__
    ...
    #endif
    

    祝你好运,可能会有更多的编译失败需要修复。 :)