I was trying to compile OpenCV (version 0.9.6) when I recieved an error message below: /******* begin *******/ g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I. -I../../cxcore/include -I../../cv/inclu de -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib64 /gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/ freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib64/g lib-2.0/include -g -fomit-frame-pointer -O3 -DNDEBUG -Wall -fno-rtti -pipe -MT c vcap_v4l.lo -MD -MP -MF .deps/cvcap_v4l.Tpo -c cvcap_v4l.cpp -fPIC -DPIC -o .li bs/cvcap_v4l.o In file included from /usr/include/asm/system.h:7, from /usr/include/asm-x86_64/processor.h:19, from /usr/include/asm/processor.h:7, from /usr/include/linux/prefetch.h:15, from /usr/include/linux/list.h:5, from /usr/include/linux/wait.h:12, from /usr/include/linux/fs.h:12, from cvcap_v4l.cpp:98: /usr/include/asm-x86_64/system.h:245: error: expected `,' or `...' before "new" /usr/include/asm-x86_64/system.h: In function `long unsigned int __cmpxchg(volat ile void*, long unsigned int, long unsigned int)': /usr/include/asm-x86_64/system.h:248: error: `size' undeclared (first use this f unction) /usr/include/asm-x86_64/system.h:248: error: (Each undeclared identifier is repo rted only once for each function it appears in.) /usr/include/asm-x86_64/system.h:252: error: expected identifier before ')' toke n /usr/include/asm-x86_64/system.h:258: error: expected identifier before ')' toke n /usr/include/asm-x86_64/system.h:264: error: expected identifier before ')' toke n /usr/include/asm-x86_64/system.h:270: error: expected identifier before ')' toke n make[3]: *** [cvcap_v4l.lo] Error 1 make[3]: Leaving directory `/usr/src/opencv-0.9.6/otherlibs/highgui' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/usr/src/opencv-0.9.6/otherlibs' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/src/opencv-0.9.6' make: *** [all] Error 2 /********** end ***************/ The problem was traced to a variable name in the file /usr/include/asm-x86_64/system.h which is not g++ compatable. The function __cmpxchg uses a parameter name 'new' which causes the C++ compiler to error. The following patch changes the parmeter name from 'new' to '_new' and fixes the issue: /*********** begin ***********/ --- system.h-orig 2005-06-17 14:36:04.000000000 -0500 +++ system.h 2005-06-17 14:36:31.000000000 -0500 @@ -243,5 +243,5 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, - unsigned long new, int size) + unsigned long _new, int size) { unsigned long prev; @@ -250,5 +250,5 @@ __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "q"(_new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; @@ -256,5 +256,5 @@ __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "q"(_new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; @@ -262,5 +262,5 @@ __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %k1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "q"(_new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; @@ -268,5 +268,5 @@ __asm__ __volatile__(LOCK_PREFIX "cmpxchgq %1,%2" : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "q"(_new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; /*********** end *************/ Reproducible: Always Steps to Reproduce: 1. Download OpenCV 2. Run ./configure 3. Run make Actual Results: The compilation process errored due to details given above. Expected Results: It should have compiled sucessfully.
*** Bug 94119 has been marked as a duplicate of this bug. ***
Matt - please try an emerge sync and remerge linux-headers, I think this may already be fixed.
Please see comment #2.