Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 96413 - Kernel header in sys-kernel/linux-headers not g++ safe
Summary: Kernel header in sys-kernel/linux-headers not g++ safe
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Other
: High major (vote)
Assignee: Tim Yamin (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-17 14:17 UTC by Matt
Modified: 2005-07-01 11:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt 2005-06-17 14:17:07 UTC
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.
Comment 1 Tim Yamin (RETIRED) gentoo-dev 2005-06-17 14:36:43 UTC
*** Bug 94119 has been marked as a duplicate of this bug. ***
Comment 2 Tim Yamin (RETIRED) gentoo-dev 2005-06-17 14:59:02 UTC
Matt - please try an emerge sync and remerge linux-headers, I think this may
already be fixed.
Comment 3 Tim Yamin (RETIRED) gentoo-dev 2005-07-01 11:11:24 UTC
Please see comment #2.