pkgsrc-Users archive

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

(patch) pkgtools/pkgin missing time_t declaration in archive.h



Hi,

on my oldest Linux build hosts (SuSE 9.0, Ubuntu 6.06), pkgin fails to
build because time_t is not yet declared when archive.h declares
functions with time_t arguments.

    ===> Building for pkgin-0.9.1
    gcc -O2 -I/opt/pkgsrc/include  -Werror  -DHAVE_NBCOMPAT_H=1 -I/opt/pkgsrc/work/pkgsrc/pkgtools/pkgin/default/libnbcompat -I/opt/pkgsrc/include -DPKGIN_VERSION=\""0.9.1 for Linux-2.6.15.5-skas3-v8.2mf4usbnfs i386"\" -DHAVE_NBCOMPAT_H=1 -I/opt/pkgsrc/work/pkgsrc/pkgtools/pkgin/default/libnbcompat -I/opt/pkgsrc/include -g -DLOCALBASE=\"/opt/pkgsrc\"            -DPKG_SYSCONFDIR=\"/opt/pkgsrc/etc\"             -DPKG_DBDIR="\"/opt/pkgsrc/var/db/pkg\""                        -DDEF_LOG_DIR="\"/opt/pkgsrc/var/db/pkg\""              -DPKGIN_DB=\"/opt/pkgsrc/var/db/pkgin\"                         -DPKGTOOLS=\"/opt/pkgsrc/sbin\" -DHAVE_CONFIG_H -D_LARGEFILE_SOURCE -D_LARGE_FILES -DCHECK_MACHINE_ARCH=\"i386\" -Iexternal -I. -I/opt/pkgsrc/include -c main.c
    In file included from pkgin.h:43,
                     from main.c:33:
    /opt/pkgsrc/work/pkgsrc/pkgtools/pkgin/default/.buildlink/include/archive.h:997: error: parse error before "time_t"
    *** Error code 1


Checking with gcc -E, I can see that on these hosts, time_t is being
declared just a few lines later. There is a macro "__need_time_t"
guarding the declaration of time_t, which appears to be set in newer
glibc already in the first invocation of time.h, but not in these old
glibc variants.

Attached patch adds 

   #include <time.h>

to pkgin.h right before the inclusion of "<archive.h>".

I think it does not hurt on other platforms (tried on my local
buildhosts, including NetBSD 5.1/6.1), as time.h is also included by
archive_entry.h, included just one line later.

Regards
Matthias Ferdinand
$NetBSD$

--- pkgin.h.orig	2015-08-13 15:02:36.000000000 +0000
+++ pkgin.h
@@ -40,6 +40,7 @@
 #include <sys/queue.h>
 #endif
 
+#include <time.h>
 #include <archive.h>
 #include <archive_entry.h>
 #include <fetch.h>


Home | Main Index | Thread Index | Old Index