[GCC-XML] problem with gcc 3.4.6

Stefan Roiser stefan.roiser at cern.ch
Tue Aug 12 11:40:38 EDT 2008


Hi,

we found a problem with parsing header files on a Redhat based Linux  
(Scientific Linux 4). The gccxml version is a checkout from yesterday.



[lxbuild115] /build/roiser > uname -a
Linux lxbuild115.cern.ch 2.6.25.1-pfm080429 #1 SMP Tue May 6 17:53:24  
CEST 2008 x86_64 x86_64 x86_64 GNU/Linux
[lxbuild115] /build/roiser > which gccxml
/build/roiser/gccxml/0.9.0_20080811/slc4_amd64_gcc34/bin/gccxml
[lxbuild115] /build/roiser > gccxml --version
GCC-XML version 0.9.0_20080811
[lxbuild115] /build/roiser > cat test.h
#include <iosfwd>
[lxbuild115] /build/roiser > gccxml test.h -fxml=test.xml
In file included from /usr/lib/gcc/x86_64-redhat-linux/ 
3.4.6/../../../../include/c++/3.4.6/x86_64-redhat-linux/bits/gthr.h:104,
                  from /usr/lib/gcc/x86_64-redhat-linux/ 
3.4.6/../../../../include/c++/3.4.6/x86_64-redhat-linux/bits/c++io.h:37,
                  from /usr/lib/gcc/x86_64-redhat-linux/ 
3.4.6/../../../../include/c++/3.4.6/iosfwd:47,
                  from test.h:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:68: error: weakref 'int  
__gthrw_pthread_once(pthread_once_t*, void (*)())' must have static  
linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:69: error: weakref 'int  
__gthrw_pthread_key_create(pthread_key_t*, void (*)(void*))' must have  
static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:70: error: weakref 'int  
__gthrw_pthread_key_delete(pthread_key_t)' must have static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:71: error: weakref 'void*  
__gthrw_pthread_getspecific(pthread_key_t)' must have static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:72: error: weakref 'int  
__gthrw_pthread_setspecific(pthread_key_t, const void*)' must have  
static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:73: error: weakref 'int  
__gthrw_pthread_create(pthread_t*, const pthread_attr_t*, void* (*) 
(void*), void*)' must have static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:75: error: weakref 'int  
__gthrw_pthread_mutex_lock(pthread_mutex_t*)' must have static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:76: error: weakref 'int  
__gthrw_pthread_mutex_trylock(pthread_mutex_t*)' must have static  
linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:77: error: weakref 'int  
__gthrw_pthread_mutex_unlock(pthread_mutex_t*)' must have static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:78: error: weakref 'int  
__gthrw_pthread_mutexattr_init(pthread_mutexattr_t*)' must have static  
linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:79: error: weakref 'int  
__gthrw_pthread_mutexattr_settype(pthread_mutexattr_t*, int)' must  
have static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:80: error: weakref 'int  
__gthrw_pthread_mutexattr_destroy(pthread_mutexattr_t*)' must have  
static linkage
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/ 
x86_64-redhat-linux/bits/gthr-default.h:82: error: weakref 'int  
__gthrw_pthread_mutex_init(pthread_mutex_t*, const  
pthread_mutexattr_t*)' must have static linkage



Looking into gthr-default.h



      61 #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK && defined  
__GNUC_RH_RELEASE__ \
      62     && ((__GNUC__ == 3 && __GNUC_MINOR__ == 4 &&  
(__GNUC_PATCHLEVEL__ > 4 || (__GNUC_PATCHLEVEL__ == 4 &&  
__GNUC_RH_RELEASE__ > 2))) \
      63         || (__GNUC__ == 4 && __GNUC_MINOR__ == 0 &&  
(__GNUC_PATCHLEVEL__ > 2 || (__GNUC_PATCHLEVEL__ == 2 &&  
__GNUC_RH_RELEASE__ > 6)))) \
      64     && ! defined __attribute__
      65 # define __gthrw(name) \
      66   extern __typeof(name) __gthrw_ ## name __attribute__  
((__weakref__(#name)))
      67
      68 __gthrw(pthread_once);
      69 __gthrw(pthread_key_create);
      70 __gthrw(pthread_key_delete);
      71 __gthrw(pthread_getspecific);
      72 __gthrw(pthread_setspecific);
      73 __gthrw(pthread_create);
      74
      75 __gthrw(pthread_mutex_lock);
      76 __gthrw(pthread_mutex_trylock);
      77 __gthrw(pthread_mutex_unlock);
      78 __gthrw(pthread_mutexattr_init);
      79 __gthrw(pthread_mutexattr_settype);
      80 __gthrw(pthread_mutexattr_destroy);
      81
      82 __gthrw(pthread_mutex_init);



it seems that the macro __GXX_WEAK__ is the culprit because the system  
compiler does not define it while the gccxml compiled version does



[lxbuild115] /build/roiser > echo | /usr/bin/c++ -E -dD - | grep  
GXX_WEAK
[lxbuild115] /build/roiser > echo | /build/roiser/gccxml/ 
0.9.0_20080811/slc4_amd64_gcc34/bin/gccxml_cc1plus -E -dD - | grep  
GXX_WEAK
#define __GXX_WEAK__ 1


and invoking the following line works fine


[lxbuild115] /build/roiser > gccxml --gccxml-cxxflags "-U__GXX_WEAK__"  
test.h -fxml=test.xml
[lxbuild115] /build/roiser >



Would it be possible to build gccxml(_cc1plus) without the  
__GXX_WEAK__ symbol? Or would there be another solution to this?

Thx for any help

	Stefan


---
Stefan Roiser, CERN, PH Department, CH-1211 Geneva 23
tel:+41 22 76 74838, cell: +41 76 48 75334, fax:+41 22 76 69119






More information about the gccxml mailing list