Setup CnCpp compile environment (amd64) - ReadyNAS/sdk GitHub Wiki
Below is an example of how to setup a build environment using chroot under a 64-bit (amd64) Linux system.
Create chroot and setup schroot
Get minimum root image using debootstrap
command. If you don't have debootstrap
command, please install it first.
$ sudo apt update
$ sudo apt install debootstrap
$ sudo mkdir -p /chroot/jessie
$ sudo debootstrap --arch amd64 jessie /chroot/jessie http://ftp.us.debian.org/debian
$ sudo apt install schroot
$ sudo bash -c 'cat > /etc/schroot/schroot.conf' << EOF
[jessie]
aliases=R6,r6
description=jessie 64bits for R6 developement
type=directory
directory=/chroot/jessie
users=r2d2
root-users=r2d2
EOF
$
Setup NETGEARized repository
Add a NETGEARized repository in sources.list.d/readynas.list
within chroot. You need to adjust the version number (6.4.2 in below example) based on the currently implemented ReadyNAS OS version.
$ sudo bash -c "echo 'deb http://apt.readynas.com/packages/readynasos 6.4.2 updates main' > /chroot/jessie/etc/apt/sources.list.d/readynas.list"
Then, set preferences to pin the repository to the NETGEARized repository that you just created.
$ sudo bash -c 'cat > /chroot/jessie/etc/apt/preferences.d/readynasos' << EOF
Package: *
Pin: origin apt.readynas.com
Pin-Priority: 900
EOF
The repository is now setup.
Get build essential within chroot
Now you need to install sudo
package in chroot environment. Then get the build tool chain.
$ schroot -c R6 apt -- install sudo
$ schroot -c R6 sudo -- apt update
$ schroot -c R6 sudo -- apt install build-essential
If you get a warning about a missing public key, you can ignore it. If you don't want to see the warning, install our public key.
Get more packages for compiling your application
If you need more packages, you must install them. For example, you might need extra packages. (Below is needed for examples in app-sdk.)
$ schroot -c R6 sudo -- \
apt install libxml2-dev libsqlite3-dev pkg-config libsystemd-daemon-dev devscripts
Compile
After you set up and install all necessary libraries and header files, you can compile in chroot environment.
$ schroot -c R6 make -- all
Validate config.xml
You can install libxml2-utils
package into your development environment and use xmllint config.xml
to check validity. Below is a typical mistake where a curly opening/closing double-quote was used instead of an ascii double-quote. This mistake might happen if you copy and paste from our document.
$ xmllint config.xml
config.xml:1: parser error : AttValue: " or ' expected
<Application resource-id=”mymediaserver”>
^
config.xml:1: parser error : attributes construct error
<Application resource-id=”mymediaserver”>
^
config.xml:1: parser error : Couldn't find end of Start Tag Application line 1
<Application resource-id=”mymediaserver”>
^
config.xml:1: parser error : Extra content at the end of the document
<Application resource-id=”mymediaserver”>
^