Bug#78996: apt won't build on FreeBSD - [patch]
Package: apt
Version: 0.3.19
Maybe you aren't interested in these since most people won't be building apt on
FreeBSD, but the required changes are minor.
Building apt on FreeBSD, two little problems broke the build (patches
that fix it are at the end of this message):
bash-2.03$ uname -a
FreeBSD ruff 4.1-STABLE FreeBSD 4.1-STABLE #15: Sun Sep 10 14:28:39 PDT 2000 davidw@dw3.gordian.com:/usr/src/sys/compile/ELLA i386
Compiling contrib/mmap.cc to ../obj/apt-pkg/mmap.o
In file included from contrib/mmap.cc:32:
/usr/include/sys/mman.h:134: type specifier omitted for parameter
/usr/include/sys/mman.h:140: type specifier omitted for parameter
contrib/mmap.cc: In method `bool MMap::Map(FileFd &)':
/usr/include/sys/mman.h:140: too many arguments to function `void * mmap(void *, unsigned int, int, int, int)'
contrib/mmap.cc:83: at this point in file
gmake: *** [../obj/apt-pkg/mmap.o] Error 1
The problem here is that FreeBSD needs sys/types.h included too.
Compiling contrib/error.cc to ../obj/apt-pkg/error.o
contrib/error.cc:37: syntax error
gmake: *** [../obj/apt-pkg/error.o] Error 1
Here the problem is that FreeBSD just 'defines' _POSIX_THREADS, they don't
define it as anything:
bash-2.03$ grep _POSIX_THREADS /usr/include/sys/unistd.h
#define _POSIX_THREADS
Patches that fix the problems:
--- apt-pkg/contrib/mmap.cc.orig Mon Dec 4 12:55:38 2000
+++ apt-pkg/contrib/mmap.cc Mon Dec 4 12:56:37 2000
@@ -29,6 +29,7 @@
#include <apt-pkg/mmap.h>
#include <apt-pkg/error.h>
+#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
--- apt-pkg/contrib/error.cc.orig Mon Dec 4 12:55:49 2000
+++ apt-pkg/contrib/error.cc Mon Dec 4 12:29:42 2000
@@ -34,7 +34,7 @@
is compiled to be thread safe otherwise a non-safe version is used. A
Per-Thread error object is maintained in much the same manner as libc
manages errno */
-#if _POSIX_THREADS == 1 && defined(HAVE_PTHREAD)
+#if defined(_POSIX_THREADS) && defined(HAVE_PTHREAD)
#include <pthread.h>
static pthread_key_t ErrorKey;
Reply to: