【问题标题】:Can I port RetroArch to Native Client [closed]我可以将 RetroArch 移植到 Native Client [关闭]
【发布时间】:2013-10-02 18:47:45
【问题描述】:

所以我一直在尝试另一个编码项目,并认为我可以尝试的最好的方法是将 RetroArch 全部移植到一个模拟器中到本机客户端,这样它很可能是一个带有云的打包应用程序完全保存在浏览器中。在 Github 上查找项目,因为我没有足够的链接。

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

http://pastebin.com/0WtrY6aU

在此处使用此自定义 Makefile。

http://pastebin.com/iv6RmQVr

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

【问题讨论】:

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


    【解决方案1】:

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

    这里是:

    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. 使用 CC 编译,使用 x86_64-nacl-g++ 而不是 x86_64-nacl-gcc
    2. ifdef 取出 driver.h 中的定义,并将该文件中的其他用途替换为 struct rarch_joypad_driver

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

    #ifndef __native_client__
    ...
    #endif
    

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

    【讨论】:

    • 谢谢。我认为对于我遇到的每个编译错误,PM 或继续一个线程不是常见的过程,所以我应该尝试自己解决这些问题,还是每次碰壁时寻求帮助?
    • 我很乐意提供帮助,但也许 SO 不是最好的地方。也许在 irc.freenode.net 或 native-client-discuss Google Group 上尝试#nacl?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多