Porting Linux C/C++ code to Chrome OS ..

1,127 views
Skip to first unread message

Kishore Koney

unread,
Apr 5, 2016, 7:21:00 PM4/5/16
to Native-Client-Discuss
Hi,

I am new to chromebook(or Chrome OS) development. I developed code(C/C++) on Ubuntu. I would like to port my existing Linux code(written in C/C++) to Chrome OS but not sure about how to proceed ..

Couple of questions:
1. Can I download Chromebook compiler tool-chain on Ubuntu and cross-compile code targeted for Chromebook(Chrome OS) ?
2. Do I need to purchase a Chromebook physical machine to develop code for Chrome OS (or) to deploy on a Chromebook machine?
3. Is developing code for chrome browser on Ubuntu anyway different from developing for Chromebook OS ?

Any help regarding developing C/C++ code targeted at Chrome OS ?

thanks for your help.
kishore koney

Ben Smith

unread,
Apr 8, 2016, 5:10:22 PM4/8/16
to Native-Client-Discuss
Hi Kishore Koney,

On Tuesday, April 5, 2016 at 4:21:00 PM UTC-7, Kishore Koney wrote:
Hi,

I am new to chromebook(or Chrome OS) development. I developed code(C/C++) on Ubuntu. I would like to port my existing Linux code(written in C/C++) to Chrome OS but not sure about how to proceed ..

Couple of questions:
1. Can I download Chromebook compiler tool-chain on Ubuntu and cross-compile code targeted for Chromebook(Chrome OS) ?

You can develop using the toolchain in the Native Client SDK. It can generate Native Client executables for x86 32-bit, x86 64-bit and ARM 32-bit, which will cover all existing Chrome OS devices. You can also build using the PNaCl toolchain to generate a Portable Native Client Executable which will be translated on device to the correct architecture.
 
2. Do I need to purchase a Chromebook physical machine to develop code for Chrome OS (or) to deploy on a Chromebook machine?

It would probably be best to have a Chromebook for testing, yes. But you can do most of your development without it, by running the NaCl or PNaCl executable directly or your Linux machine.
 
3. Is developing code for chrome browser on Ubuntu anyway different from developing for Chromebook OS ?

IIRC, there are some Chrome apps APIs that are only exposed to Chrome OS. And often the Chromebook will be using an ARM CPU, whereas your desktop is likely a x86_64 CPU. Chromebooks have much less memory than your desktop too. In general the development process should be mostly the same, though.

kishore koney

unread,
Apr 8, 2016, 8:40:13 PM4/8/16
to native-cli...@googlegroups.com
Thanks Ben.

Couple of questions:

1. If I would like to deploy a NaCL process(exe) on chromebook, Is it possible ( I mean independent of Chrome browser) ? To deploy a process in Chromebook, Do I need to copy my code to chrome os repository & build with it ( just like downloading Android AOSP and building our code as part of it ?)

2. Do I have to always use Pepper API to develop a NaCL/PNaCL code ? Can I use OS api directly( as Chrome OS is also a Linux variant) ?

3. Is Chrome OS C/C++ runtime same as Linux(Ubuntu) runtime ? I mean, Is glibc(c runtime) present on Chrome OS too ? Is there any difference between Chrome OS C/C++ runtime & Linux(Ubuntu) OS C/C++ runtime ?

4. Are there any articles (or) tools available to port a Linux(Ubuntu) C/C++ code to Chrome OS ?

thanks kishore

--
You received this message because you are subscribed to a topic in the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/native-client-discuss/Fh_k6ZfWJKE/unsubscribe.
To unsubscribe from this group and all its topics, 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.

Ben Smith

unread,
Apr 12, 2016, 6:26:03 PM4/12/16
to Native-Client-Discuss
On Friday, April 8, 2016 at 5:40:13 PM UTC-7, Kishore Koney wrote:
Thanks Ben.

Couple of questions:

1. If I would like to deploy a NaCL process(exe) on chromebook, Is it possible ( I mean independent of Chrome browser) ? To deploy a process in Chromebook, Do I need to copy my code to chrome os repository & build with it ( just like downloading Android AOSP and building our code as part of it ?)

No, a NaCl or PNaCl executable will be loaded by a webpage. You can just build a .nexe or .pexe, reference it from your .html, and it will be loaded and run. I'd suggest taking a look at the NaCl tutorial for more info about this.
 

2. Do I have to always use Pepper API to develop a NaCL/PNaCL code ? Can I use OS api directly( as Chrome OS is also a Linux variant) ?

Yes, NaCl is only allowed to use Pepper API to communicate with the browser. As a Chrome OS application developer you have access to the Chrome Apps API and the Pepper API. You do not have access to any underlying APIs.
 

3. Is Chrome OS C/C++ runtime same as Linux(Ubuntu) runtime ? I mean, Is glibc(c runtime) present on Chrome OS too ? Is there any difference between Chrome OS C/C++ runtime & Linux(Ubuntu) OS C/C++ runtime ?

You should think of NaCl as providing its own runtime, independent of the normal OS runtime. This is the same for Windows, Mac, Linux and Chrome OS.
 

4. Are there any articles (or) tools available to port a Linux(Ubuntu) C/C++ code to Chrome OS ?

Your best bet would be to look at some examples in webports. There are many ported libraries and applications there.
 

thanks kishore

On Fri, Apr 8, 2016 at 2:10 PM, Ben Smith <bi...@chromium.org> wrote:
Hi Kishore Koney,

On Tuesday, April 5, 2016 at 4:21:00 PM UTC-7, Kishore Koney wrote:
Hi,

I am new to chromebook(or Chrome OS) development. I developed code(C/C++) on Ubuntu. I would like to port my existing Linux code(written in C/C++) to Chrome OS but not sure about how to proceed ..

Couple of questions:
1. Can I download Chromebook compiler tool-chain on Ubuntu and cross-compile code targeted for Chromebook(Chrome OS) ?

You can develop using the toolchain in the Native Client SDK. It can generate Native Client executables for x86 32-bit, x86 64-bit and ARM 32-bit, which will cover all existing Chrome OS devices. You can also build using the PNaCl toolchain to generate a Portable Native Client Executable which will be translated on device to the correct architecture.
 
2. Do I need to purchase a Chromebook physical machine to develop code for Chrome OS (or) to deploy on a Chromebook machine?

It would probably be best to have a Chromebook for testing, yes. But you can do most of your development without it, by running the NaCl or PNaCl executable directly or your Linux machine.
 
3. Is developing code for chrome browser on Ubuntu anyway different from developing for Chromebook OS ?

IIRC, there are some Chrome apps APIs that are only exposed to Chrome OS. And often the Chromebook will be using an ARM CPU, whereas your desktop is likely a x86_64 CPU. Chromebooks have much less memory than your desktop too. In general the development process should be mostly the same, though.
 

Any help regarding developing C/C++ code targeted at Chrome OS ?

thanks for your help.
kishore koney

--
You received this message because you are subscribed to a topic in the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/native-client-discuss/Fh_k6ZfWJKE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to native-client-discuss+unsub...@googlegroups.com.

kishore koney

unread,
Apr 12, 2016, 7:33:48 PM4/12/16
to native-cli...@googlegroups.com
Thanks a lot Ben. I will go through the articles and code that you suggested ..

thanks, kishore


thanks kishore

To unsubscribe from this group and all its topics, 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.

--
You received this message because you are subscribed to a topic in the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/native-client-discuss/Fh_k6ZfWJKE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to native-client-di...@googlegroups.com.

Dennis Kane

unread,
Apr 14, 2016, 12:07:03 PM4/14/16
to Native-Client-Discuss
For anyone seriously interested in the basic idea behind this thread, please check out my "Linux on the Web" project. You can get there from http://lotw.co .

The project is approximately 5 years in the making (3+ years of fulltime coding on the thing itself).

Think of "Linux on the Web" as an operating system for the world itself. The world does not currently have an OS, and as such, tends to suffer occasional runtime failures in the form of war, famine, etc.

I landed at SFO last night, and am now in Mountain View. My ultimate goal is to give this thing directly to the man himself. Regardless, I will be making a scene in and around the environs of the Googleplex in order to start getting things off the ground.

Oh yeah, I'm homeless. I like sleeping behind the falafel place on El Camino, for any of you Googlers who might want to pay me a visit. (I've talked briefly with Sam and Ben on this forum in the past, and I've just seen the 2014 I/O video, so I know what they look like.) 

Oh yeah again, I'm "the peace guy".  Seriously, google that phrase. That's all me.

1luv,
Dennis


On Tuesday, April 5, 2016 at 4:21:00 PM UTC-7, Kishore Koney wrote:
Reply all
Reply to author
Forward
0 new messages