[solved] Cmake build error (and wolfssl error in alpine)

That works too, I wanted to avoid the rather large Debian install

alpine linux gives me "./configure: line 2: syntax error: unterminated quoted string" when building openwrt (in package wolfssl).
See https://github.com/mwarning/docker-openwrt-builder/tree/alpine

Heh, interesting... I'll try to have a look at it later if time allows

@mwarning
master builds just fine for me on Alpine

What exactly did you do?

This is what I did:

git clone -b alpine https://github.com/mwarning/docker-openwrt-builder.git
cd docker-openwrt-builder
docker build -t openwrt_alpine_builder .

mkdir ~/mybuild
docker run -v ~/mybuild:/home/user/build -it openwrt_alpine_builder /bin/bash

git clone -b openwrt-18.06 https://git.openwrt.org/openwrt/openwrt.git
cd openwrt

./scripts/feeds update -a
./scripts/feeds install -a

make menuconfig # I selected "8devices Lima"
make -j4

This gives an error. I restart with "make V=s". This gives me:

configure: WARNING: unrecognized options: --disable-nls
configure: loading site script /home/user/build/openwrt/include/site/mips
./configure: line 2: syntax error: unterminated quoted string
make[3]: *** [Makefile:178: /home/user/build/openwrt/build_dir/target-mips_24kc_musl/wolfssl-3.15.3-stable/.configured_b7642ce15094029926a9913be4cb199e] Error 2
make[3]: Leaving directory '/home/user/build/openwrt/package/libs/wolfssl'
time: package/libs/wolfssl/compile#12.30#0.59#14.02
make[2]: *** [package/Makefile:109: package/libs/wolfssl/compile] Error 2
make[2]: Leaving directory '/home/user/build/openwrt'
make[1]: *** [package/Makefile:103: /home/user/build/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/user/build/openwrt'
make: *** [/home/user/build/openwrt/include/toplevel.mk:218: world] Error 2

Using the master branch and switching to alpine will fail, as alpine does not have apt.

Default install of extended (no docker image)

apk add git build-base bash ncurses-dev perl tar findutils patch coreutils gawk grep unzip bzip2 wget python2-dev linux-headers curl diffutils bsd-compat-headers less diffutils

Create non root user

cd openwrt
make menuconfig
....

Works great for me, no idea if 18.X works however

OpenWrt master on alpine:edge compiles for me as well (tested with Docker).
But compiling the openwrt-18.0.6 fails.

OpenWrt master and openwrt-18.0.6 both fail using the alpine:edge docker container (same error).

The debian:jessie Docker image compiles OpenWrt master and openwrt-18.06.

Maybe I get around looking into the cmake problem. I was not able to reproduce it with Docker yet.

Btw. your apk line fails finding the the diff package in my alpine:edge docker container (even after apk update).

Ahh, terribly sorry... I made a typo in my notes, it's diffutils not diff.

I got docker alpine images to compile OpenWrt 18.06 now, I had to add the file package as well.

1 Like

Ahh, awesome :slight_smile:

Now I like to figure out the cmake error that made me use docker images in the first place. :smiley:

For some reason (tm) the shebang line gets messed up in wolfssl generated configure script, that's why it errors out I'd guess.
#! /bin/sh

Edit: wolfssl

...but maybe that's ok?

I am not sure. this is a weird error. Removing the space from openwrt/build_dir/target-mips_24kc_musl/wolfssl-3.15.3-stable/m4/ax_create_generic_config.m4 did not help.

I've found the issue, it's /bin/sh which is busybox on Alpine and dash on Debian.
Changing the shebang to bash works just fine but not optimal.

To be clear, it's a regression but I'm not sure what the best fix would be.

Are you considering removing the shebang altogether and instead specifying a dependency on a single type of shell via cmake (if you really need a specific shell.)

Maybe if it's just a case of using a shell script, the script could be re-written using something else and removed?

@diizzy this is the cause: https://github.com/wolfSSL/wolfssl/commit/1b9cff1c5d09adb0af858992e2a2df01b1d4dc58

Reverting it fixes the error - but I do not known why this introduces the bug.

Oh, good job!

I wonder if it would be a bad idea to provide a version of dash in toolchain which always is used or to provide a mechanism for specifying shebang override per package?

@dizzy workarounds for bugs should be the last resort. I will report the error upstream. It is better to patch out these lines for the time being. the wolfssl package already removes broken build configuration stu.ff.

EDIT: reported bug: https://github.com/wolfSSL/wolfssl/issues/2132