Resin.io's cloud fails to compile properly

builder
raspberrypi3
docker

#1

I try to compile this repository: https://github.com/raspberrypi/userland

I place it in /usr/src/userland and if I run /usr/src/userland/buildme manually from within the container, it compiles as expected. But if I put RUN /usr/src/userland/buildme in Dockerfile, compilation goes with a bunch of warnings, and while it ends kind of successfully, what’s left on the disk is not what I expect of it. Particularly, in case of “cloud” compilation, /opt/vc folder misses include, share and src folders.

Here’s the successful manual compilation from inside container:
https://gist.github.com/mvasin/9e96b10cd8e00eaec718c441a1ec1ff8

Here’s the failing cloud compilation from resin.io cloud:
https://gist.github.com/mvasin/ad3f4dfe44a9f31e96b94dc24aab35ed

And here’s my Dockerfile.template:

FROM resin/%%RESIN_MACHINE_NAME%%-debian
RUN apt-get update && apt-get install -yq cmake build-essential
COPY userland /usr/src/userland
WORKDIR /usr/src/userland
RUN ["./buildme"] # I comment this out to compile manually inside container
CMD ["sleep", "1000000000"]

I tried to compile docker image on host raspberry OS (on .dev image), but filesystem is read-only, so I couldn’t.


#3

@Michael, I believe this is probably due to a architecture miss match on our cloud builders. looking at the buildme script, it looks for an arch of either armv6l or armv7l when compiling natively, unfortunately, our builders currently don’t identify with that arch. I know @cameron was looking into this.

One work around would be to force the build type to be a crosscompilation somehow. Another possibility is to use the emulated build servers, which should have the correct arch, but are a bit slower. You can do that by doing a git push resin master:resin-emulated


#4

Thank you, @shaunmulligan! The git push resin master:resin-emulated trick worked!

But there is still a quirk left, both on remote emulated and local inside-container compilation: compiling /opt/vc/src/hello_pi/libs/vgfont doesn’t work. Here’s what make -C /opt/vc/src/hello_pi/libs/vgfont ends up with:

make: Entering directory '/opt/vc/src/hello_pi/libs/vgfont'
cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/usr/include/freetype2 -I/usr/include -I/usr/include/arm-linux-gnueabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I./ -I/opt/vc/src/hello_pi/libs/ilclient -I/opt/vc/src/hello_pi/libs/vgfont -g -c font.c -o font.o -Wno-deprecated-declarations
In file included from font.c:57:0:
vgft.h:35:22: fatal error: ft2build.h: No such file or directory
 #include <ft2build.h>
                      ^
compilation terminated.
../../Makefile.include:11: recipe for target 'font.o' failed
make: *** [font.o] Error 1

while on vanilla raspbian it compiles just fine:

make: Entering directory '/opt/vc/src/hello_pi/libs/vgfont'
cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/usr/include/freetype2 -I/usr/include -I/usr/include/arm-linux-gnueabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I./ -I/opt/vc/src/hello_pi/libs/ilclient -I/opt/vc/src/hello_pi/libs/vgfont -g -c font.c -o font.o -Wno-deprecated-declarations
cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/usr/include/freetype2 -I/usr/include -I/usr/include/arm-linux-gnueabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I./ -I/opt/vc/src/hello_pi/libs/ilclient -I/opt/vc/src/hello_pi/libs/vgfont -g -c vgft.c -o vgft.o -Wno-deprecated-declarations
cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/usr/include/freetype2 -I/usr/include -I/usr/include/arm-linux-gnueabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I./ -I/opt/vc/src/hello_pi/libs/ilclient -I/opt/vc/src/hello_pi/libs/vgfont -g -c graphics.c -o graphics.o -Wno-deprecated-declarations
ar r libvgfont.a font.o vgft.o graphics.o
ar: creating libvgfont.a
rm graphics.o font.o vgft.o
make: Leaving directory '/opt/vc/src/hello_pi/libs/vgfont'

Here’s Dockerfile.template to try it quick and easy:

FROM resin/%%RESIN_MACHINE_NAME%%-debian
RUN apt-get update && apt-get install -yq git cmake build-essential
WORKDIR /usr/src
RUN ["git", "clone", "https://github.com/raspberrypi/userland"]
WORKDIR /usr/src/userland
RUN ["./buildme"]
RUN ["make", "-C", "/opt/vc/src/hello_pi/libs/vgfont"]

#5

@shaunmulligan I solved it with apt install libfreetype6-dev :wink:


#6

@Michael , thats awesome, glad you got it working.