-D_PTHREADS on Solaris ?
Christoph Moar
christoph.moar@mchp.siemens.de
Wed Mar 17 02:10:00 GMT 1999
I am using the egcs compiler since over one year
on a linux platform, almost always keeping up with
the snapshot releases... ;)
I had given up using the same compiler on a sparc
solaris due to linker bugs which would fail when
trying to compile multi-threaded programs.
I just installed egcs-1.1.2 with binutils-2.9.1.0.22b
on both intel/linux/redhat and sparc/solaris machines
and whish to note that it works (almost) like a
charm.
On linux, nothing to object. On Solaris Platform,
I hat to make the following fix:
[56]olymp/home/moar/SmartPump >uname -a
SunOS olymp 5.5 Generic_103093-23 sun4m sparc SUNW,SPARCstation-20
[59]olymp/home/moar/SmartPump >gcc -v
Reading specs from
/sw/local_o/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
[62]olymp/home/moar/SmartPump >as -v
GNU assembler version 2.9.1 (sparc-sun-solaris2.5), using BFD version
2.9.1.0.22
My Software hat to be compiled with -D_PTHREADS.
On Linux, this is no problem, on solaris it looks like the
c++ stdlib is by default *not* compiled with this flag.
If I make
>nm /sw/local_o/lib/libstdc++.a | grep runtime_error | c++filt
[...]
00000794 T runtime_error::runtime_error(basic_string<char,
string_char_traits<char>, __default_alloc_template<1, 0> > const &)
[...]
on the linux machine I would get the above output. That means,
default_alloc_template<1, 0> is the thread-safe allocator,
which is just fine. On solaris, the above call would return
the wrong default_alloc_template<0, 0>, which I habe been
told is the non-thread-safe allocator.
Compiling my program with -D_PTHREADS would result in linker
error complaining about missing the runtime_error symbol
(and many more).
I solved this, not finding a better way to do it, by
adding a -D_PTHREADS to the top level Makefile generated
by configure. Should this be included in the default
distribution or added to the configure script?
regards
Christoph.
--
Christoph Moar (christoph.moar@mchp.siemens.de) Tel. (++49) 89 636-44628
SIEMENS AG Corporate Technology Fax. (++49) 89 636-47457
Information and Media Technology
Office Adress: SIEMENS AG ZT IK 1, Otto-Hahn-Ring 6, D-81739 Munich
Postal Adress: SIEMENS AG ZT IK 1, D-81730 Munich
pgpkey http://pgp5.ai.mit.edu:11371/pks/lookup?op=index &search=0xae81b9cc
More information about the Gcc-bugs
mailing list