Uhttpd compile error

I'm trying to compile with:

gcc v8.2
glibc
-O2 -pipe -march=armv7-a+neon-vfpv4 -mtune=cortex-a15
binutils 2.31.1

for Zyxel NBG6817 on Ubuntu 18.04.

A few days before I was compiling with (gcc v7.3, musl, -O2 -pipe -mcpu=cortex-a15 -mfpu=neon-vfpv4, binutils 2.31.1) the whole image without any issue. Nothing changed beside the settings above. Anyone has a hint for me? Are this "tweaks" to much/safe to use? Or did I make a mistake elsewhere?

make package/network/services/uhttpd/{clean,compile} V=s
...
...
...
Scanning dependencies of target uhttpd_lua
make[5]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
make[5]: Entering directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
[  5%] Building C object CMakeFiles/uhttpd_lua.dir/lua.c.o
[ 11%] Linking C shared module uhttpd_lua.so
make[5]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
[ 11%] Built target uhttpd_lua
make[5]: Entering directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
Scanning dependencies of target uhttpd
make[5]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
make[5]: Entering directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
[ 17%] Building C object CMakeFiles/uhttpd.dir/main.c.o
/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3/main.c:20: error: "_DEFAULT_SOURCE" redefined [-Werror]
 #define _DEFAULT_SOURCE
 
<command-line>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
CMakeFiles/uhttpd.dir/build.make:62: recipe for target 'CMakeFiles/uhttpd.dir/main.c.o' failed
make[5]: *** [CMakeFiles/uhttpd.dir/main.c.o] Error 1
make[5]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/uhttpd.dir/all' failed
make[4]: *** [CMakeFiles/uhttpd.dir/all] Error 2
make[4]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
Makefile:129: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3'
Makefile:111: recipe for target '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3/.built' failed
make[2]: *** [/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/uhttpd-2018-08-23-b741dec3/.built] Error 2
make[2]: Leaving directory '/home/openwrt/openwrt-r8/package/network/services/uhttpd'
time: package/network/services/uhttpd/compile#1.14#0.33#1.40
package/Makefile:107: recipe for target 'package/network/services/uhttpd/compile' failed
make[1]: *** [package/network/services/uhttpd/compile] Error 2
make[1]: Leaving directory '/home/openwrt/openwrt/openwrt/openwrt'
/home/openwrt/openwrt-r8/include/toplevel.mk:216: recipe for target 'package/network/services/uhttpd/compile' failed
make: *** [package/network/services/uhttpd/compile] Error 2

Kind regards,
pwned

Well, You have changed at the same time the compiler, libc and CPU options...

Maybe change one of them at a time.

Pure guess, but might be the gcc version.

1 Like

