Mono for Native Client now available through the SDK

2,037 views
Skip to first unread message

Elijah Taylor

unread,
May 4, 2012, 4:30:38 PM5/4/12
to native-cli...@googlegroups.com
Hi everyone,

Versions of Mono for Native Client are now available for download in the SDK.  These are compiled with glibc and the libmono comes as a dynamic library.  Only pepper_19 and above has Mono available.

Note that you must keep your pepper_X and naclmono_X bundles in sync (ie, don't update one without updating the other) or you will probably be unable to run the resulting built nexes.  New versions of Mono that match a given SDK should be available within hours of a new SDK build being available.

Only embedded Mono is supported in Native Client currently (http://www.mono-project.com/Embedding_Mono).

Instructions for trying it out:
1) Update your latest sdk_tools:
$ ./naclsdk update sdk_tools

You can check to make sure you have the right version if you run ./naclsdk list and see this:
Currently installed bundles:
  sdk_tools
    description: Native Client SDK Tools, revision 134553
    stability: stable
    recommended: yes
    version: 1
    revision: 134553

2) Add the NaCl Mono manifest to your SDK:

You can see new bundles available through naclsdk list:
  naclmono_19
    sdk_revision: 129248
    description: Mono for Native Client
    stability: dev
    recommended: no
    version: experimental
    revision: 2
  naclmono_20
    sdk_revision: 134804
    description: Mono for Native Client
    stability: dev
    recommended: no
    version: experimental
    revision: 2

3) Install the packages: (substitute 20 for 19 for the rest of these instructions if you want to use pepper_20)
$ ./naclsdk install pepper_19 naclmono_19 naclmono_samples

You should now have a naclmono_19 directory which contains headers, libraries, and binaries for NaCl Mono, and a naclmono_samples directory with example code and Makefiles.

4) Compile the samples:
--- Linux/Mac ---
$ cd naclmono_samples
$ NACL_MONO_ROOT=/path/to/naclmono_19 NACL_SDK_ROOT=/path/to/pepper_19 make

--- Windows ---
> cd naclmono_samples
> set NACL_MONO_ROOT=C:\path\to\naclmono_19
> set NACL_SDK_ROOT=C:\path\to\pepper_19
> make

There are a couple of warnings you can safely ignore that are normal for the sample build process:
DEBUG MODE ENABLED (bypass acl)
[6159,1026903520:12:57:46.229339] BYPASSING ALL ACL CHECKS

libgcc_s.so: warning: warning: pthread_cancel is not implemented and will always fail


5) Try the samples:
$ python -m SimpleHTTPServer <port>
Load your NaCl enabled browser to localhost:<port> and browse to the html pages in the subfolders for each sample.


Try it out, and have some fun!  Feedback is welcome.

-Elijah

Elijah Taylor

unread,
May 4, 2012, 5:35:59 PM5/4/12
to native-cli...@googlegroups.com, native-clie...@googlegroups.com
+native-client-announce

Thaina Yu

unread,
May 5, 2012, 1:00:15 AM5/5/12
to native-cli...@googlegroups.com
Thank you for your hard work

Joshua Franta

unread,
May 5, 2012, 1:24:55 AM5/5/12
to native-cli...@googlegroups.com

Yes this is awesome...

On May 5, 2012 1:05 AM, "Thaina Yu" <thai...@gmail.com> wrote:
Thank you for your hard work

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/native-client-discuss/-/nxWNSbNneuoJ.
To post to this group, send email to native-cli...@googlegroups.com.
To unsubscribe from this group, send email to native-client-di...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/native-client-discuss?hl=en.

Joe Dluzen

unread,
May 7, 2012, 8:38:43 PM5/7/12
to native-cli...@googlegroups.com
Thanks Elijah. I'm really looking forward to trying out Mono on NaCl.

Joshua Franta

unread,
May 9, 2012, 5:27:52 PM5/9/12
to native-cli...@googlegroups.com

Everything seems to work great, except that when I run either dllimport or hello world sample, the status will say 'NOT READY' and then the webserver will become unresponsive.

I can run other nacl apps without issue.

Any ideas?  I don't see any errors in the server log, nor in the apps themselves.

Elijah Taylor

unread,
May 9, 2012, 5:37:25 PM5/9/12
to native-cli...@googlegroups.com
Hi Joshua,

