andy
andy

Reputation: 18445

Samples don't work in Google NaCl rev 18

I'm trying to use the latest Google NaCl SDK. Following the instructions at https://developers.google.com/native-client/pepper18/devguide/tutorial

I downloaded the naclsdk tool from their site, ran update, and got a pepper_18 folder.

I set NACL_SDK_ROOT to the pepper_18 folder, went in to 'examples' and ran make. Everything seemed to compile just fine.

I started Chrome, looked in about: flags and about: plugins, and verified that NaCl is enabled. I installed the SDK Examples app (from: https://developers.google.com/native-client/pepper18/sdk/examples) and that works just fine.

Then I tried to run my locally built and hosted examples, going to http://localhost: 5301. The HTML loads fine but the NaCl content does not load. In the hello world examples, it says "Status: LOADING..." forever.

I double checked the HTTP server logs and I don't see any errors there. Is there another place I should be looking for logged errors?

Upvotes: 2

Views: 1557

Answers (3)

Bill Hoag
Bill Hoag

Reputation: 697

I muddled through a few issues which I will document in case they help others:

  • Neglected to 'make' the examples (got a clue to make them from the asker's description).
  • Chrome would not let me run non-store chrome apps. Went to chrome://flags and enabled Native Client and Native Client GDB-based debugging.
  • The JavaScript console said the demo's nmf file under .../debug/ was missing. I changed the make config to build Debug instead of Release based on this.
  • Chrome console complained NativeClient: NaCl module load failed: ServiceRuntime: failed to start; NaCl's GDB debug stub requires --no-sandbox flag on Windows. See crbug…. Tried running Chrome from cmd with --no-sandbox. This results in an alert You are using an unsupported command-line flag: --nosandbox. Stability and security will suffer. The aforementioned error went away, but the examples still would not run - no UI.
  • Went back to chrome://flags and disabled Native Client GDB-based debugging.

Then most of the examples worked. The Google Drive demo complains Error: must be run as a packged app.

Upvotes: 1

Colt McAnlis
Colt McAnlis

Reputation: 204

have you confirmed that you've run httpd.py from the examples folder? This script creates the localhost:5103 server that the apps can be ran from.

Also, what OS are you using?

~Main

Upvotes: 0

West 39th
West 39th

Reputation: 634

Check for version mismatch

In Chrome navigate to about:version and check that the major version of Chrome is at least that of the Pepper version you used to build your examples.

Check the JavaScript console in Chrome for any errors

You can find it by clicking the wrench icon in the upper right-hand corner in Chrome and selecting Tools -> JavaScript Console.

Inspect the NaCl module for further information

In the JavaScript console, you can also inspect the embed element of the NaCl module. E.g., if the embed tag has id="nacl_module" you can inspect it by typing

theModule = document.getElementById('nacl_module');

theModule.lastError;

Check Chrome's output to stdout/stderr

On Mac or Linux start Chrome from the terminal and look at the output on the console. E.g., on the Mac, you'd typically go

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-nacl

On Windows, Chrome does not write to the terminal if started from a command prompt. For this reason you need to redirect stdout/stderr from Chrome by setting the environment variables NACLLOG, NACL_EXE_STDOUT, and NACL_EXE_STDERR. Point them to different files, e.g.,

NACLLOG = c:\my_project\nacl.log

NACL_EXE_STDOUT = c:\my_project\nacl_stdout.log

NACL_EXE_STDERR = c:\my_project\nacl_stderr.log

Then (re-)start Chrome (making sure these environment variables are in effect).

Connect a debugger

Instructions on using the debugging support (currently only 64-bit Windows and 64-bit Linux) are available at https://developers.google.com/native-client/pepper18/beta-docs/debugging.

Restarting Chrome means closing all windows

When developing for Native Client one often restarts Chrome. It is important to close all Chrome windows; otherwise it hasn't actually restarted.

Upvotes: 2

Related Questions