Solaris 10 and gcc update

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Solaris 10 and gcc update

Chris Williams
Here are my results compiling on solaris 10 with gcc.  
The build line I used was: ant -Dapr.dir=/usr/local/apr
-Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2 -Dlogchar=utf8
-Dhas.wchar_t=0

I only got one error which was the following.  I think it might fail because
I am not using wchar_t but I will let someone else tell me if that is true
or not.

[exec] 1) test: CachedDateFormatTestCase::test9 (E)
[exec] uncaught exception of type std::runtime_error
[exec] - locale::facet::_S_create_c_locale name not valid

When I tried to build without the -Dlogchar=utf8 -Dhas.wchar_t=0 command
lines, I got the following link error.


build-shortsocketserver:
    [mkdir] Created dir:
/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/shortsocketser
ver_obj
       [cc] 2 total files to be compiled.
       [cc] Starting link
       [cc] Undefined                   first referenced
       [cc]  symbol                         in file
       [cc] log4cxx::helpers::UnicodeHelper::encodeWide(unsigned int,
wchar_t*)/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/liblo
g4cxx.so
       [cc] log4cxx::helpers::UnicodeHelper::decodeWide(wchar_t const*&,
wchar_t
const*)/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/liblog4
cxx.so

Any suggestions on what I could do to resolve this?

Thanks
Chris

For those interested, here are the steps I took to compile logging-log4cxx
on Solaris 10.  This *might* work for those working on earlier versions of
Solaris.  I am using a stock Solaris 10 install with the Sun Freeware CD
installed which places a bunch of applications under /usr/sfw and /opt/sfw.
The version of gcc that I have installed is 3.4.2.

1) Downloaded and installed ant 1.6.3.
2) Fetch from CVS ant-contrib and built it.
3) Fetch from CVS cpptasks and built it.
4) I copied the jars from ant-contrib and cpptasks to the ant lib directory.
5) Download the expat package from www.sunfreeware.com and install it.
(/usr/local)
6) Download apr-1.1.0.  Run configure, make, and make install.
7) Download apr-util-1.1.0. Run configure with the following args:
--with-apr=/usr/local/apr --with-berkeley-db=/usr/local/BerkeleyDB.4.2
LDFLAGS="-R/opt/sfw/lib".  Then do a make and make install.
8) Download cppunit-1.10.2.  Run configure, make, and make install.
9) Modified the build.xml to add <linkerarg value="-L/usr/local/lib"/> to
the following targets: build, build-example, build-socketserver,
build-unittest, build-standalone-unittest
10) Run ant -Dapr.dir=/usr/local/apr
-Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2 -Dlogchar=utf8
-Dhas.wchar_t=0

Reply | Threaded
Open this post in threaded view
|

Re: Solaris 10 and gcc update

carnold-3

On May 9, 2005, at 8:07 PM, Chris Williams wrote:

> Here are my results compiling on solaris 10 with gcc.
> The build line I used was: ant -Dapr.dir=/usr/local/apr
> -Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2 -Dlogchar=utf8
> -Dhas.wchar_t=0
>
> I only got one error which was the following.  I think it might fail  
> because
> I am not using wchar_t but I will let someone else tell me if that is  
> true
> or not.
>
> [exec] 1) test: CachedDateFormatTestCase::test9 (E)
> [exec] uncaught exception of type std::runtime_error
> [exec] - locale::facet::_S_create_c_locale name not valid
>


The failure in test9 is likely happening on the following line:

   std::locale localeUS(LOCALE_US);

where LOCALE_US = "en_US".  Do you have any documentation on the names  
recognized for std::locale constructors on Solaris?