What version of Chrome are you using?  libmono is issuing dlopen calls as a normal course of business (even for things that don't exist for NaCl like AOT versions of assemblies like mscorlib.dll.so).  There is a known issue in Chrome 18 in which dlopen calls on the main thread will hang.  For simplicity and readability, I did the slightly lazy job of initializing and running Mono on the main thread for these samples, so it would fall into this trap.

I've tested the samples on Chrome 19 and 20 with success, let me know if that doesn't fix it for you.  Since there are only naclmono releases for pepper_19 and pepper_20 you really should be using at least the version of the browser that matches your SDK anyway.

-Elijah

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.

josh franta

unread,
May 9, 2012, 6:03:59 PM5/9/12
to native-cli...@googlegroups.com

Good call on diagnosis, and yes that makes sense re: versions.

Did not realize stable was 18, I upgraded to beta chrome 19 and everything works beautifully now!

thanks again...

Lars Brubaker

unread,
May 12, 2012, 12:35:35 PM5/12/12
to native-cli...@googlegroups.com
Hi Elijah,

I followed these same directions, upgraded to Chrome 19 and re-ran the samples.  I'm still getting status:  NOT READY.  Everything seems to be running fine other than that. I have tried to run it on port 2244 and 8000 (just trying to include any extra info).  Do you have any ideas what I might be doing wrong or what more information I can present to help debug the problem?

Thanks in advance.

Lars.
-Elijah


To post to this group, send email to native-client-discuss@googlegroups.com.
To unsubscribe from this group, send email to native-client-discuss+unsub...@googlegroups.com.

Lars Brubaker

unread,
May 12, 2012, 12:48:29 PM5/12/12
to native-cli...@googlegroups.com
Hi Elijah,

I also am getting the status NOT READY message.  But I have followed the directions here :).  I'm on Chrome 19 and all the other steps in the directions seems to have gone fine.  I ran the sever on port 8000 and can navigate the directories in the browser just can't run the app.  Any info that you can provide (or that I can give you) would be great.  

Thanks in advance, Lars.


On Wednesday, May 9, 2012 2:37:25 PM UTC-7, Elijah Taylor wrote:
-Elijah


To post to this group, send email to native-client-discuss@googlegroups.com.
To unsubscribe from this group, send email to native-client-discuss+unsub...@googlegroups.com.

Lars Brubaker

unread,
May 12, 2012, 1:03:47 PM5/12/12
to native-cli...@googlegroups.com
I got it working by setting  chrome:flags  Native Client  Enable.  Just having to learn the basics.  Thanks.

Lars.

On Wednesday, May 9, 2012 2:37:25 PM UTC-7, Elijah Taylor wrote:
-Elijah


To post to this group, send email to native-client-discuss@googlegroups.com.
To unsubscribe from this group, send email to native-client-discuss+unsub...@googlegroups.com.

Andrew Witte

unread,
May 14, 2012, 3:18:58 AM5/14/12
to native-cli...@googlegroups.com
You Rock Elijah (and those like you), I have been waiting for something like this for a year now as I didn't have the time our expertise to get it working from your github project.

I got your Hello World demo to work on OSX 10.7 Chrome 19 beta and plan to start testing some OpenGL stuff soon.
I would also like to point out I find it much easier to install the application via chrome in developer mode(rather then using "SimpleHTTPServer") , but you must add a manifest.json file to do so.

Also I built your hello world sample on Arch Linux x64 and would point out you need to install "lib32-gcc-libs" to build it on a x64 system.


On Friday, May 4, 2012 4:30:38 PM UTC-4, Elijah Taylor wrote:
On Friday, May 4, 2012 4:30:38 PM UTC-4, Elijah Taylor wrote:

Elijah Taylor

unread,
Jun 7, 2012, 3:21:19 PM6/7/12
to native-cli...@googlegroups.com
Hi Jake,

I'm going to need more information from you in order to diagnose this problem.

Are you on a normal windows command prompt and not cygwin?  I'm not sure these samples build in cygwin but have tested it myself with cmd.exe.

Can you show me the actual commands you ran leading up to this error? (setting of the appropriate environment variables and make invocation)

Just want to verify: you do have pepper and naclmono directories in D:\nacl_sdk, right?  And they're the same version number?

-Elijah

On Thu, Jun 7, 2012 at 6:24 AM, Jake <ja...@helfert.us> wrote:
Hello Elijah,

I'm having an issue on windows. When I run make in naclmono_samples I get this error:

