servalproject / openwrt-packages

Feed that adds Serval components to the OpenWRT build system
8 stars 7 forks source link

Build on OpenWRT Barrier Breaker / Chaos Calmer #1

Open jonashoechst opened 9 years ago

jonashoechst commented 9 years ago

I tried to use the Serval feed in the current OpenWRT Version. Building Chaos Calmer or even Barrier Breaker with the Serval Package fails with the current Issues:

make[3]: Entering directory `/home/nicer/build/openwrt/chaos-calmer/feeds/serval/net/serval-dna'
CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/target-mips_34kc_musl-1.1.10/usr/include -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/target-mips_34kc_musl-1.1.10/include -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/usr/include -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/include/fortify -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/target-mips_34kc_musl-1.1.10/usr/include -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/target-mips_34kc_musl-1.1.10/include -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/usr/include -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/include/fortify -I/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/include " LDFLAGS="-L/home/nicer/build/openwrt/chaos-calmer/staging_dir/target-mips_34kc_musl-1.1.10/usr/lib -L/home/nicer/build/openwrt/chaos-calmer/staging_dir/target-mips_34kc_musl-1.1.10/lib -L/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/usr/lib -L/home/nicer/build/openwrt/chaos-calmer/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_musl-1.1.10/lib -znow -zrelro " make -j1 -C /home/nicer/build/openwrt/chaos-calmer/build_dir/target-mips_34kc_musl-1.1.10/serval-dna-START-3236-g1848493/. AR="mips-openwrt-linux-musl-gcc-ar" AS="mips-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=mips-openwrt-linux-musl-ld NM="mips-openwrt-linux-musl-gcc-nm" CC="mips-openwrt-linux-musl-gcc" GCC="mips-openwrt-linux-musl-gcc" CXX="mips-openwrt-linux-musl-g++" RANLIB="mips-openwrt-linux-musl-gcc-ranlib" STRIP=mips-openwrt-linux-musl-strip OBJCOPY=mips-openwrt-linux-musl-objcopy OBJDUMP=mips-openwrt-linux-musl-objdump SIZE=mips-openwrt-linux-musl-size CROSS="mips-openwrt-linux-musl-" ARCH="mips" ;
make[4]: Entering directory `/home/nicer/build/openwrt/chaos-calmer/build_dir/target-mips_34kc_musl-1.1.10/serval-dna-START-3236-g1848493'
SERVALD CC sqlite-amalgamation-3070900/sqlite3.c
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[4]: *** [objs_servald/sqlite3.o] Error 1
gardners commented 9 years ago

Hello, Thanks for the heads-up on this. There have been some recent changes to the sqlite source we include to re-allow multi-threaded operation on Android, which might be the cause. I'll see if Jeremy can take a look when he comes in on Monday. Otherwise, a temporary work-around might be to use an older version of the serval-dna repository for the build.

jonashoechst commented 9 years ago

Thanks for your reply! Building Serval DNA on OpenWRT 12.09 (Attitude Adjustment) is not a problem and works great! The issue comes in place using the newer version of OpenWrt.

gardners commented 9 years ago

Hello,

Glad to hear. Does that solve your problem? Are you able to provide more information on the way it fails with newer versions, e.g., building with V=99 to show the command line that fails?

Paul.

On Thu, Jul 23, 2015 at 6:51 AM, Jonas Höchst notifications@github.com wrote:

Thanks for your reply! Building Serval DNA on OpenWRT 12.09 (Attitude Adjustment) is not a problem and works great! The issue comes in place using the newer version of OpenWrt.

— Reply to this email directly or view it on GitHub https://github.com/servalproject/openwrt-packages/issues/1#issuecomment-123868868 .

jonashoechst commented 9 years ago

My original post already shows all verbose output. The error seems to be related to the sqlite amalgamation. The error speaks of a redefinition of the compiler flag _FORTIFY_SOURCE. I removed it temporarily from the Makefile of serval-dna, which leads to a compiling version.

From the Makefile: (lines 61 and 62)

# Security enhancements from Debian
CFLAGS+=-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2

This disables some compiler optimization checks and therefore could result in a non working binary. I will check that later.

gardners commented 9 years ago

Hello,

Thanks for the update.

Paul.

On Thu, Jul 23, 2015 at 5:46 PM, Jonas Höchst notifications@github.com wrote:

My original post already shows all verbose output. The error seems to be related to the sqlite amalgamation. The error speaks of a redefinition of the compiler flag _FORTIFY_SOURCE. I removed it temporarily from the Makefile of serval-dna, which leads to a compiling version.

From the Makefile: (lines 61 and 62)

Security enhancements from Debian

CFLAGS+=-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2

This disables some compiler optimization checks and therefore could result in a non working binary. I will check that later.

— Reply to this email directly or view it on GitHub https://github.com/servalproject/openwrt-packages/issues/1#issuecomment-124018552 .

jonashoechst commented 9 years ago

I can now confirm, that the binary does work in the current version of OpenWRT! I did not do a complete check using the bash framework, but a few tests using rhizome. When compiling for a Raspberry Pi, compilation failed because of the following error:

SERVALD CC rhizome_store.c
rhizome_store.c: In function 'rhizome_read':
rhizome_store.c:1129:3: error: comparison is always false due to limited range of data type [-Werror=type-limits]
   if (read_state->verified == -1)
   ^
rhizome_store.c: In function 'rhizome_read_close':
rhizome_store.c:1245:3: error: comparison is always false due to limited range of data type [-Werror=type-limits]
   if (read->verified==-1) {
   ^

This ultimately leads me to rhizome.h, in which struct rhizome_read is declared. In line 674 verified is defined as char. Using a signed char solves the problem.

Thanks for your support so far!