运行Native Client SDK示例时出错

时间:2013-01-07 08:00:24

标签: google-nativeclient

我已按照https://developers.google.com/native-client/devguide/tutorial#verify

中的说明操作

但是,似乎所有示例都运行不正常。我曾尝试将NACL_SDK_ROOT设置为/nacl_sdk//nacl_sdk/pepper_23/,但仍无法正常工作

例如,在“C ++中的交互式Hello World”中,当尝试单击“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为null”。如何解决此错误?

- 编辑 -

当我尝试另一个“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的铬输出:

[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崩溃了?任何人都能解释一下吗?感谢。

1 个答案:

答案 0 :(得分:3)

日志消息

  

nacl_debug(136):调试已开始。

表示您在about:flags中打开了“基于Native Client GDB的调试”。当发生这种情况时,gdb应该连接到端口4014.是否正在将gdb连接到调试存根?如果你真的不想要它,你可以查看你的about:flags并关闭基于gdb的调试吗?