cc1: error: unrecognized command line option "-lmono-2.0"
make[1]: *** [hello_world_x86_32.nexe] Error 1
make[1]: Leaving directory `D:/nacl_sdk/naclmono_samples/hello_world'
make: *** [hello_world_TARGET] Error 2

-Jake
--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/native-client-discuss/-/mv11aaRvIj0J.

To post to this group, send email to native-cli...@googlegroups.com.
To unsubscribe from this group, send email to native-client-di...@googlegroups.com.

Elijah Taylor

unread,
Jun 7, 2012, 6:15:54 PM6/7/12
to native-cli...@googlegroups.com, Evgeny Eltsin
Hi Jake,

I just did the same on my Windows 7 64-bit machine, and everything worked.

It appears you're running up against this bug: http://code.google.com/p/nativeclient/issues/detail?id=2560.  It is strange I was unable to reproduce it because I used the exact same drive/path and command lines as you did, and we suspect the bug has to do with command line contents/length.

A potential workaround is to fiddle with your command lines so they have different lengths and options, and hopefully it won't take many permutations before one of them works.  I'm sorry this workaround is so dumb sounding.

If you look at naclmono_samples/hello_world/Makefile (and dll_import/Makefile), a few options you can take out of there are -O0, -g, (these are in fact duplicated anyway) and the WARNINGS flags.  In common/mono_common.mk, you could get rid of -O0 and -g there too, and probably -m32 or -m64 because I think those are overkill and the compiler will pick the right architecture anyway.  A third option is to move your naclmono_samples directory to a different location that has a shorter path.

HTH and let us know if you're able to workaround it, especially if you might have pertinent information related to this bug.

-Elijah

On Thu, Jun 7, 2012 at 12:57 PM, Jake <ja...@helfert.us> wrote:
Elijah,

Here's some more detail. Thanks for taking a look at this!

-Jake

Configuration:

Windows 7 64bit using cmd.exe

06/07/2012  07:15 AM    <DIR>          .
06/07/2012  07:15 AM    <DIR>          ..
06/07/2012  07:15 AM    <DIR>          naclmono_20
06/07/2012  07:15 AM    <DIR>          naclmono_samples
03/21/2012  04:29 PM               601 naclsdk
03/21/2012  04:29 PM               575 naclsdk.bat
06/07/2012  07:09 AM    <DIR>          pepper_20
06/07/2012  07:15 AM    <DIR>          sdk_cache
06/07/2012  07:13 AM    <DIR>          sdk_tools

Output:

D:\>cd \nacl_sdk

D:\nacl_sdk>naclsdk list
Available bundles:
  sdk_tools
    description: Native Client SDK Tools, revision 134553
    stability: stable
    recommended: yes
    version: 1
    revision: 134553
  gdb_builds
    description: gdb (Gnu Debugger) build for debugging x86-64 binary from win64 host
    stability: beta
    recommended: no
    version: 0
    revision: 1
  pepper_16
    description: Chrome 16 bundle, revision 1398
    stability: post_stable
    recommended: no
    version: 16
    revision: 1398
  pepper_17
    description: Chrome 17 bundle, revision 112997
    stability: post_stable
    recommended: no
    version: 17
    revision: 112997
  pepper_18
    repath: pepper_18
    description: Chrome 18 bundle, revision 124251
    stability: post_stable
    recommended: no
    version: 18
    revision: 124253
  pepper_19
    repath: pepper_19
    description: Chrome 19 bundle, revision 129248
    stability: stable
    recommended: yes
    version: 19
    revision: 129248
  pepper_20
    repath: pepper_20
    description: Chrome 20 bundle, revision 139451
    stability: beta
    recommended: no
    version: 20
    revision: 139451
  pepper_canary
    repath: pepper_21
    description: Chrome 21 bundle, revision 140711
    stability: canary
    recommended: no
    version: 21
    revision: 140711

Currently installed bundles:
  sdk_tools
    description: Native Client SDK Tools, revision 1.16
    stability: stable
    recommended: yes
    version: 1
    revision: 16

D:\nacl_sdk>naclsdk update pepper_20
|================================================|
..................................................
Updating bundle pepper_20 to version 20, revision 139451
|------------------------------------------------|
..................................................

D:\nacl_sdk>naclsdk list
Available bundles:
  sdk_tools
    description: Native Client SDK Tools, revision 134553
    stability: stable
    recommended: yes
    version: 1
    revision: 134553
  gdb_builds
    description: gdb (Gnu Debugger) build for debugging x86-64 binary from win64 host
    stability: beta
    recommended: no
    version: 0
    revision: 1
  pepper_16
    description: Chrome 16 bundle, revision 1398
    stability: post_stable
    recommended: no
    version: 16
    revision: 1398
  pepper_17
    description: Chrome 17 bundle, revision 112997
    stability: post_stable
    recommended: no
    version: 17
    revision: 112997
  pepper_18
    repath: pepper_18
    description: Chrome 18 bundle, revision 124251
    stability: post_stable
    recommended: no
    version: 18
    revision: 124253
  pepper_19
    repath: pepper_19
    description: Chrome 19 bundle, revision 129248
    stability: stable
    recommended: yes
    version: 19
    revision: 129248
  pepper_20
    repath: pepper_20
    description: Chrome 20 bundle, revision 139451
    stability: beta
    recommended: no
    version: 20
    revision: 139451
  pepper_canary
    repath: pepper_21
    description: Chrome 21 bundle, revision 140711
    stability: canary
    recommended: no
    version: 21
    revision: 140711

Currently installed bundles:
  sdk_tools
    description: Native Client SDK Tools, revision 1.16
    stability: stable
    recommended: yes
    version: 1
    revision: 16
  pepper_20
    repath: pepper_20
    description: Chrome 20 bundle, revision 139451
    stability: beta
    recommended: no
    version: 20
    revision: 139451
D:\nacl_sdk>naclsdk update sdk_tools
|================================================|
..................................................
Updating bundle sdk_tools to version 1, revision 134553
|------------------------------------------------|
..................................................

Updating sdk_tools
        1 dir(s) moved.

D:\nacl_sdk>naclsdk install pepper_20 naclmono_20 naclmono_samples
pepper_20 is already up-to-date.
|================================================|
..................................................
Updating bundle naclmono_20 to version experimental, revision 5
|------------------------------------------------|
...................................................
|================================================|
..................................................
Updating bundle naclmono_samples to version experimental, revision 2
|------------------------------------------------|
..................................................

D:\nacl_sdk>set NACL_MONO_ROOT=d:\nacl_sdk\naclmono_20

D:\nacl_sdk>set NACL_SDK_ROOT=d:\nacl_sdk\pepper_20

D:\nacl_sdk>cd naclmono_samples

D:\nacl_sdk\naclmono_samples>make
d:/nacl_sdk/pepper_20/tools/make.exe -C hello_world
make.exe[1]: Entering directory `D:/nacl_sdk/naclmono_samples/hello_world'
d:/nacl_sdk/pepper_20/toolchain/win_x86_glibc/bin/i686-nacl-gcc -o hello_world_x86_32.nexe ../common/ppapi_entry.c ../common/mono_helpers.c
../common/url_loader.c ../common/post_message.c -m32 -O0 -g -O0 -g -Wno-long-long -Wall -I d:/nacl_sdk/naclmono_20/include/mono-2.0 -DPROJEC
T_NAME="\"hello_world\"" -lppapi -lmono-2.0 -L d:/nacl_sdk/naclmono_20/lib32 -L d:/nacl_sdk/naclmono_20/lib -DCS_CLASS_NAME="\"HelloWorld\""

