How to use Ubuntu to build C/C++ programs that run on LinkIt Smart 7688 Duo - Method 1

This post is based on https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/tutorials/c-c++-programming/using-openwrt-sdk-to-build-c-c++-programs with additional info. added from following it.

Note, The method described below uses makefile to build an *.ipk file that could be installed by using the "opkg install filename" command.


Working Computer: Windows 8.1.
Cross Compiling Platform: Ubuntu Linux 16.04.2 on ThinkPad-Edge-E420s.


LinkIt Smart 7688 Duo, OpenWRT Chaos Calmer 15.05.1 r49203

Step-1, Download the SDK

Visit https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/downloads to download the SDK.

The direct download link for the SDK is https://labs.mediatek.com/en/download/AGSSkG38.

Step-2, Copy the SDK to the Ubuntu machine

Use WinSCP to copy the the downloaded SDK (filename: OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc- to the home directory on the Ubuntu machine.

Step-3, Unzip the SDK on the Ubuntu machine

Issue the command below to unzip the SDK.

sudo tar -xvjf OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-

The content of the directory will be like the one below.

Remove "OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-" and rename the folder from "OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-" to "SDK" for easy maneuver.

rm OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc-
mv OpenWrt-SDK-ramips-mt7688_gcc-4.8-linaro_uClibc- SDK

Step-4, Download and unzip the example package file.

The direct download link of the example file: https://labs.mediatek.com/en/download/kJWJnDta

Unzip the file on the PC, then use WinSCP to copy everything under the package directory (including the package directory) to the Ubuntu machine and place the copied directory and files under the SDK folder

Below is the directory structure.

Step-5, Build the package.

From under the SDK directory, use "make package/helloworld/compile" to build the package. Once it's built:

Navigate to SDK/bin/ramips/packages/base to find a package file named "helloworld_1.0.0-1_ramips_24kec.ipk".

Copy the .ipk file to the LinkIt Smart 7688 development board.

In the system console of the board, navigate to the location of the .ipk file and type "opkg install helloworld_1.0.0-1_ramips_24kec.ipk".

After the installation is complete, type helloworld and you'll see a string Hello world, why won't my code compile?

To remove the installed packaged. Use "opkg remove helloworld".


What to do when compilation failed?

Instead of "make package/helloworld/compile", use "make -j1 V=s package/helloworld/compile" for a more verbose output.

"exec: ccache: not found" is in the output message.

Use "sudo apt-get install -y ccache" to install the missing ccache.

After the installation is done, run "make package/helloworld/compile" again and we have a successful result.


In English.



In Chinese.


No comments:

Post a Comment