Quantcast
Channel: Xiao Ling – Dynamsoft Developers
Viewing all articles
Browse latest Browse all 239

Running Linux Console App on Chrome OS in Virtual Machine

$
0
0

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:

uname -a

Chrome OS info

The operating system is 64-bit. By default, there is no GCC compiler installed:

No GCC installed

Luckily, SSH is available:

SSH on Chrome OS

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.

Linux Barcode Reader

Use SCP to send ~/BarcodeReader4.0/Redist/libDynamsoftBarcodeReaderx64.so and ~/BarcodeReader4.0/Samples/C/BarcodeReaderDemo to Chrome OS:

scp ~/BarcodeReader4.0/Redist/libDynamsoftBarcodeReaderx64.so chronos@192.168.23.130:~/
scp ~/BarcodeReader4.0/Samples/C/BarcodeReaderDemo chronos@192.168.23.130:~/

Get connection timed out?

SSH connection timed out

Use iptables to check IP filter rules:

sudo iptables -S INPUT

iptables

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:

sudo /usr/sbin/sshd

SSH daemon

Try SCP again. It should work now.

SSH success
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

operation not permitted

Do not forget to move libDynamsoftBarcodeReaderx64.so to /usr/local/lib64:

Barcode Reader on Chrome OS

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.

Install CLI:

sh crouton -t cli-extra

Enter chroot environment and install GCC:

sudo startcli
sudo apt-get install gcc

crouton chroot

Now build C/C++ source code using GCC:

Chrome OS GCC Build

The post Running Linux Console App on Chrome OS in Virtual Machine appeared first on Code Pool.


Viewing all articles
Browse latest Browse all 239

Trending Articles