I'm using a gcc-3.4.3 (csl-sol210-3_4-20050802) to build another instance of gcc-4.4.2. Build fails with the following error message: Making all in include gmake[4]: Entering directory `/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include' mkdir -p ./i386-pc-solaris2.11/bits/stdc++.h.gch /home/gprog/build/./gcc/xgcc -shared-libgcc -B/home/gprog/build/./gcc -nostdinc++ -L/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/src -L/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/src/.libs -B/tmp/gcc/i386-pc-solaris2.11/bin/ -B/tmp/gcc/i386-pc-solaris2.11/lib/ -isystem /tmp/gcc/i386-pc-solaris2.11/nclude -isystem /tmp/gcc/i386-pc-solaris2.11/sys-include -x c++-header -g -O2 -march=pentium4 -mtune=pentium4 -I/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11 -I/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include -I/home/gprog/gcc-4.4.2/libstdc++-v3/libsupc++ -O0 -g /home/gprog/gcc-4.4.2/libstdc++-v3/include/precompiled/stdc++.h -o i386-pc-solaris2.11/bits/stdc++.h.gch/O0g.gch In file included from /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr.h:162, from /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/ext/atomicity.h:34, from /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/bits/basic_string.h:41, from /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/string:53, from /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/bitset:49, from /home/gprog/gcc-4.4.2/libstdc++-v3/include/precompiled/stdc++.h:64: /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr-default.h: In function 'int __gthread_mutex_destroy(__gthread_mutex_t*)': /home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr-default.h:466: error: '__mutex' was not declared in this scope gmake[4]: *** [i386-pc-solaris2.11/bits/stdc++.h.gch/O0g.gch] Error 1 gmake[4]: Leaving directory `/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include' gmake[3]: *** [all-recursive] Error 1 gmake[3]: Leaving directory `/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3' Configure command: ../gcc-4.4.2/configure --prefix=/usr/gnu --exec-prefix=/usr/gnu --srcdir=../gcc-4.4.2 --enable-shared --localstatedir=/var --with-gnu-as --with-gnu-ld --enable-threads=solaris --disable-multilib --enable-languages=c,c++,fortran,objc --with-gmp=/usr/gnu The following environment variables were set before the build started: CFLAGS="-O2 -march=pentium4 -mtune=pentium4 " CXXFLAGS="-O2 -march=pentium4 -mtune=pentium4"
Created attachment 18880 [details] At line 466: error: '__mutex' was not declared
Let's CC Rainer. IMHO something is broken in gthr-solaris.h, I see: #ifdef __cplusplus #define UNUSED(x) #else #define UNUSED(x) x __attribute__((unused)) #endif ... static inline int __gthread_mutex_destroy (__gthread_mutex_t * UNUSED(__mutex)) { if (__gthread_active_p ()) return __gthrw_(mutex_destroy) (__mutex); else return 0; } which cannot be Ok when __cplusplus is defined. Not a libstdc++ proper issue.
I'm getting the except same error message. /build/new-gcc/./gcc/xgcc -shared-libgcc -B/build/new-gcc/./gcc -nostdinc++ -L/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/src -L/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/src/.libs -B/opt/gcc/i386-pc-solaris2.11/bin/ -B/opt/gcc/i386-pc-solaris2.11/lib/ -isystem /opt/gcc/i386-pc-solaris2.11/include -isystem /opt/gcc/i386-pc-solaris2.11/sys-include -x c++-header -g -O2 -I/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11 -I/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include -I/build/gcc-4.4.2/libstdc++-v3/libsupc++ -O0 -g /build/gcc-4.4.2/libstdc++-v3/include/precompiled/stdc++.h -o i386-pc-solaris2.11/bits/stdc++.h.gch/O0g.gch In file included from /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr.h:162, from /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/ext/atomicity.h:34, from /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/bits/basic_string.h:41, from /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/string:53, from /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/bitset:49, from /build/gcc-4.4.2/libstdc++-v3/include/precompiled/stdc++.h:64: /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr-default.h: In function ‘int __gthread_mutex_destroy(__gthread_mutex_t*)’: /build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr-default.h:466: error: ‘__mutex’ was not declared in this scope gmake[4]: *** [i386-pc-solaris2.11/bits/stdc++.h.gch/O0g.gch] Error 1 gmake[4]: Leaving directory `/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3/include' gmake[3]: *** [all-recursive] Error 1 gmake[3]: Leaving directory `/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/build/new-gcc/i386-pc-solaris2.11/libstdc++-v3' gmake[1]: *** [all-target-libstdc++-v3] Error 2 gmake[1]: Leaving directory `/build/new-gcc' gmake: *** [bootstrap] Error 2 Will try building it again with threads=none or the equivalent. alan
Subject: Re: Cannot build gcc: gthr-default.h:466: error: '__mutex' was not declared in this scope > ------- Comment #3 from alanpae at ilkda dot com 2009-11-17 19:18 ------- [...] > Will try building it again with threads=none or the equivalent. Why are you building with --enable-threads=solaris in the first place? Just omit --enable-threads (defaulting to posix); the implementation of both on Solaris 2 is the same, anyway. It is beyond me why anyone would want to program to the old UI Threads interface. That said, I'm testing the obvious fix: Index: gcc/gthr-solaris.h =================================================================== --- gcc/gthr-solaris.h (revision 154216) +++ gcc/gthr-solaris.h (working copy) @@ -37,7 +37,7 @@ #include <errno.h> #ifdef __cplusplus -#define UNUSED(x) +#define UNUSED(x) x #else #define UNUSED(x) x __attribute__((unused)) #endif I've now idea what other problems with --enable-threads=solaris might exist, though. This isn't regularly tested. Rainer
(In reply to comment #4) > Why are you building with --enable-threads=solaris in the first place? > Just omit --enable-threads (defaulting to posix); the implementation of > both on Solaris 2 is the same, anyway. It is beyond me why anyone would > want to program to the old UI Threads interface. Is it better to let configure guess about thread model on OpenSolaris x86 32bit build >= snv_126?
Subject: Re: Cannot build gcc: gthr-default.h:466: error: '__mutex' was not declared in this scope > ------- Comment #5 from YLitvinenko at astana dot oilfield dot slb dot com 2009-11-18 07:03 ------- > Is it better to let configure guess about thread model on OpenSolaris x86 32bit > build >= snv_126? Sure: the default should be fine unless you have specific reasons to prefer UI threads instead. This has nothing to do with OpenSolaris in any way, but is true for any recent Solaris 2 release. Rainer
changing to --disable-threads also works. alan
Subject: Re: Cannot build gcc: gthr-default.h:466: error: '__mutex' was not declared in this scope > ------- Comment #7 from alanpae at ilkda dot com 2009-11-18 19:39 ------- > changing to --disable-threads also works. True, but why not omit any --{enable, disable}-threads option and use the default? Rainer
The #c4 patch looks wrong, instead of that you should IMHO just not use UNUSED macro on __gthread_mutex_destroy argument. It is perfectly fine on __gthread_key_delete.
Subject: Re: Cannot build gcc: gthr-default.h:466: error: '__mutex' was not declared in this scope > The #c4 patch looks wrong, instead of that you should IMHO just not use UNUSED > macro on __gthread_mutex_destroy argument. It is perfectly fine on > __gthread_key_delete. You're right, of course. I should have looked closer. Testing and comparison with pthread results found two other bugs, one of which I could already fix in gthr-solaris.h. I've tried to debug the other (objc) testcase, but gdb 6.6 cannot fully handle it, and I couldn't yet get a gdb 7.0 to debug a 64-bit binary. Given that this is a bootstrap failure, I'll submit and install the fix now and check the remainder later. Rainer
Mine.
Subject: Bug 41810 Author: ro Date: Fri Nov 27 15:17:04 2009 New Revision: 154708 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154708 Log: PR target/41810 * gthr-solaris.h (__gthread_mutex_destroy): Remove UNUSED. [SUPPORTS_WEAK && GTHREAD_USE_WEAK] (__gthread_active_p): Use __extension__ to allow cast from function pointer to object pointer in C++. * doc/install.texi (--enable-threads): Clarify use of Solaris threads. Modified: trunk/gcc/ChangeLog trunk/gcc/doc/install.texi trunk/gcc/gthr-solaris.h
Long fixed.