[SOLVED] Cant build turris-os

Hello,

I am facing issue during compiling turris-os. I done usual steps, as for OpenWRT:

git clone https://github.com/CZ-NIC/turris-os.git
git checkout stable-omnia
./scripts/feeds update -a
make menuconfig

Target System - AR7/AR9
Target Profile - Default

make

tools and toolchain went fine, but then building failed failed during aplying patches

make[1]: Entering directory `/home/Documents/turris-os'
make[2]: Entering directory `/home/Documents/turris-os'
make[3]: Entering directory `/home/Documents/turris-os/target/linux'
make[4]: Entering directory `/home/Documents/turris-os/target/linux/ar71xx'
if [ -s "/home/Documents/turris-os/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.35/patches/series" ]; then (cd "/home/Documents/turris-os/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.35"; if quilt --quiltrc=- next >/dev/null 2>&1; then quilt --quiltrc=- push -a; else quilt --quiltrc=- top >/dev/null 2>&1; fi ); fi
Applying patch platform/902-unaligned_access_hacks.patch
patching file arch/mips/include/asm/checksum.h
patching file include/uapi/linux/ip.h
patching file include/uapi/linux/ipv6.h
patching file include/uapi/linux/tcp.h
patching file include/uapi/linux/udp.h
patching file net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
patching file include/uapi/linux/icmp.h


...

g file include/net/addrconf.h
patching file include/net/inet_ecn.h
Hunk #1 FAILED at 115.
1 out of 1 hunk FAILED -- rejects in file include/net/inet_ecn.h
patching file include/net/ipv6.h
Hunk #2 succeeded at 417 (offset 19 lines).
Hunk #3 succeeded at 477 (offset 19 lines).
Hunk #4 succeeded at 487 (offset 19 lines).
Hunk #5 succeeded at 633 (offset 20 lines).
Hunk #6 succeeded at 763 (offset 20 lines).
patching file include/net/secure_seq.h
patching file include/uapi/linux/in.h
patching file net/core/secure_seq.c
patching file net/ipv6/ip6_fib.c
patching file net/netfilter/nf_conntrack_proto_tcp.c
patching file net/xfrm/xfrm_input.c
patching file net/ipv4/tcp_input.c
patching file include/uapi/linux/if_pppox.h
patching file net/ipv6/netfilter/nf_log_ipv6.c
Patch platform/902-unaligned_access_hacks.patch does not apply (enforce with -f)
make[4]: *** [/home/Documents/turris-os/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.35/.quilt_checked] Error 1
make[4]: Leaving directory `/home/Documents/turris-os/target/linux/ar71xx'
make[3]: *** [compile] Error 2
make[3]: Leaving directory `/home/Documents/turris-os/target/linux'
make[2]: *** [target/linux/compile] Error 2
make[2]: Leaving directory `/home/Documents/turris-os'
make[1]: *** [/home/Documents/turris-os/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.target_compile] Error 2
make[1]: Leaving directory `/home/Documents/turris-os'
make: *** [world] Error 2

