Procd : procd can not be compiled with glibc

As title, I find that procd cant be compiled successfully with glibc(but musl was fined) , the error log was listed below , can anyone help to fix ?

make[6]: Entering directory '/home4/mark/mtk_quark/0826/openwrt/lede/build_dir/target-aarch64_cortex-a53_glibc/procd-2019-08-22-95580316'
[  2%] Building C object CMakeFiles/procd.dir/sysupgrade.c.o
/home4/openwrt/lede/build_dir/target-aarch64_cortex-a53_glibc/procd-2019-08-22-95580316/sysupgrade.c: In function 'sysupgrade_exec_upgraded':
/home4/openwrt/lede/build_dir/target-aarch64_cortex-a53_glibc/procd-2019-08-22-95580316/sysupgrade.c:57:7: error: implicit declaration of function 'asprintf'; did you mean 'vsprintf'? [-Werror=implicit-function-declaration]
   if (asprintf(&name, "%s%s", prefix, blobmsg_name(option)) <= 0)
       ^~~~~~~~
       vsprintf
cc1: all warnings being treated as errors

This is a really confusing error as asprintf is a gnu extension that is included in gnu's c library and was added to musl for compatibility to glibc.

Have you done a make clean before the build with glibc?
You could also try only a make package/system/procd clean to clean only the procd build dir...

Hi juppin:
Thanks for your reply ,I have try make clean but it doesn't help , still the same error message .
I found some useful at https://ubuntuforums.org/showthread.php?t=279801 , hence I try to modify sysupgrade.c to add

#define _GNU_SOURCE

in front of #include <stdio.h> and it works , I can compile procd successfully with both glibc and musl. Will anyone help to report/submmit this issue to procd maintainer ?

1 Like

Confirmed issue with GLIBC build.

This patch corrects issue until mainline is fixed.

Index: procd-2019-08-22-95580316/sysupgrade.c
===================================================================
--- procd-2019-08-22-95580316.orig/sysupgrade.c
+++ procd-2019-08-22-95580316/sysupgrade.c
@@ -13,6 +13,7 @@
  * GNU General Public License for more details.
  */
 
+#define _GNU_SOURCE
 
 #include "watchdog.h"
 #include "sysupgrade.h"

This is fixed in mainline now :slight_smile:

1 Like