> When I tried to build without the -Dlogchar=utf8 -Dhas.wchar_t=0  
> command
> lines, I got the following link error.
>
>
> build-shortsocketserver:
>     [mkdir] Created dir:
> /export/disk10/cppProjects/logging-log4cxx/build/debug/shared/
> shortsocketser
> ver_obj
>        [cc] 2 total files to be compiled.
>        [cc] Starting link
>        [cc] Undefined                   first referenced
>        [cc]  symbol                         in file
>        [cc] log4cxx::helpers::UnicodeHelper::encodeWide(unsigned int,
> wchar_t*)/export/disk10/cppProjects/logging-log4cxx/build/debug/
> shared/liblo
> g4cxx.so
>        [cc] log4cxx::helpers::UnicodeHelper::decodeWide(wchar_t  
> const*&,
> wchar_t
> const*)/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/
> liblog4
> cxx.so
>
> Any suggestions on what I could do to resolve this?
>

Those methods have been suppressed since you specified that the  
compiler did not have a wchar_t type with the -Dhas.wchar_t=0.  I  
assume that Solaris gcc actually has a wide character type and you  
could turn it on and the problem would go away.  However, I should  
review shortsocketserver to see why it doesn't build when wchar_t is  
not present.

Reply | Threaded
Open this post in threaded view
|

RE: Solaris 10 and gcc update

Chris Williams
Comments in-line....

> Here are my results compiling on solaris 10 with gcc.
> The build line I used was: ant -Dapr.dir=/usr/local/apr
> -Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2 -Dlogchar=utf8
> -Dhas.wchar_t=0
>
> I only got one error which was the following.  I think it might fail
> because
> I am not using wchar_t but I will let someone else tell me if that is  
> true
> or not.
>
> [exec] 1) test: CachedDateFormatTestCase::test9 (E)
> [exec] uncaught exception of type std::runtime_error
> [exec] - locale::facet::_S_create_c_locale name not valid
>


>The failure in test9 is likely happening on the following line:
>
>   std::locale localeUS(LOCALE_US);
>
>where LOCALE_US = "en_US".  Do you have any documentation on the names  
>recognized for std::locale constructors on Solaris?
I am pretty sure en_US is a valid locale.  I went to the /usr/lib/locale and
there is a en_US directory.  Any other thoughts on what to try??


> When I tried to build without the -Dlogchar=utf8 -Dhas.wchar_t=0
> command
> lines, I got the following link error.
>
>
> build-shortsocketserver:
>     [mkdir] Created dir:
> /export/disk10/cppProjects/logging-log4cxx/build/debug/shared/
> shortsocketser
> ver_obj
>        [cc] 2 total files to be compiled.
>        [cc] Starting link
>        [cc] Undefined                   first referenced
>        [cc]  symbol                         in file
>        [cc] log4cxx::helpers::UnicodeHelper::encodeWide(unsigned int,
> wchar_t*)/export/disk10/cppProjects/logging-log4cxx/build/debug/
> shared/liblo
> g4cxx.so
>        [cc] log4cxx::helpers::UnicodeHelper::decodeWide(wchar_t  
> const*&,
> wchar_t
> const*)/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/
> liblog4
> cxx.so
>
> Any suggestions on what I could do to resolve this?
>

>Those methods have been suppressed since you specified that the  
>compiler did not have a wchar_t type with the -Dhas.wchar_t=0.  I  
>assume that Solaris gcc actually has a wide character type and you  
>could turn it on and the problem would go away.  However, I should  
>review shortsocketserver to see why it doesn't build when wchar_t is  
>not present.

I got this error when I used the ant -Dapr.dir=/usr/local/apr
-Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2

Looking at the unicodehelper.cc, I'm not sure the __STD_ISO_10646__ is
defined.  I think this is why then encodeWide is not defined.  I did a
search through various header files and the STD_ISO_10646 was no where to be
found.

Thanks
Chris

Reply | Threaded
Open this post in threaded view
|

Re: Solaris 10 and gcc update

carnold-3
>> The failure in test9 is likely happening on the following line:
>>
>>   std::locale localeUS(LOCALE_US);
>>
>> where LOCALE_US = "en_US".  Do you have any documentation on the  
>> names
>> recognized for std::locale constructors on Solaris?
>>
> I am pretty sure en_US is a valid locale.  I went to the /usr/lib/
> locale and
> there is a en_US directory.  Any other thoughts on what to try??
>

