You are here

Cross-compiling GNU libmicrohttpd for OpenWRT

As a small introductory task to get GNUnet to run on small devices I started to cross- compile libmicrohttpd on my desktop computer for a router running OpenWRT.

This is not intended as a from scratch documentation, I used my notebook which already had all the development tools required for GNUnet installed, so when you start from scratch there are perhaps some more requirements.

The OpenWRT documentation is quite good but here a summary what I finally did to get libmicrohttpd to compile.

The first steps is to install the OpenWRT cross-compiling toolchain on your system. Here you can stick to the OpenWRT documentation, that worked fine for me.

OpenWrt Buildroot – Installation

OpenWrt Buildroot – Usage

Now you have the tool chain installed.

You can find information about the cross-compiling process here:

Here some basic information about my installation:

Target plattform: Atheros AR71xx/AR7240/AR913x/AR934x
Target plattform toolchain: toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32
OpenWRT buildroot path: /opt/dev/openwrt/trunk

So you shoud set the following environmental variables (in a script):

export STAGING_DIR=/opt/dev/openwrt/trunk/staging_dir
export TOOLCHAIN_DIR=$STAGING_DIR/toolchain-mips_r2_gcc-4.5-linaro_uClibc-0.9.32


Checkout libmicrohttpd

svn co ./mhd-openwrt

Configure and make:

cd mhd-openwrt
./configure --prefix=$TOOLCHAIN_DIR --host=mips-openwrt-linux-uclibc --disable https

For GNU make, override the CC and LD environment variables and compile with:

make CC=mips-openwrt-linux-uclibc-gcc LD=mips-openwrt-linux-uclibc-ld