Discussion:
patch: fix musl compile without TLS
(too old to reply)
Lucian Cristian
2017-03-08 08:24:34 UTC
Permalink
if DUSE_TLS is not specified and libc is musl the compile will fail with:

posttls-finger.c: In function 'usage':
posttls-finger.c:1607:5: warning: implicit declaration of function 'fprintf' [-Wimplicit-function-declaration]
fprintf(stderr, "usage: %s [-acStTv] [-h host_lookup] [-o name=value] destination\n",
^
posttls-finger.c:1607:5: warning: incompatible implicit declaration of built-in function 'fprintf'
posttls-finger.c:1607:5: note: include '<stdio.h>' or provide a declaration of 'fprintf'
posttls-finger.c:1607:13: error: 'stderr' undeclared (first use in this function)
fprintf(stderr, "usage: %s [-acStTv] [-h host_lookup] [-o name=value] destination\n",
^
posttls-finger.c:1607:13: note: each undeclared identifier is reported only once for each function it appears in
Makefile:63: recipe for target 'posttls-finger.o' failed

https://github.com/openwrt/packages/pull/4093#issuecomment-283521423

if TLS defined, stdio.h related problems will not appear.
Because the openssh related header file contains "#include <stdio.h>" line.

Patch follows:
--------------------------cut here---------------------
--- a/src/posttls-finger/posttls-finger.c
+++ b/src/posttls-finger/posttls-finger.c
@@ -318,6 +318,7 @@
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <stdio.h>

#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
--------------------------cut here---------------------
regards

Lucian Cristian
d***@gmail.com
2017-03-20 20:04:44 UTC
Permalink
Post by Lucian Cristian
posttls-finger.c:1607:5: warning: implicit declaration of function 'fprintf' [-Wimplicit-function-declaration]
fprintf(stderr, "usage: %s [-acStTv] [-h host_lookup] [-o name=value] destination\n",
^
posttls-finger.c:1607:5: warning: incompatible implicit declaration of built-in function 'fprintf'
posttls-finger.c:1607:5: note: include '<stdio.h>' or provide a declaration of 'fprintf'
posttls-finger.c:1607:13: error: 'stderr' undeclared (first use in this function)
fprintf(stderr, "usage: %s [-acStTv] [-h host_lookup] [-o name=value] destination\n",
^
posttls-finger.c:1607:13: note: each undeclared identifier is reported only once for each function it appears in
Makefile:63: recipe for target 'posttls-finger.o' failed
https://github.com/openwrt/packages/pull/4093#issuecomment-283521423
if TLS defined, stdio.h related problems will not appear.
Because the openssh related header file contains "#include <stdio.h>" line.
--------------------------cut here---------------------
--- a/src/posttls-finger/posttls-finger.c
+++ b/src/posttls-finger/posttls-finger.c
@@ -318,6 +318,7 @@
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <stdio.h>
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
--------------------------cut here---------------------
regards
Lucian Cristian
Hi

Not the good list, but thanks for this patch.

Regards

Victor

Loading...