Nope.  That isn't an essential test, I'd just comment it out in the  
CPPUNIT_TEST block at the top and we will dig into it later.


>
>
>> When I tried to build without the -Dlogchar=utf8 -Dhas.wchar_t=0
>> command
>> lines, I got the following link error.
>>
>>
>> build-shortsocketserver:
>>     [mkdir] Created dir:
>> /export/disk10/cppProjects/logging-log4cxx/build/debug/shared/
>> shortsocketser
>> ver_obj
>>        [cc] 2 total files to be compiled.
>>        [cc] Starting link
>>        [cc] Undefined                   first referenced
>>        [cc]  symbol                         in file
>>        [cc] log4cxx::helpers::UnicodeHelper::encodeWide(unsigned int,
>> wchar_t*)/export/disk10/cppProjects/logging-log4cxx/build/debug/
>> shared/liblo
>> g4cxx.so
>>        [cc] log4cxx::helpers::UnicodeHelper::decodeWide(wchar_t
>> const*&,
>> wchar_t
>> const*)/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/
>> liblog4
>> cxx.so
>>
>> Any suggestions on what I could do to resolve this?
>>
>>
>
>
>> Those methods have been suppressed since you specified that the
>> compiler did not have a wchar_t type with the -Dhas.wchar_t=0.  I
>> assume that Solaris gcc actually has a wide character type and you
>> could turn it on and the problem would go away.  However, I should
>> review shortsocketserver to see why it doesn't build when wchar_t is
>> not present.
>>
>
> I got this error when I used the ant -Dapr.dir=/usr/local/apr
> -Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2
>
> Looking at the unicodehelper.cc, I'm not sure the __STD_ISO_10646__ is
> defined.  I think this is why then encodeWide is not defined.  I did a
> search through various header files and the STD_ISO_10646 was no  
> where to be
> found.
>


__STD_ISO_10646__ is defined by the compiler when the wchar_t  
contains UCS-4 code points (that is 4 byte unicode scalar values).  
encodeWide and decodeWide will be compiled for WIN32 (where wchar_t  
is UTF-16) and when __STD_ISO_10646__ is defined (where wchar_t is  
UCS-4).  Do you have a description of wchar_t is on that platform and  
how it can be detected.
Reply | Threaded
Open this post in threaded view
|

Re: Solaris 10 and gcc update

Chris Williams
In reply to this post by Chris Williams
After some google searches, I found out that
__STD_ISO_10646__ is not defined on Solaris 10 and I
doubt earlier Solaris versions.  I know wchar_t is
defined in Solaris 10 but I don't know of a way to
find that out.  I will hunt around and try to find a
way that wchar_t can be tested.

Chris

--- Curt Arnold <[hidden email]> wrote:

> >> The failure in test9 is likely happening on the
> following line:
> >>
> >>   std::locale localeUS(LOCALE_US);
> >>
> >> where LOCALE_US = "en_US".  Do you have any
> documentation on the  
> >> names
> >> recognized for std::locale constructors on
> Solaris?
> >>
> > I am pretty sure en_US is a valid locale.  I went
> to the /usr/lib/
> > locale and
> > there is a en_US directory.  Any other thoughts on
> what to try??
> >
>
> Nope.  That isn't an essential test, I'd just
> comment it out in the  
> CPPUNIT_TEST block at the top and we will dig into
> it later.
>
>
> >
> >
> >> When I tried to build without the -Dlogchar=utf8
> -Dhas.wchar_t=0
> >> command
> >> lines, I got the following link error.
> >>
> >>
> >> build-shortsocketserver:
> >>     [mkdir] Created dir:
> >>
>
/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/