cc1: error: unrecognized command line option "-lmono-2.0"
make.exe[1]: *** [hello_world_x86_32.nexe] Error 1
make.exe[1]: Leaving directory `D:/nacl_sdk/naclmono_samples/hello_world'
pepper_20\tools\make.exe: *** [hello_world_TARGET] Error 2




On Thursday, June 7, 2012 1:21:19 PM UTC-6, Elijah Taylor wrote:
Hi Jake,

I'm going to need more information from you in order to diagnose this problem.

Are you on a normal windows command prompt and not cygwin?  I'm not sure these samples build in cygwin but have tested it myself with cmd.exe.

Can you show me the actual commands you ran leading up to this error? (setting of the appropriate environment variables and make invocation)

Just want to verify: you do have pepper and naclmono directories in D:\nacl_sdk, right?  And they're the same version number?

-Elijah

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.

Elijah Taylor

unread,
Jun 7, 2012, 8:32:07 PM6/7/12
to native-cli...@googlegroups.com
Great, thanks for sticking it out and providing this info.


On Thu, Jun 7, 2012 at 4:59 PM, Jake <ja...@helfert.us> wrote:
Elijah,

I tried removing the flags you mentioned, and I copied the .c files from common in to hello_world to shorten their paths, but nothing worked.

So I started messing around and came up with this combination that worked: 

d:/nacl_sdk/pepper_20/toolchain/win_x86_glibc/bin/i686-nacl-gcc -lppapi -lmono-2.0 -o hello_world_x86_32.nexe ../common/ppapi_entry.c ../common/mono_helpers.c ../common/url_loader.c ../common/post_message.c -I d:/nacl_sdk/naclmono_20/include/mono-2.0 -DPROJECT_NAME="\"hello_world\"" -L d:/nacl_sdk/naclmono_20/lib32 -L d:/nacl_sdk/naclmono_20/lib -DCS_CLASS_NAME="\"HelloWorld\""

The difference is -lppapi -lmono-2.0 have been moved to the start of the command line.

-Jake

 

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.

Ben Smith

unread,
Dec 20, 2012, 11:54:13 PM12/20/12
to native-cli...@googlegroups.com
Hi Nelson,

I just followed the instructions using the pepper_24 bundle and the naclmono_24 bundle and it worked fine.

Can you describe what step you've taken already?

Things to try:
* Look at the JavaScript console in and see if there are any errors there.
* Make sure you are running Chrome with --enable-nacl, or turn on the "Native Client" flag in chrome://flags
* Check to see that your webserver is serving the correct files. When I ran it I got the following output:

binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/hello_world.html HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/hello_world.nmf HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/runnable-ld.so HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] code 404, message File not found
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /favicon.ico HTTP/1.1" 404 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/hello_world_x86_64.nexe HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libpthread.so.51fe1ff9 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libmono-2.0.so.1 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libgcc_s.so.1 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libc.so.51fe1ff9 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/librt.so.51fe1ff9 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libnacl_dyncode.so HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libdl.so.51fe1ff9 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libstdc++.so.6 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/lib64/libm.so.51fe1ff9 HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/mscorlib.dll HTTP/1.1" 200 -
binji-glaptop - - [20/Dec/2012 20:52:29] "GET /hello_world/hw.exe HTTP/1.1" 200 -


On Thursday, December 20, 2012 6:30:57 PM UTC-8, Nelson C. wrote:
Hi, 

I tried the sample with nacl_mono_23 and 20 but it displays the 'NOT READY' status. Does someone have an idea?

Thx, 

Nelson

Nelson C.

unread,
Dec 23, 2012, 8:35:28 PM12/23/12
to native-cli...@googlegroups.com
Hi Ben, 

I don't know what happened, it is now totally working without any change (pepper 23 + naclmono 23). 

Thanks a lot for taking the time to answer me, 

Nelson

Stuart Leslie

unread,
Apr 20, 2015, 3:18:01 AM4/20/15
to native-cli...@googlegroups.com
The latest naclmono release is 32, the earliest release of pepper that can still be downloaded through the sdk installer is 37. 
What happened? Did this idea just die?

Elijah Taylor

unread,
Apr 22, 2015, 2:15:36 PM4/22/15
to native-cli...@googlegroups.com
Hi Stuart,

The automatic builders for NaCl Mono have not been maintained for some time as you have noted, and it is not clear why 32 was the last release that worked.  They were also taken offline recently, and will not produce new builds anymore.  You could try building it locally yourself, but you may have to fix some breakages:

There are some public build instructions to build the x86-32 and x86-64 variants here: https://docs.google.com/document/d/1Jd_4M7mlmxF8daVbepAy_8RKYcRbhifXanRYyBKkVa4/pub

And here is the recipe the automated builder used to call into configure directly on the master and nacl_arm branches from github.com/elijahtaylor/mono , but this requires a lot more reverse engineering among the scripts to figure out what the environment should be (you will still need to follow instructions from the build instructions above for nacl_interp also): https://code.google.com/p/chromium/codesearch#chromium/src/native_client_sdk/src/build_tools/nacl-mono-runtime.sh&sq=package:chromium&type=cs&l=165

Note that this is also an older 3.X based version of Mono, and while many of the NaCl changes were upstreamed, NaCl Mono generally doesn't build from upstream and support has not been maintained there, either.

HTH,
-Elijah

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.

To post to this group, send email to native-cli...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages