Chrome OS, developed by Google, is a light-weighted operating system based on the Linux kernel. It uses Chrome web browser as the user interface that primarily supports web applications released as Chrome extensions. However, Chrome extension is not fresh to me. When running Chrome OS in a virtual machine, I wondered whether it is possible to run native apps. In this article, I want to share how to run a console application built with Dynamsoft C/C++ Barcode SDK on Chrome OS.
Virtual Machine Download
To experience Chrome OS in a virtual machine, we can use the CloudReady operating system that built on Google’s open-source Chromium. Here are the links:
Running Native Apps on Chrome OS
Check the information of the operating system:
The operating system is 64-bit. By default, there is no GCC compiler installed:
Luckily, SSH is available:
Build Console App on Ubuntu and Copy It to Chrome OS
Download Dynamsoft C/C++ Barcode SDK for Linux and build the sample ~/BarcodeReader4.0/Samples/C.
Use SCP to send ~/BarcodeReader4.0/Redist/libDynamsoftBarcodeReaderx64.so and ~/BarcodeReader4.0/Samples/C/BarcodeReaderDemo to Chrome OS:
scp ~/BarcodeReader4.0/Redist/libDynamsoftBarcodeReaderx64.so firstname.lastname@example.org:~/ scp ~/BarcodeReader4.0/Samples/C/BarcodeReaderDemo email@example.com:~/
Get connection timed out?
Use iptables to check IP filter rules:
sudo iptables -S INPUT
By default, the port 22 is disabled. We need to enable it:
sudo iptables -A INPUT -p tcp –dport 22 -j ACCEPT
You have to do one more thing – launch SSH daemon:
Try SCP again. It should work now.
The next step is to run BarcodeReaderDemo. If you run it directly, you will get the permission error. To make it work, copy it to /usr/bin:
sudo cp ./BarcodeReaderDemo /usr/bin
Do not forget to move libDynamsoftBarcodeReaderx64.so to /usr/local/lib64:
In this way, we can successfully run Linux console applications on Chrome OS, but the better way is to use GCC building applications.
Install GCC with Crouton
Get Crouton from https://github.com/dnschneid/crouton.
sh crouton -t cli-extra
Enter chroot environment and install GCC:
sudo startcli sudo apt-get install gcc
Now build C/C++ source code using GCC: