Porting to SCO Unix

Good day, I'm trying to port Boost to SCO Unix using STLport and GNU Pth (a user-space Pthreads library), and gcc 2.95 controlled by a customized compiler driver (so some of the following observations may not be applicable to stock gcc users on this platform). Anyway, I've had a few problems that I'd like to report; I think at least some of them are worth correcting in future Boost releases: The following tests in libs/config/configure produce incorrect results: ** checking for pthread_exit in -lpthread... no This test tries to compile a C source file that prototypes "pthread_exit" as "char pthread_exit();". But my compiler driver always adds "-include <...>/pthread.h" to the command line, which includes a different, conflicting prototype for this function. I think the test ought to include <pthread.h> instead. ** checking pthread_yield... no This is correct, but I do have a pthread_yield_np() function, maybe we should look for it, too. ** checking std::basic_streambuf<wchar_t> ... OK I think this should fail if _STLP_NO_WCHAR_T is defined, which it is in my STLport configuration headers. This macro does not prevent one from instantiating basic_string<>, etc. with wchar_t, but it does disable explicit instantiations of these in STLport binaries. So basic_string<char> ends up being compiled into libstlport.so, while basic_string<wchar_t> doesn't. The macro also disables the typedefs (wstring, wcout, etc) and the wide char - related C headers (<cwchar>, <cwctype>). I really think Boost should disable all wide char stuff in this case. I also discovered some problems with Jamfiles (BTW what is Jamfile.v2? Is it useable? How does one use it?): tools/build/v1/allyourbase.jam, near line 574): rule CcMv is called but never defined. What does variable "RELOCATE" do in allyourbase.jam? It seems to indicate that the compiler doesn't support the -o switch, shouldn't this be defined in compiler-specific toolset files? Why is there no static version of Boost.Threads? I know this is required in Windows, but not if it's compiled on top of Pthreads on any platform (I'm using pthreads-win32 from Redhat, on Windows), right? The documentation (http://www.boost.org/more/getting_started.html#Build_Install) states that "[...] For toolsets that support it in Unix they will also have a full version extension (for example ".so.1.31.0")". But this does not seem to be the case. I ended up with "libboost_thread-gcc-mt-1_31.so" etc. using gcc toolset on SCO. Where are the ".so.1.31.0" versions? Maybe I'm missing some toolset settings. Also it seems that some of the .so files generated ought to be symbolic links, but are instead copies of one another. Where is this controlled? Do I need to edit/create some toolset file to replace "cp" with "ln -s"? If I pass -DNDEBUG to my source files that #include Boost headers, do I have to link with non-debug version of boost libs? How about multithreaded vs single-threaded configurations? For example, is it safe to link with MT Boost libs with non-MT programs using gcc/Linux? I know it makes a difference in Windows, but it should not matter on platforms where compiler runtimes don't differentiate between MT/non-MT, IMHO. That is, unless the Boost headers provide different declarations depending on the presence of some "MT" macro. This would be very unfortunate, because it's very easy to link with the wrong library and the compiler won't complain about it. It would be nice to have an option of not using the long "mangled" library names while installing. As a user I would expect a more customary convention for library names on UNIX-like systems, with only two variants, something like the following: libboost_foo.a libboost_foo.so.1.31.0 libboost_foo.so (symbolic link to libbost_foo.so.1.31.0) (... possibly more links depending on binary compatibility guarantees between the releases) both compiled with MT/non-debug configurations. Comments/suggestions? Thanks, D.

The following tests in libs/config/configure produce incorrect results:
** checking for pthread_exit in -lpthread... no This test tries to compile a C source file that prototypes "pthread_exit" as "char pthread_exit();". But my compiler driver always adds "-include <...>/pthread.h" to the command line, which includes a different, conflicting prototype for this function. I think the test ought to include <pthread.h> instead.
Grrrrr, I used the standard autoconf macros for checking this, if I get the time I'll try and write my own version that does what you suggest.
** checking pthread_yield... no This is correct, but I do have a pthread_yield_np() function, maybe we should look for it, too.
It's up to the thread lib guys to use it (or not), maybe you could hassle the authors of the thread lib you are using to provide a standard function signature?
** checking std::basic_streambuf<wchar_t> ... OK I think this should fail if _STLP_NO_WCHAR_T is defined, which it is in my STLport configuration headers. This macro does not prevent one from instantiating basic_string<>, etc. with wchar_t, but it does disable explicit instantiations of these in STLport binaries. So basic_string<char> ends up being compiled into libstlport.so, while basic_string<wchar_t> doesn't. The macro also disables the typedefs (wstring, wcout, etc) and the wide char - related C headers (<cwchar>, <cwctype>). I really think Boost should disable all wide char stuff in this case.
Do BOOST_NO_CWCTYPE and BOOST_NO_CWCHAR get defined? If so then this is a non-issue as support for wide character strings/streams will get automatically disabled off the back of this (in other words the message may be misleading).
Why is there no static version of Boost.Threads? I know this is required in Windows, but not if it's compiled on top of Pthreads on any platform (I'm using pthreads-win32 from Redhat, on Windows), right?
There will be a static version in the next release.
If I pass -DNDEBUG to my source files that #include Boost headers, do I have to link with non-debug version of boost libs? How about multithreaded vs single-threaded configurations? For example, is it safe to link with MT Boost libs with non-MT programs using gcc/Linux? I know it makes a difference in Windows, but it should not matter on platforms where compiler runtimes don't differentiate between MT/non-MT, IMHO. That is, unless the Boost headers provide different declarations depending on the presence of some "MT" macro. This would be very unfortunate, because it's very easy to link with the wrong library and the compiler won't complain about it.
You must link to a library compiled the same way as your code, and yes the multithreaded binaries are generally binary-incompatible with single threaded code (technical note - because boost code is a mix of templates and separate file code, we can't in general shield users from issues like this, at least not without some people complaining :-) ) John.

John Maddock wrote:
** checking pthread_yield... no This is correct, but I do have a pthread_yield_np() function, maybe we should look for it, too.
It's up to the thread lib guys to use it (or not), maybe you could hassle the authors of the thread lib you are using to provide a standard function signature?
There is no pthread_yield in POSIX. Yields are evil anyway. ;-)