902-unalligned patch

 #include <linux/netdevice.h>
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -115,13 +115,13 @@ static inline int IP6_ECN_set_ce(struct
 {
     if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
         return 0;
-    *(__be32*)iph |= htonl(INET_ECN_CE << 20);
+    net_hdr_word(iph) |= htonl(INET_ECN_CE << 20);
     return 1;
 }

include/net/inet_ecn.h

/* Note:
 * IP_ECN_set_ce() has to tweak IPV4 checksum when setting CE,
 * meaning both changes have no effect on skb->csum if/when CHECKSUM_COMPLETE
 * In IPv6 case, no checksum compensates the change in IPv6 header,
 * so we have to update skb->csum.
 */
120 static inline int IP6_ECN_set_ce(struct sk_buff *skb, struct ipv6hdr *iph)
121 {
122    __be32 from, to;

124    if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
125        return 0;

127    from = *(__be32 *)iph;
128    to = from | htonl(INET_ECN_CE << 20);
129    *(__be32 *)iph = to;
    if (skb->ip_summed == CHECKSUM_COMPLETE)
        skb->csum = csum_add(csum_sub(skb->csum, from), to);
    return 1;
}
1 Like

Turris only works with target system “Marvel Amada 37x/38x/XP” and target profile “Turris Omnia”. There is an script called compile_omnia_fw at the root of your buidl tree this configures and builds everything. I suggest you start with that and modify things afterwards.

1 Like

Thank you! I was thinking that defaults would be setuped by defconfig or something (didnt realized that turris isnt only omnia, duh). I will follow you lead. Hope that omnia_fw script leaves proper omnia .config after run, so I will be able add custom package(s) and compile via usual make…

Work for a while, but hit a break again @avahi

feeds/turrispackages/libs/tcp_wrappers compile
 make[3] -C feeds/packages/sound/pulseaudio compile
 make[3] -C feeds/turrispackages/libs/libdaemon compile
 make[3] -C feeds/turrispackages/libs/avahi compile
make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
make: *** [world] Error 1

install -d -m0755 /home/Documents/turris-os/build_dir/target-arm_cortex-a9+vfpv3_musl-1.1.11_eabi/avahi/dbus/avahi-0.6.31/ipkg-mvebu/libavahi-client/usr/lib
cp -fpR /home/Documents/turris-os/build_dir/target-arm_cortex-a9+vfpv3_musl-1.1.11_eabi/avahi/dbus/avahi-0.6.31/ipkg-install/usr/lib/libavahi-client.so.* /home/Documents/turris-os/build_dir/target-arm_cortex-a9+vfpv3_musl-1.1.11_eabi/avahi/dbus/avahi-0.6.31/ipkg-mvebu/libavahi-client/usr/lib/
find /home/Documents/turris-os/build_dir/target-arm_cortex-a9+vfpv3_musl-1.1.11_eabi/avahi/dbus/avahi-0.6.31/ipkg-mvebu/libavahi-client -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
Package libavahi-client is missing dependencies for the following libraries:
libavahi-common.so.3
make[3]: *** [/home/Documents/turris-os/bin/mvebu-musl/packages/turrispackages/libavahi-client_0.6.31-13_mvebu.ipk] Error 1
make[3]: Leaving directory `/home/Documents/turris-os/feeds/turrispackages/libs/avahi'
make[2]: *** [package/feeds/turrispackages/avahi/compile] Error 2
make[2]: Leaving directory `/home/Documents/turris-os'
make[1]: *** [/home/Documents/turris-os/staging_dir/target-arm_cortex-a9+vfpv3_musl-1.1.11_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/Documents/turris-os'
make: *** [world] Error 2

I don’t know about this error in particular, but I’ve had some problems building it, too.
Try using Ubuntu 14.04 Trusty.
I used Debian Jessie and had multiple problems like this.
After I switched to Ubuntu in a LXC container, there was just one little problem left:
The GIT client is compiled with GnuTLS, what is a problem for downloading some sources.
To compile it with OpenSSL: https://gist.github.com/pescobar/6ae5634f92d75d23c36a

And maybe helpful too:
apt-get install -y build-essential bzr cvs gawk gcc-multilib flex git-core gettext libncurses5-dev libssl-dev libxml-parser-perl openjdk-6-jdk subversion unzip zip zlib1g-dev
From: https://gitlab.labs.nic.cz/turris/openwrt/blob/test/vagrant/vagrant_provision.sh

I am compiling in the same virtual machine (Xubuntu 14.04). I am compiling OpenWRT images just fine… So I am thinking the problem will not be the OS itself…

Yeah, I guess Ubuntu and Xubuntu shouldn’t be that much different.
I don’t know if that is important, but I used a 64bit system.
And like I said, I used a fresh Ubuntu installation (in a LXC container).

Maybe you want to try the exact same commit like used for the package repository at the moment?:
https://api.turris.cz/openwrt-repo/omnia/git-hash

I would like to compile last stable, mine shows

git log
commit 8d60ae7a56c1c50eb94c54d90ed194a2eef8f401
Author: Michal 'vorner' Vaner <michal.vaner@nic.cz>
Date:   Tue Nov 8 11:16:38 2016 +0100

Hmm, look at the changes of this commit: https://github.com/CZ-NIC/turris-os/commit/8d60ae7a56c1c50eb94c54d90ed194a2eef8f401


+CONFIG_PACKAGE_libavahi=m

Maybe this is related to your problem?

I assume that it just means that this package should be compiled as module. But I am not sure why avahi compilation failed. I wouldnt say that it would be marked as stable, if there are missing some dependencies…

Well, because I was able to successfully compile it before, I simply tried it:

Latest commit (8d60ae7a56c1c50eb94c54d90ed194a2eef8f401): same error at avahi
One commit before (e198976fe28e6ee86c9ae4fbe610031c91df4a4e): successful

Sorry if this destroys your faith in the “stable” branch :wink:

1 Like

Hello

Let me explain the branches a bit. That stable doesn’t necessarily means everything is OK there. It just means it is not the branch with active development. Every time we release a „big“ update, we reset the stable branch to whatever we released, continue the development elsewhere and use the stable branch to prepare fixes for „small“ updates (like security fixes, really annoying bugs and such).

And yes, you hit a moment when I’m trying to do a workaround to something updater-related and some packages give me a hard time. I just pushed something I believe should fix this, but I’m still waiting for confirmation from the build machine.

If you want something that did build for us for sure, you can either look for the tags (these are the points of big releases) or go to https://api.turris.cz/openwrt-repo/omnia/git-hash, which is always the one currently released to public.

As for the script, it compiles multiple targets (there’s the firmware itself, but also a rescue system). I’m not 100% sure which one is compiled last, so the .config left after compilation might be from something else. However, the script should be able to tell you how it is constructed.

3 Likes

hats off hurzhurz, you had right from the start.
vorner, thanks for explanation. building again :slight_smile: If I will be succesfull, I will document all steps as closure to this topic, to be avaible to others tryin the same thing and without those informations as I was.

Edit:
I checkout git-hash,

Documents/turris-os$ git log
commit 3d81b3c906b3f5be01981f828041010512dcfd5b
Author: Michal Hrusecky <michal.hrusecky@nic.cz>
Date:   Tue Nov 1 15:21:01 2016 +0100

but I ran into the same problem with avahi :confused:

Strange, I already built 3d81b3c906b3f5be01981f828041010512dcfd5b successful some days ago.

If it is not a mandatory package for you you can run make menuconfig disable it run the usuall make -j8 or so. Build an btrfs root.tar.gz and put that file on an usb stick renamed to omnia-medkit-latest.tar.gz. Plug the stick in the front usb port and press the reset button till four led’s light up. It should then install that image to the router.

I’ve also tried to compile the source codes. Here are my notes how I’ve done it:

Download Ubuntu 16.04.1 LTS (https://www.ubuntu.com/download/desktop)
Create new virtual machine in VirtualBox - 2CPU, 2048MB RAM, 25GB VDI (dynamically allocated), shared clipboard Bidirectional.

Install Ubuntu into VirtualBox and then:

sudo apt-get update
sudo apt-get install build-essential linux-headers-`uname -r` dkms

Install virtual box host additions (from inserted CD) - autorun
If autorun doesn’t work works then:

sudo /media/user/VBOXADDITIONS_something_/VBoxLinuxAdditions.run
sudo reboot now

Install dependecies:

sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk
sudo apt-get install subversion mercurial
sudo apt-get install ccache
sudo apt-get install libc6-dev-i386
sudo apt-get install g++-multilib

Read last stable commit from: https://api.turris.cz/openwrt-repo/omnia/git-hash
(it’s from stable-omnia branch but necessarily the last one)

git clone -b stable-omnia https://gitlab.labs.nic.cz/turris/openwrt.git
cd openwrt/
git reset --hard 3d81b3c906b3f5be01981f828041010512dcfd5b(change to the last stable commit)
git log

Run the build:

USE_CCACHE=1 ./compile_omnia_fw -j 2 LOGFILE=1 BUILD_LOG=1 IS_TTY=1

Wait for couple of hours…

My observation: Turris Omina team seems to be very week in writing documentation. If any of you read this - you should not only do what you enjoy like coding and tweaking! Spare some time on what’s also necessary - write, update and maintain the documentation for the end user!

8 Likes

Thanks a lot. After some gnutls handshake issue - solved by recompiling git with openssl - I finally sucessfully compiled turris omnia. Now I am trying to compile vncrepeater. Thanks a lot!

1 Like

Thanks for posting this. It helped me build it. I only had one minor modification that I needed to work around. Instead of sudo /media/user/VBOXADDITIONS_something_/VBoxLinuxAdditions.run
I did this:
sudo apt-get install virtualbox-guest-dkms

After that, I built it once, it failed, and then I built again with -j1 V=s and it successfully built.

Thanks,
-tamara

This is just a note for people trying to build Turris on macOS. You may run into OpenSSL missing problem. The solution is to add the following lines to your .bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/opt/openssl/lib export LDFLAGS=$LDFLAGS:"-L/usr/local/opt/openssl/lib" export CFLAGS=$CFLAGS:"-I/usr/local/opt/openssl/include"

This will solve the OpenSSL missing problem while building the system.