Tags: patch
Usertags: origin-ubuntu ubuntu-patch precise
In Ubuntu, we've applied the attached patch to achieve the following:
* debian/patches/30_fix-opencv-ftbfs.patch: fixes FTBFS (part of the
patch comes from the explanation in Debian bug #652770)
We thought you might be interested in doing the same.
--
Pozdrawiam / Kind regards,
Artur Rona
Description: Fixes FTBFS:
* Avoid #defines conflicts in CImg.h as explained in Debian bug #652770
* Use correct LDFLAGS for opencv 2.3
Author: Adrien Cunin <[email protected]>
--- a/CImg.h
+++ b/CImg.h
@@ -233,6 +233,8 @@
// (with function 'CImg<T>::load_camera()'.
// Using OpenCV is not mandatory.
#ifdef cimg_use_opencv
+#undef True
+#undef False
#include <cstddef>
#include "cv.h"
#include "highgui.h"
@@ -6886,7 +6888,7 @@
if (_is_fullscreen) {
XWindowAttributes attr;
XGetWindowAttributes(dpy,_window,&attr);
- while (attr.map_state!=IsViewable) XSync(dpy,False);
+ while (attr.map_state!=IsViewable) XSync(dpy,0);
XSetInputFocus(dpy,_window,RevertToParent,CurrentTime);
}
} break;
@@ -7016,7 +7018,7 @@
} while (!is_exposed || !is_mapped);
do { // Wait for the window to be visible.
XGetWindowAttributes(dpy,_window,&attr);
- if (attr.map_state!=IsViewable) { XSync(dpy,False); cimg::sleep(10); }
+ if (attr.map_state!=IsViewable) { XSync(dpy,0); cimg::sleep(10); }
} while (attr.map_state!=IsViewable);
_window_x = attr.x;
_window_y = attr.y;
@@ -7029,7 +7031,7 @@
static XEvent event;
event.xexpose.type = Expose;
event.xexpose.serial = 0;
- event.xexpose.send_event = True;
+ event.xexpose.send_event = 1;
event.xexpose.display = dpy;
event.xexpose.window = _window;
event.xexpose.x = 0;
@@ -7037,14 +7039,14 @@
event.xexpose.width = width();
event.xexpose.height = height();
event.xexpose.count = 0;
- XSendEvent(dpy,_window,False,0,&event);
+ XSendEvent(dpy,_window,0,0,&event);
} else { // Repaint directly (may be called from the expose event).
GC gc = DefaultGC(dpy,DefaultScreen(dpy));
#ifdef cimg_use_xshm
if (_shminfo) {
const int completion_type = XShmGetEventBase(dpy) + ShmCompletion;
XEvent event;
- XShmPutImage(dpy,_window,gc,_image,0,0,0,0,_width,_height,True);
+ XShmPutImage(dpy,_window,gc,_image,0,0,0,0,_width,_height,1);
do { XNextEvent(dpy,&event); } while (event.type!=completion_type); // Wait for the image drawing to be completed.
} else XPutImage(dpy,_window,gc,_image,0,0,0,0,_width,_height);
#else
@@ -7071,7 +7073,7 @@
nshminfo->shmaddr = nimage->data = (char*)shmat(nshminfo->shmid,0,0);
if (nshminfo->shmaddr==(char*)-1) { shmctl(nshminfo->shmid,IPC_RMID,0); XDestroyImage(nimage); delete nshminfo; return; }
else {
- nshminfo->readOnly = False;
+ nshminfo->readOnly = 0;
cimg::X11_attr().is_shm_enabled = true;
XErrorHandler oldXErrorHandler = XSetErrorHandler(_assign_xshm);
XShmAttach(dpy,nshminfo);
@@ -7141,7 +7143,7 @@
XRRSetScreenConfig(dpy,config,DefaultRootWindow(dpy),
cimg::X11_attr().curr_resolution,cimg::X11_attr().curr_rotation,CurrentTime);
XRRFreeScreenConfigInfo(config);
- XSync(dpy,False);
+ XSync(dpy,0);
}
}
}
@@ -7154,7 +7156,7 @@
const unsigned int sx = screen_width(), sy = screen_height();
if (sx==_width && sy==_height) return;
XSetWindowAttributes winattr;
- winattr.override_redirect = True;
+ winattr.override_redirect = 1;
_background_window = XCreateWindow(dpy,DefaultRootWindow(dpy),0,0,sx,sy,0,0,
InputOutput,CopyFromParent,CWOverrideRedirect,&winattr);
const unsigned int buf_size = sx*sy*(cimg::X11_attr().nb_bits==8?1:(cimg::X11_attr().nb_bits==16?2:4));
@@ -7169,14 +7171,14 @@
while (event.type!=MapNotify);
GC gc = DefaultGC(dpy,DefaultScreen(dpy));
#ifdef cimg_use_xshm
- if (_shminfo) XShmPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy,False);
+ if (_shminfo) XShmPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy,0);
else XPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy);
#else
XPutImage(dpy,_background_window,gc,background_image,0,0,0,0,sx,sy);
#endif
XWindowAttributes attr;
XGetWindowAttributes(dpy,_background_window,&attr);
- while (attr.map_state!=IsViewable) XSync(dpy,False);
+ while (attr.map_state!=IsViewable) XSync(dpy,0);
XDestroyImage(background_image);
}
@@ -7189,7 +7191,7 @@
XRRScreenConfiguration *config = XRRGetScreenInfo(dpy,DefaultRootWindow(dpy));
XRRSetScreenConfig(dpy,config,DefaultRootWindow(dpy),0,cimg::X11_attr().curr_rotation,CurrentTime);
XRRFreeScreenConfigInfo(config);
- XSync(dpy,False);
+ XSync(dpy,0);
cimg::X11_attr().curr_resolution = 0;
}
#endif
@@ -7263,7 +7265,7 @@
if (!_is_closed) _init_fullscreen();
const unsigned int sx = screen_width(), sy = screen_height();
XSetWindowAttributes winattr;
- winattr.override_redirect = True;
+ winattr.override_redirect = 1;
_window = XCreateWindow(dpy,DefaultRootWindow(dpy),(sx-_width)/2,(sy-_height)/2,_width,_height,0,0,
InputOutput,CopyFromParent,CWOverrideRedirect,&winattr);
} else
@@ -7304,11 +7306,11 @@
_shminfo->shmaddr = _image->data = (char*)(_data = shmat(_shminfo->shmid,0,0));
if (_shminfo->shmaddr==(char*)-1) { shmctl(_shminfo->shmid,IPC_RMID,0); XDestroyImage(_image); delete _shminfo; _shminfo = 0; }
else {
- _shminfo->readOnly = False;
+ _shminfo->readOnly = 0;
cimg::X11_attr().is_shm_enabled = true;
XErrorHandler oldXErrorHandler = XSetErrorHandler(_assign_xshm);
XShmAttach(dpy,_shminfo);
- XSync(dpy,False);
+ XSync(dpy,0);
XSetErrorHandler(oldXErrorHandler);
if (!cimg::X11_attr().is_shm_enabled) {
shmdt(_shminfo->shmaddr); shmctl(_shminfo->shmid,IPC_RMID,0); XDestroyImage(_image); delete _shminfo; _shminfo = 0;
@@ -7325,11 +7327,11 @@
_image = XCreateImage(dpy,DefaultVisual(dpy,DefaultScreen(dpy)),cimg::X11_attr().nb_bits,ZPixmap,0,(char*)_data,_width,_height,8,0);
}
- _wm_window_atom = XInternAtom(dpy,"WM_DELETE_WINDOW",False);
- _wm_protocol_atom = XInternAtom(dpy,"WM_PROTOCOLS",False);
+ _wm_window_atom = XInternAtom(dpy,"WM_DELETE_WINDOW",0);
+ _wm_protocol_atom = XInternAtom(dpy,"WM_PROTOCOLS",0);
XSetWMProtocols(dpy,_window,&_wm_window_atom,1);
- if (_is_fullscreen) XGrabKeyboard(dpy,_window,True,GrabModeAsync,GrabModeAsync,CurrentTime);
+ if (_is_fullscreen) XGrabKeyboard(dpy,_window,1,GrabModeAsync,GrabModeAsync,CurrentTime);
cimg::X11_attr().wins[cimg::X11_attr().nb_wins++]=this;
if (!_is_closed) _map_window(); else { _window_x = _window_y = cimg::type<int>::min(); }
XUnlockDisplay(dpy);
@@ -7364,7 +7366,7 @@
_data = 0; _image = 0;
if (cimg::X11_attr().nb_bits==8) XFreeColormap(dpy,_colormap);
_colormap = 0;
- XSync(dpy,False);
+ XSync(dpy,0);
// Reset display variables
delete[] _title;
@@ -7540,7 +7542,7 @@
XWarpPointer(dpy,0L,_window,0,0,0,0,posx,posy);
_mouse_x = posx; _mouse_y = posy;
_is_moved = false;
- XSync(dpy,False);
+ XSync(dpy,0);
XUnlockDisplay(dpy);
return *this;
}
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -132,7 +132,7 @@
# Flags to enable OpenCV support.
CIMG_OPENCV_CFLAGS = -Dcimg_use_opencv -I/usr/include/opencv
-CIMG_OPENCV_LDFLAGS = -lcv -lhighgui
+CIMG_OPENCV_LDFLAGS = -lopencv_core -lopencv_highgui
# Flags used to disable display capablities of CImg
CIMG_NODISPLAY_CFLAGS = -Dcimg_display=0