"Peter Dimov" <pdimov@mmltd.net> writes:
John Maddock wrote:
** checking pthread_yield... no This is correct, but I do have a pthread_yield_np() function, maybe we should look for it, too.
It's up to the thread lib guys to use it (or not), maybe you could hassle the authors of the thread lib you are using to provide a standard function signature?
There is no pthread_yield in POSIX. Yields are evil anyway. ;-)
Why evil? -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

David Abrahams wrote:
"Peter Dimov" <pdimov@mmltd.net> writes:
John Maddock wrote:
** checking pthread_yield... no This is correct, but I do have a pthread_yield_np() function, maybe we should look for it, too.
It's up to the thread lib guys to use it (or not), maybe you could hassle the authors of the thread lib you are using to provide a standard function signature?
There is no pthread_yield in POSIX. Yields are evil anyway. ;-)
Why evil?
Because they can only mask problems, not solve them, Sleep(1) in lwm_win32.hpp notwithstanding. :-)

** checking pthread_yield... no This is correct, but I do have a pthread_yield_np() function, maybe we should look for it, too.
It's up to the thread lib guys to use it (or not), maybe you could hassle the authors of the thread lib you are using to provide a standard function signature?
There is no pthread_yield in POSIX. Yields are evil anyway. ;-)
It's spelled "sched_yield", pthread_yield and variants were the pre-standard names. John.

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of John Maddock Sent: Thursday, September 02, 2004 6:08 AM To: boost@lists.boost.org Subject: Re: [boost] Porting to SCO Unix
** checking std::basic_streambuf<wchar_t> ... OK I think this should fail if _STLP_NO_WCHAR_T is defined, which it is in my STLport configuration headers. This macro does not prevent one from instantiating basic_string<>, etc. with wchar_t, but it does disable explicit instantiations of these in STLport binaries. So basic_string<char> ends up being compiled into libstlport.so, while basic_string<wchar_t> doesn't. The macro also disables the typedefs (wstring, wcout, etc) and the wide char - related C headers (<cwchar>, <cwctype>). I really think Boost should disable all wide char stuff in this case.
Do BOOST_NO_CWCTYPE and BOOST_NO_CWCHAR get defined? If so then this is a non-issue as support for wide character strings/streams will get automatically disabled off the back of this (in other words the message may be misleading).
No these macros don't get defined in this case. And I don't see where wide strings/streams are disabled in the presence of BOOST_NO_CWCTYPE, etc. -- neither in suffix.hpp, nor in stdlib/stlport.hpp. Anyway, here's a patch: Index: stlport.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/config/stdlib/stlport.hpp,v retrieving revision 1.26 diff -u -r1.26 stlport.hpp --- stlport.hpp 2 Jul 2004 01:21:25 -0000 1.26 +++ stlport.hpp 2 Sep 2004 19:42:07 -0000 @@ -160,6 +160,17 @@ #endif // +// If STLport thinks there is no wchar_t at all, then we have to disable +// the support for the relevant specilazations of std:: templates. +// +#if !defined(_STLP_HAS_WCHAR_T) && !defined(_STLP_WCHAR_T_IS_USHORT) +# undef BOOST_NO_STD_WSTRING +# define BOOST_NO_STD_WSTRING +# undef BOOST_NO_STD_WSTREAMBUF +# define BOOST_NO_STD_WSTREAMBUF +#endif + +// // Borland ships a version of STLport with C++ Builder 6 that lacks // hashtables and the like: //
participants (5)
-
David Abrahams
-
Davlet Panech
-
Davlet Panech
-
John Maddock
-
Peter Dimov