Will C++ server application work in P/NaCl?

347 views
Skip to first unread message

Osman Zakir

unread,
Sep 19, 2018, 7:01:25 PM9/19/18
to Native-Client-Discuss
I have a currency converter web app with a Google Maps GUI.  The backend application itself a web server that I wrote in C++.  I wanted to know if I could do this using NaCl or PNaCl, with the same backend server application if possible.  

I also want to ask if I'll be able to download and/or build (as needed) the latest versions of Jinja2Cpp, Boost and Nlohmann JSON inside the container provided by P/NaCl.  My C++ application requires Boost.Beast and those other two libraries I mentioned.  I'm using Boost version 1.68.0.  

The C++ application on the backend also has two environment variables that the frontend side requires: the Google Maps API Key and the Currencylayer (https://currencylayer.com/ ) API Access Key.  

Russell Valentine

unread,
Sep 20, 2018, 11:01:23 AM9/20/18
to native-cli...@googlegroups.com
I have run web servers in NaCl and then have the webview connect to it. If you are asking if you can open a tcp/ip port and connect to it, then the answer is yes. Your code or libraries will probably require a few tweaks and changes to run in NaCl.
--
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.
Visit this group at https://groups.google.com/group/native-client-discuss.
For more options, visit https://groups.google.com/d/optout.


Message has been deleted

Osman Zakir

unread,
Sep 21, 2018, 7:00:48 AM9/21/18
to Native-Client-Discuss
I'll show my code on Gist links here.  Please read it and tell me how I should tweak it to make it work on NaCl.  

I'm using Boost version 1.68.0, by the way.  I need the Beast library (HTTP, HTTPS and WebSockets library based on Boost.Asio) and its dependencies in Boost.  I'm also using Jinja2Cpp and Nlohmann JSON.  The former is the C++ version of Python's Jinja2 HTML template library, and it needs to be built using CMake.  I hope I can do it in NaCl as well.  

And I also want to ask how I can get a URL for the web app.

Anyway;

Osman Zakir

unread,
Sep 21, 2018, 7:05:53 AM9/21/18
to Native-Client-Discuss
I also have another question.  I read that NaCl for all platforms aside from Chrome OS has been deprecated.  I'm using Windows 10.  Does this mean I can't use NaCl?

Russell Valentine

unread,
Sep 21, 2018, 12:54:52 PM9/21/18
to native-cli...@googlegroups.com

Depreciated doesn't mean removed. I still test on Linux, Windows, and Macs.


On 09/21/2018 06:05 AM, Osman Zakir wrote:
I also have another question.  I read that NaCl for all platforms aside from Chrome OS has been deprecated.  I'm using Windows 10.  Does this mean I can't use NaCl?

Russell Valentine

unread,
Sep 21, 2018, 1:01:02 PM9/21/18
to native-cli...@googlegroups.com

Maybe someone else will, but I'm not going to tell you how to tweak it. What I would say, is start by understanding the examples and demos and then work on getting your stuff to work.

As for the URL. What I do is I have my NaCl process run a server on localhost and a random port. It then communicates the port back through stdout. I then use http://127.0.0.1:PORT/ as the url to be opened on the webview.

Osman Zakir

unread,
Sep 25, 2018, 11:53:23 AM9/25/18
to Native-Client-Discuss
P/NaCl apps work in a similar manner to extensions for the Chrome browser, right?  


Osman Zakir

unread,
Sep 25, 2018, 12:14:30 PM9/25/18
to Native-Client-Discuss
When I try to run the command `naclsdk list` in the nacl_sdk directory, I get an error saying that "python" is not a command that the Command Prompt recognizes (basically).  I have Python2.7 added to the system PATH, so I don't know what's going on.  I have python.exe where it should be in the directory.  The strange thing is that when I try to execute "echo %PATH%", I can't see "C:\Python27" mentioned in the value of the PATH variable.  I checked it after running "setx PATH C:\Python27" and had the same result.  

kyle.cl...@gmail.com

unread,
Sep 25, 2018, 12:21:33 PM9/25/18
to Native-Client-Discuss
While I don't have experience with C++ server applications so can't answer your question specifically, you may want to look into WebAssembly for this. P/NaCl is marked for deprecation and will no longer be usable once that happens.

Google has yet to announce an official date but looks to be as soon as WebAssembly supports threads. 

https://developer.chrome.com/native-client/nacl-and-pnacl

kyle.cl...@gmail.com

unread,
Sep 25, 2018, 12:24:49 PM9/25/18
to Native-Client-Discuss
But responses from Google in this form have indicated that in this case deprecated does mean "removed". They have stated they will "turn off" NaCl support in extensions. The when is the real question, but another post indicates "Soon after WebAssembly supports threads". Sure you can get something up and running in the short term but it's pretty clear it won't work in the near term. Also I would rather build on a recent technology as apposed to working with something that is even considering being "deprecated". That's just me though.


Reply all
Reply to author
Forward
0 new messages