It is caused by using glibc. You can try to manually update uhttpd to the latest Git revision (https://git.openwrt.org/?p=project/uhttpd.git;a=commitdiff;h=77b774b30f9125e77137c57a2ff86de57361d947)

1 Like

Thank you very much for your replies guys. :slight_smile:

The patches are fixing the problem. After I have changed in patch file.c:

-#define _DEFAULT_SOURCE
+#ifndef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE
+#define

into

-#define _DEFAULT_SOURCE
+#ifndef _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE
+#endif

it was compiling without any error.

But the next error was incoming for e2fsprogs (e2fsck). :frowning:

make package/utils/e2fsprogs/{clean,compile} V=s
...
...
...
make[5]: Entering directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/e2fsprogs-1.44.3/e2fsck'
	CC unix.c
	CC e2fsck.c
	CC super.c
	CC pass1.c
	CC pass1b.c
	CC pass2.c
	CC pass3.c
	CC pass4.c
	CC pass5.c
	CC journal.c
	CC badblocks.c
	CC util.c
	CC dirinfo.c
	CC dx_dirinfo.c
	CC ehandler.c
	CC problem.c
	CC message.c
	CC quota.c
	CC recovery.c
	CC region.c
	CC revoke.c
	CC ea_refcount.c
	CC rehash.c
	CC logfile.c
	CC sigcatcher.c
	CC readahead.c
	CC extents.c
	LD e2fsck
e2fsck.h:598:13: warning: type of 'fatal_error' does not match original declaration [-Wlto-type-mismatch]
 extern void fatal_error(e2fsck_t ctx, const char * fmt_string);
             ^
util.c:53:6: note: 'fatal_error' was previously declared here
 void fatal_error(e2fsck_t ctx, const char *msg)
      ^
util.c:53:6: note: code may be misoptimized unless -fno-strict-aliasing is used
jfs_user.h:208:17: warning: type of 'e2fsck_global_ctx' does not match original declaration [-Wlto-type-mismatch]
 extern e2fsck_t e2fsck_global_ctx;  /* Try your very best not to use this! */
                 ^
unix.c:68:10: note: 'e2fsck_global_ctx' was previously declared here
 e2fsck_t e2fsck_global_ctx; /* Try your very best not to use this! */
          ^
unix.c:68:10: note: code may be misoptimized unless -fno-strict-aliasing is used
/home/openwrt/openwrt-r8/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.2.0_glibc_eabi/lib/gcc/arm-openwrt-linux-gnueabi/8.2.0/../../../../arm-openwrt-linux-gnueabi/bin/ld: ../lib/libcom_err.so: undefined reference to `sem_post'
/home/openwrt/openwrt-r8/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.2.0_glibc_eabi/lib/gcc/arm-openwrt-linux-gnueabi/8.2.0/../../../../arm-openwrt-linux-gnueabi/bin/ld: ../lib/libcom_err.so: undefined reference to `sem_wait'
/home/openwrt/openwrt-r8/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.2.0_glibc_eabi/lib/gcc/arm-openwrt-linux-gnueabi/8.2.0/../../../../arm-openwrt-linux-gnueabi/bin/ld: ../lib/libcom_err.so: undefined reference to `sem_init'
/home/openwrt/openwrt-r8/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-8.2.0_glibc_eabi/lib/gcc/arm-openwrt-linux-gnueabi/8.2.0/../../../../arm-openwrt-linux-gnueabi/bin/ld: ../lib/libcom_err.so: undefined reference to `sem_destroy'
collect2: error: ld returned 1 exit status
Makefile:426: recipe for target 'e2fsck' failed
make[5]: *** [e2fsck] Error 1
make[5]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/e2fsprogs-1.44.3/e2fsck'
Makefile:407: recipe for target 'all-progs-recursive' failed
make[4]: *** [all-progs-recursive] Error 1
make[4]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/e2fsprogs-1.44.3'
Makefile:341: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/e2fsprogs-1.44.3'
Makefile:300: recipe for target '/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/e2fsprogs-1.44.3/.built' failed
make[2]: *** [/home/openwrt/openwrt-r8/build_dir/target-arm_cortex-a15+neon-vfpv4_glibc_eabi/e2fsprogs-1.44.3/.built] Error 2
make[2]: Leaving directory '/home/openwrt/openwrt-r8/package/utils/e2fsprogs'
time: package/utils/e2fsprogs/compile#38.29#8.63#44.47
package/Makefile:107: recipe for target 'package/utils/e2fsprogs/compile' failed
make[1]: *** [package/utils/e2fsprogs/compile] Error 2
make[1]: Leaving directory '/home/openwrt/openwrt-r8'
/home/openwrt/openwrt-r8/include/toplevel.mk:216: recipe for target 'package/utils/e2fsprogs/compile' failed
make: *** [package/utils/e2fsprogs/compile] Error 2

Should I open a new thread or do you guys think that this isn't an issue of openwrt but more an issue of the choosen architecture and e2fsprogs?

EDIT1: How do I format this logs in a proper way like thomas did it for me in my first post?

EDIT2: I've discovered this:
https://bugs.openwrt.org/index.php?do=details&task_id=1796&string=e2fsprogs
The error is reported already. But maybe someone has a workaround?

EDIT3: escalade aka arokh did already the work for e2fsprogs (Makefile). THX for this! :))))))
For future reference, others facing this issue:


So hopefully I'm able to finish my build now. ^^

image

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.