[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#820155: kannel: FTBFS[!linux]: FTW_PHYS undeclared, etc.



Package: kannel
Version: 1.4.4-2
Severity: important
Tags: patch
User: debian-bsd@lists.debian.org
Usertags: kfreebsd

Hi,

kannel stopped building on kfreebsd, and one of the problems is:

utils/start-stop-daemon.c:94:2: error: #error Unknown architecture - cannot build start-stop-daemon

The attached 35_kfreebsd.patch uses the __FreeBSD_kernel__ macro to
detect platforms based on the FreeBSD kernel, besides FreeBSD itself.


The next problem is the same as seen on hurd-i386:

| gcc -D_REENTRANT=1 -I. -Igw -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_LARGE_FILES= -I/usr/include/libxml2  -Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wformat -Wformat-security -Wmissing-format-attribute -I/usr/include -I/usr/include/mysql -I/usr/include/postgresql -I/usr/include/hiredis -I/usr/include -o gw/dlr_spool.o -c gw/dlr_spool.c
| ...
| gw/dlr_spool.c:254:86: error: ‘FTW_PHYS’ undeclared (first use in this function)

To get that definition (from ftw.h) requires _XOPEN_SOURCE>=500 and
_XOPEN_SOURCE_EXTENDED.  Later, to get pthread_rwlock_t requires
_POSIX_C_SOURCE >= 200112L...

test/test_file_traversal.c has the same bug and requires
_XOPEN_SOURCE>=500 and __USE_MISC...

A nice shorthand might be to define _GNU_SOURCE which includes all of
those and its presence shouldn't break any non-GNU platforms.

Finally there is this warning in gw/smsc/http/clickatell.c:

| gcc -D_REENTRANT=1 -I. -Igw -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -D_LARGE_FILES= -I/usr/include/libxml2  -Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wformat -Wformat-security -Wmissing-format-attribute -I/usr/include -I/usr/include/mysql -I/usr/include/postgresql -I/usr/include/hiredis -I/usr/include -o gw/smsc/smsc_http.o -c gw/smsc/smsc_http.c
| In file included from gw/smsc/smsc_http.c:864:0:
| gw/smsc/http/clickatell.c: In function ‘clickatell_receive_sms’:
| gw/smsc/http/clickatell.c:235:9: warning: implicit declaration of function ‘strptime’ [-Wimplicit-function-declaration]

which can also be fixed by defining _GNU_SOURCE.

The attached 36_nonlinux.patch has all of that.  I tested only that it
builds on kfreebsd-amd64 sid, but hopefully it fixes hurd builds too.

Thanks!

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 10.1-0-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Date: Tue, 05 Apr 2016 22:00:19 +0100
From: Steven Chamberlain <steven@pyro.eu.org>
Subject: support GNU/kFreeBSD using FreeBSD code

--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -88,7 +88,7 @@
 #define OSHURD
 #elif defined(SunOS)
 #elif defined(__CYGWIN__)
-#elif defined(__FreeBSD__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
 #define FreeBSD
 #else
 #error Unknown architecture - cannot build start-stop-daemon
--- a/gw/smsc/http/clickatell.c
+++ b/gw/smsc/http/clickatell.c
@@ -61,6 +61,8 @@
  * Stipe Tolj <st@tolj.org>, <stolj@kannel.org>
  */
 
+#define _GNU_SOURCE
+
 #include "gwlib/gwlib.h"
 
 
Date: Tue, 05 Apr 2016 23:08:31 +0100
From: Steven Chamberlain <steven@pyro.eu.org>
Subject: Define _GNU_SOURCE to use X/Open features

Define _GNU_SOURCE to get nftw() macros (XOPEN_SOURCE_EXTENDED)
strptime() (XOPEN_SOURCE), pthread_lock_t (POSIX.1-2001) and others.

--- a/gw/dlr_spool.c
+++ b/gw/dlr_spool.c
@@ -64,6 +64,8 @@
  * Stipe Tolj <stolj at kannel dot org>
  */
 
+#define _GNU_SOURCE
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
--- a/gw/smsc/smsc_http.c
+++ b/gw/smsc/smsc_http.c
@@ -111,6 +111,8 @@
  * Tobias Weber <weber@wapme.de>
  */
 
+#define _GNU_SOURCE
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <unistd.h>
--- a/test/test_file_traversal.c
+++ b/test/test_file_traversal.c
@@ -58,6 +58,8 @@
  * test_file_traversal.c - simple file traversal testing
  */
 
+#define _GNU_SOURCE
+
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>

Reply to: