[Pkg-scicomp-devel] Bug#589586: opencv: FTBFS on hurd-i386

Pino Toscano pino at kde.org
Sun Jul 18 22:05:57 UTC 2010


Package: opencv
Version: 2.1.0-1
Severity: important
Tags: patch
User: debian-hurd at lists.debian.org
Usertags: hurd

Hi,

currently[1] opencv fails to build on Debian GNU/Hurd.

The problem is that both GNU/Hurd and Mac OS X run the Mach kernel (although
very different versions of it), so both have the __MACH__ preprocessor symbol
defined. This makes the code that is actual for an Apple kernel being used on
Hurd, hence the failure.
The solution (attached) is to check for both __MACH__ and __APPLE__ in
Mac OS X code.

[1] https://buildd.debian.org/fetch.cgi?pkg=opencv&arch=hurd-i386&ver=2.1.0-1&stamp=1279480558&file=log&as=raw

Thanks,
-- 
Pino
-------------- next part --------------
Author: Pino Toscano <toscano.pino at tiscali.it>
Description: fix build on GNU/Hurd
 GNU/Hurd runs the gnumach kernel so there is the __MACH__ symbol defined as
 well; given the instructions are specific to the Mac OS X kernel, check for
 both __MACH__ and __APPLE__.
--- a/src/cxcore/cxsystem.cpp
+++ b/src/cxcore/cxsystem.cpp
@@ -72,7 +72,7 @@
 #include <sys/time.h>
 #include <time.h>
 
-#ifdef __MACH__
+#if (defined __MACH__ && defined __APPLE__)
 #include <mach/mach.h>
 #include <mach/mach_time.h>
 #endif
@@ -192,7 +192,7 @@
     struct timespec tp;
     clock_gettime(CLOCK_MONOTONIC, &tp);
     return (int64)tp.tv_sec*1000000000 + tp.tv_nsec;
-#elif defined __MACH__
+#elif (defined __MACH__ && defined __APPLE__)
     return (int64)mach_absolute_time();
 #else    
     struct timeval tv;
@@ -210,7 +210,7 @@
     return (double)freq.QuadPart;
 #elif defined __linux || defined __linux__
     return 1e9;
-#elif defined __MACH__
+#elif (defined __MACH__ && defined __APPLE__)
     static double freq = 0;
     if( freq == 0 )
     {


More information about the Pkg-scicomp-devel mailing list