Skip to content

Instantly share code, notes, and snippets.

@s-light
Last active February 13, 2016 11:27
Show Gist options
  • Save s-light/8e80c6eec2c018f04a52 to your computer and use it in GitHub Desktop.
Save s-light/8e80c6eec2c018f04a52 to your computer and use it in GitHub Desktop.
cross compile olad for Arietta G25 board

13.02.2016 12:26 s-light

this process does not succed currently.
for a working way look at: https://github.com/s-light/acme_ola_crosscompile


02.02.2016 18:26 s-light

first test:
following https://gist.github.com/simark/1167861bfabe21dd7658

steps:

~/debian_jessie$ sudo cp /usr/bin/qemu-arm-static target-rootfs/usr/bin
~/debian_jessie$ sudo mount -o bind /dev/ target-rootfs/dev/
~/debian_jessie$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get install packagename

you can do all at once or one after each other:

~/debian_jessie$ sudo LC_ALL=C LANGUAGE=C LANG=C chroot target-rootfs apt-get install \
libcppunit-dev libcppunit-1.13-0 uuid-dev pkg-config libncurses5-dev \
libtool autoconf automake g++ libmicrohttpd-dev libmicrohttpd10 \
protobuf-compiler libprotobuf-lite9 python-protobuf libprotobuf-dev libprotoc-dev \
zlib1g-dev bison flex make libftdi-dev \
libftdi1 libusb-1.0-0-dev liblo-dev libavahi-client-dev

now remove the emulator:

~/debian_jessie$ sudo rm target-rootfs/usr/bin/qemu-arm-static    
source env-target.sh
# or
source env-host.sh
  • now compile olad on the host:
    only changed the path to protoc.
    We now need to build the host part of OLA. We don't need to build the whole thing, just the OLA protoc plugin. It is a small executable which protoc loads in order to generate some OLA specific bits. In the host terminal:
workdir/src $ wget https://github.com/OpenLightingProject/ola/releases/download/0.10.0/ola-0.10.0.tar.gz
workdir/src $ tar -xf ola-0.10.0.tar.gz
workdir/src $ cd ../build
workdir/build $ mkdir ola-0.10.0-host && cd ola-0.10.0-host
workdir/build/ola-0.10.0-host $ ../../src/ola-0.10.0/configure --disable-all-plugins --with-protoc=/usr/bin/protoc
workdir/build/ola-0.10.0-host $ make protoc/ola_protoc_plugin
  • now compile olad for the target:
    this step is modified to work for the acme boards:

    workdir/build $ mkdir ola-0.10.0-target && cd ola-0.10.0-target
    workdir/build/ola-0.10.0-target $ ../../src/ola-0.10.0/configure --host=arm-linux-gnueabi \
    --with-protoc=/usr/bin/protoc \
    --with-ola-protoc-plugin=$WORKDIR/build/ola-0.10.0-host/protoc/ola_protoc_plugin \
    --disable-unittests --enable-python-libs --disable-all-plugins --enable-dummy \
    --enable-artnet --enable-e131 --enable-spi --enable-usbpro

    alternative simpler build config:

    build/ola-0.10.0-target$ ../../src/ola-0.10.0/configure --host=arm-linux-gnueabi \
        --with-protoc=/usr/bin/protoc \
        --with-ola-protoc-plugin=$WORKDIR/build/ola-0.10.0-host/protoc/ola_protoc_plugin \
        --disable-unittests --enable-python-libs --disable-all-plugins --enable-dummy

    alternative most basic build config:

    build/ola-0.10.0-target$ ../../src/ola-0.10.0/configure --host=arm-linux-gnueabi \
        --with-protoc=/usr/bin/protoc \
        --with-ola-protoc-plugin=$WORKDIR/build/ola-0.10.0-host/protoc/ola_protoc_plugin \
        --disable-unittests --disable-all-plugins --enable-dummy

    build failed with pthread lib error:

    build/ola-0.10.0-target$ make
        ...
        /usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/bin/ld: cannot find /lib/arm-linux-gnueabi/libpthread.so.0 inside
        /usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/bin/ld: cannot find /usr/lib/arm-linux-gnueabi/libpthread_nonshared.a inside
        collect2: error: ld returned 1 exit status
        Makefile:7269: recipe for target common/libolacommon.la failed

03.02.2016 09:30 s-light

simple test with pthread did work. (example from http://timmurphy.org/2010/05/04/pthreads-in-c-a-minimal-working-example/)

found https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=37658
so changed the paths in target-rootfs/usr/lib/arm-linux-gnueabi/libpthread.so from

/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/arm-linux-gnueabi/libpthread.so.0 /usr/lib/arm-linux-gnueabi/libpthread_nonshared.a )

to

/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
/*GROUP ( /lib/arm-linux-gnueabi/libpthread.so.0 /usr/lib/arm-linux-gnueabi/libpthread_nonshared.a )*/
GROUP ( ../../../lib/arm-linux-gnueabi/libpthread.so.0 ../../../usr/lib/arm-linux-gnueabi/libpthread_nonshared.a )

with this you change theme to be relative to the rootfs.

now again check if build is possible:

build/ola-0.10.0-target$ ../../src/ola-0.10.0/configure --host=arm-linux-gnueabi \
    --with-protoc=/usr/bin/protoc \
    --with-ola-protoc-plugin=$WORKDIR/build/ola-0.10.0-host/protoc/ola_protoc_plugin \
    --disable-unittests --disable-all-plugins --enable-dummy

that brings up some more bugs of missing libraries: so same change for: libc.so

then additionally i changed symlinks for libs:

$ cd target-rootfs/usr/lib/arm-linux-gnueabi
/arm-linux-gnueabi$ file libuuid.so
    libuuid.so: broken symbolic link to /lib/arm-linux-gnueabi/libuuid.so.1.3.0
/arm-linux-gnueabi$ sudo mv libuuid.so libuuid_old.so
/arm-linux-gnueabi$ sudo ln -s ../../../lib/arm-linux-gnueabi/libuuid.so.1.3.0 libuuid.so
/arm-linux-gnueabi$ file libz_old.so
    libz_old.so: broken symbolic link to /lib/arm-linux-gnueabi/libz.so.1.2.8
/arm-linux-gnueabi$ sudo mv libz.so libz_old.so
/arm-linux-gnueabi$ sudo ln -s ../../../lib/arm-linux-gnueabi/libz.so.1.2.8 libz.so
build/ola-0.10.0-target$ make clean
    ....
build/ola-0.10.0-target$ ../../src/ola-0.10.0/configure --host=arm-linux-gnueabi \
    --with-protoc=/usr/bin/protoc \
    --with-ola-protoc-plugin=$WORKDIR/build/ola-0.10.0-host/protoc/ola_protoc_plugin \
    --disable-unittests --disable-all-plugins --enable-dummy
build/ola-0.10.0-target$ make
...
/usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/bin/ld: warning: libz.so.1, needed by /home/stefan/ACME/debian_jessie/target-rootfs/usr/lib/arm-linux-gnueabi/libprotobuf.so, not found (try using -rpath or -rpath-link)
...

see output in log1.sh Line77 is the one with the error.

this lib is there. but somehow its hidden from the linker..


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment