0

我已按照https://developers.google.com/native-client/devguide/tutorial#verify中的说明进行操作

但是,似乎所有示例都没有运行良好。试过设置NACL_SDK_ROOT/nacl_sdk/仍然/nacl_sdk/pepper_23/没有工作

例如,在“Interactive Hello World in C++”中,当尝试单击“Call reverseText()”按钮时,什么也看不到。使用开发工具,我看到控制台输出是:

 Uncaught TypeError: Cannot call method 'postMessage' of null           example.js:25

这是 example.js 的一部分:

22: function reverseText() {
23:   // Grab the text from the text box, pass it into reverseText()
24:   var inputBox = document.getElementById('inputBox');
25:   common.naclModule.postMessage('reverseText:' + inputBox.value);
26: }

看起来原因是“common.naclMode 为空”。如何修复此错误?

- 编辑 -

当我尝试另一个“hello world”示例时,http 服务器的输出是:

localhost - - [07/Jan/2013 15:52:42] "GET / HTTP/1.1" 200 -
localhost - - [07/Jan/2013 15:52:45] "GET /hello_world/index.html HTTP/1.1" 200 -
localhost - - [07/Jan/2013 15:52:45] "GET /hello_world/index_newlib_Debug.html HTTP/1.1" 200 -
localhost - - [07/Jan/2013 15:52:45] "GET /hello_world/common.js HTTP/1.1" 200 -
localhost - - [07/Jan/2013 15:52:45] "GET /hello_world/newlib/Debug/hello_world.nmf HTTP/1.1" 200 -
localhost - - [07/Jan/2013 15:52:45] "GET /hello_world/newlib/Debug/hello_world_x86_64.nexe HTTP/1.1" 200 -

我在页面上看到以下内容:

Hello World.
Status: Creating embed: newlib

控制台输出:

NativeClient: NaCl module load failed: Nexe crashed during startup

这是objdump的输出:

nacl_sdk/pepper_23/examples/hello_world$ ../.././toolchain/linux_x86_newlib/bin/x86_64-nacl-objdump -p newlib/Debug/hello_world_x86_64.nexe

newlib/Debug/hello_world_x86_64.nexe:     file format elf64-nacl

Program Header:
    PHDR off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**3
         filesz 0x0000000000000120 memsz 0x0000000000000120 flags r--
    LOAD off    0x0000000000010000 vaddr 0x0000000000020000 paddr 0x0000000000020000 align 2**16
         filesz 0x0000000000021ac0 memsz 0x0000000000021ac0 flags r-x
    LOAD off    0x0000000000040000 vaddr 0x0000000010020000 paddr 0x0000000010020000 align 2**16
         filesz 0x0000000000010474 memsz 0x0000000000010474 flags r--
    LOAD off    0x0000000000060000 vaddr 0x0000000010040000 paddr 0x0000000010040000 align 2**16
         filesz 0x00000000000006e8 memsz 0x0000000000001da8 flags rw-

VERBOSITY=5 的 chrome 输出:

[deqing@hdell]~/works/nacl_sdk/pepper_23$ export NACLVERBOSITY=5
[deqing@hdell]~/works/nacl_sdk/pepper_23$ google-chrome http://localhost:5103 
[7,3729430976:11:56:19.763373] NaClRefCountCtor(0x7fb3e5184ac0).
[7,3729430976:11:56:19.763465] NexeFileDidOpen: invoking LoadNaClModule
...
[12,1392863616:03:56:19.825517] nacl_debug(136) : Debugging started.
[12,1392863616:03:56:19.825545] setting stack to : 00007fcefffeffa0
[12,1392863616:03:56:19.825557] copying arg 0  0x7fd95a7b1a40 -> 0x7fcefffeffd0
[12,1392863616:03:56:19.825568] copying env 0  0x7ffff4941bd6 -> 0x7fcefffeffd9
[12,1392863616:03:56:19.825575] copying env 1  0x7ffff4941c95 -> 0x7fcefffeffea
[12,1392863616:03:56:19.825583] system stack ptr : 00007fcefffeff98
[12,1392863616:03:56:19.825589]   user stack ptr : 00007fcefffeff98
[12,1392863616:03:56:19.825595]          natp = 0x000000000181fa80
[12,1392863616:03:56:19.825603]           nap = 0x00007ffff493b9a0
[12,1392863616:03:56:19.825609] usr_stack_ptr = 0x00007fcefffeff98
[12,1392863616:03:56:19.825639] NaClWaitForMainThreadToExit: taking NaClApp lock
[12,1392863616:03:56:19.825648]  waiting for exit status
[12,1376372480:03:56:19.825665] NaClThreadLauncher: entered
[12,1376372480:03:56:19.825684]       natp = 0x000000000181fa80
[12,1376372480:03:56:19.825691]  prog_ctr  = 0x00007fce0fc00200
[12,1376372480:03:56:19.825698] stack_ptr  = 0x00007fcefffeff98
[12,1376372480:03:56:19.825708] ix 0: 0x00000000
[12,1376372480:03:56:19.825716] found first not-all-ones ix 0
[12,1376372480:03:56:19.825723] Set(0,0x181fa80) @ix 0: 0x00000000
[12,1376372480:03:56:19.825729] After @ix 0: 0x00000001, avail_ix 0

为什么nexe崩溃了?任何人都可以解释一下吗?谢谢。

4

1 回答 1

3

日志消息

nacl_debug(136) :调试开始。

表示您在 about:flags 中打开了“基于本机客户端 GDB 的调试”。发生这种情况时,gdb 应该连接到端口 4014。正在将 gdb 连接到调试存根吗?如果你真的不想要它,你能检查你的 about:flags 并关闭基于 gdb 的调试吗?

于 2013-01-08T18:57:36.250 回答