> >> shortsocketser
> >> ver_obj
> >>        [cc] 2 total files to be compiled.
> >>        [cc] Starting link
> >>        [cc] Undefined                   first
> referenced
> >>        [cc]  symbol                         in
> file
> >>        [cc]
> log4cxx::helpers::UnicodeHelper::encodeWide(unsigned
> int,
> >>
>
wchar_t*)/export/disk10/cppProjects/logging-log4cxx/build/debug/
> >> shared/liblo
> >> g4cxx.so
> >>        [cc]
> log4cxx::helpers::UnicodeHelper::decodeWide(wchar_t
> >> const*&,
> >> wchar_t
> >>
>
const*)/export/disk10/cppProjects/logging-log4cxx/build/debug/shared/

> >> liblog4
> >> cxx.so
> >>
> >> Any suggestions on what I could do to resolve
> this?
> >>
> >>
> >
> >
> >> Those methods have been suppressed since you
> specified that the
> >> compiler did not have a wchar_t type with the
> -Dhas.wchar_t=0.  I
> >> assume that Solaris gcc actually has a wide
> character type and you
> >> could turn it on and the problem would go away.
> However, I should
> >> review shortsocketserver to see why it doesn't
> build when wchar_t is
> >> not present.
> >>
> >
> > I got this error when I used the ant
> -Dapr.dir=/usr/local/apr
> >
>
-Dcppunit.dir=/export/disk10/cppProjects/cppunit-1.10.2

> >
> > Looking at the unicodehelper.cc, I'm not sure the
> __STD_ISO_10646__ is
> > defined.  I think this is why then encodeWide is
> not defined.  I did a
> > search through various header files and the
> STD_ISO_10646 was no  
> > where to be
> > found.
> >
>
>
> __STD_ISO_10646__ is defined by the compiler when
> the wchar_t  
> contains UCS-4 code points (that is 4 byte unicode
> scalar values).  
> encodeWide and decodeWide will be compiled for WIN32
> (where wchar_t  
> is UTF-16) and when __STD_ISO_10646__ is defined
> (where wchar_t is  
> UCS-4).  Do you have a description of wchar_t is on
> that platform and  
> how it can be detected.
>
Reply | Threaded
Open this post in threaded view
|

Solaris 10 and wchar

Chris Williams
In reply to this post by carnold-3
I wrote a little test program and the size of wchar_t is 4 bytes on solaris
10.  I removed the defined(__STDC_ISO_10646__) from the unicodehelper.cpp
and recompiled.  All the tests passed other than the locale one which failed
before.

I'm not sure if there are any defines that tell which operating
system/version the compile is occuring on or if ccptask has any of the
information that could be used as a define.  I don't need wchar support but
it looks like it is possible if we can find the correct defines.

Chris

Reply | Threaded
Open this post in threaded view
|

Solaris 10, locales, and Sun Studio 10

Chris Williams
For some reason, gcc 3.4.2 that came with the Solaris 10 doesn't support
locales correctly and that is why one of the locale tests was failing.  The
only locales that it worked with was C and POSIX.  Now using Sun Studio 10,
the locales worked as expected.

As far as sun studio 10 goes, it worked fine as long I compiled cppUnit
separately.  The only change I had to make was to add the following to
tests/src/net/socketservertestcase.cpp.  These are defined when the Sun
Studio compilers are being used.

#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#include <unistd.h>
#endif

Without that include, fork, exec, and something else would be undefined.
The other issue that came up a lot was warnings about variables hiding other
variables.  Here is an example.

[cc] "/export/disk10/cppProjects/logging-log4cxx/include/log4cxx/level.h",
line 183: Warning: level hides log4cxx::Level::level.
[cc] "/export/disk10/cppProjects/logging-log4cxx/include/log4cxx/level.h",
line 186: Warning: level hides log4cxx::Level::level.

Not exactly a major issue but makes the build on Sun Studio 10 really messy.
If anyone wants, I can email the log file that contains all the warnings.

Thanks
Chris