ports/130065: devel/stlport update to 5.2.1 and problems

Vaclav Haisman v.haisman at sh.cvut.cz
Tue Dec 30 22:30:02 UTC 2008


>Number:         130065
>Category:       ports
>Synopsis:       devel/stlport update to 5.2.1 and problems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 30 22:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Vaclav Haisman
>Release:        6.3
>Organization:
SU SH
>Environment:
FreeBSD shell.sh.cvut.cz 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Fri Jan 18 17:04:16 CET 2008     root at shell.sh.cvut.cz:/usr/obj/usr/src/sys/SHELL-SMP  i386
>Description:
This is incomplete attempt to update devel/stlport port. I tried to update the port to 5.2.1 while also enabling the use of long double to avoid some compilation failures. It compiles but there are some test suite failures. Two of them are harmless and they are not related to long double support. The rest is related to what seems like a bug in either FreeBSD system headers or GCC 3.4.x that it uses (on 6.x). The analysis of the bugs follows:

--------------------------------------------------------------------------

./../../test/unit/cmath_test.cpp:143:
143       CPPUNIT_CHECK( are_equals(std::log(std::exp(1.0l)), 1.0l) );

This one is the typical rounding errors problem: The exp(1.0l) returns

(gdb) p x
$1 = 2.7182818284590452354281681079939403

and then it applies log() and tries to compare the result against the
1.0l using std::numeric_limits<long double>::epsilon() and it
obviously fails because of the precision issues:

(gdb) s are_equals<long double>
(val=0.99999999999999994681988343958600751, ref=1) at
./../../test/unit/math_aux.h:20

I think this one is pretty innocuous most of the time.


---------------------------------------------------------------------------


./../../test/unit/fstream_test.cpp(138) : CPPUNIT_ASSERT(in.fail());

This one is harmless too. On FreeBSD it is possible to open a
directory for reading as if it was just a plain file. I think this is
either a bug in the test or in STLport itself regarding the
assumptions of what can/cannot be opened for reading.

The raw dump of the /tmp directory looks like this:

shell::wilx:~/packed_vector> od -b /tmp |head
0000000   002 000 000 000 014 000 004 001 056 000 000 000 002 000 000 000

and the _M_static_buf member contains/points to the same data.

(gdb) frame 1
#1  0x080defa3 in FstreamTest::input (this=0x8475840) at ../../../test/unit/fstream_test.cpp:138
138           CPPUNIT_ASSERT( in.fail() );
(gdb) l
133       {
134         ifstream in("/tmp");
135         if (in.good()) {
136           string s;
137           getline(in, s);
138           CPPUNIT_ASSERT( in.fail() );
139         }
140       }
141     #endif
142     }
(gdb) p s

$4 =
{<stlpd_std::priv::__construct_checker<stlpd_std::priv::_NonDbg_str<char,
stlpd_std::char_traits<char>, stlpd_std::allocator<char> > >> = {<No
data fields>}, _M_non_dbg_impl =
{<stlpd_std::priv::_String_base<char,stlpd_std::allocator<char> >> =
{_M_buffers = {_M_end_of_storage = 0x8490080 "", _M_static_buf =
"\200\000I\b\f\000\004\001.\000\000\000\002\000\000"}, _M_finish =
0x849005b "", _M_start_of_storage = {<stlpd_std::allocator<char>> =
{<stlpd_std::__stlport_class<stlpd_std::allocator<char> >> = {<No data
fields>}, <No data fields>}, _M_data = 0x8490000 "\002"}}, static npos
= 4294967295}, _M_iter_list = {_M_node = {_M_owner = 0xbfbfe1a0,
_M_next = 0x0}, _M_lock = {<stlpd_std::_STLP_mutex_base> = {_M_lock =
0x848d500}, <No data fields>}}, static npos = 4294967295}


----------------------------------------------------------------------


All the rest of the test suite failures are related to what seems like
wrong values for std::numeric_limit<long double>. I am not sure what
to make of it. See the following values:

shell::wilx:~/packed_vector> echo | g++ -dD -E -  | sort | grep LDBL_MAX
#define __LDBL_MAX_10_EXP__ 4932
#define __LDBL_MAX_EXP__ 16384
#define __LDBL_MAX__ 1.1897314953572316e+4932L
shell::wilx:~/packed_vector> fgrep -rn LDBL_MAX /usr/include
/usr/include/c++/3.4/limits:1086:      { return __LDBL_MAX__; }
/usr/include/c++/3.4/limits:1101:      static const int max_exponent = __LDBL_MAX_EXP__;
/usr/include/c++/3.4/limits:1102:      static const int max_exponent10 = __LDBL_MAX_10_EXP__;
/usr/include/machine/float.h:75:#define LDBL_MAX_EXP    16384
/usr/include/machine/float.h:76:#define LDBL_MAX        1.1897314953572317650E+4932L
/usr/include/machine/float.h:77:#define LDBL_MAX_10_EXP 4932
/usr/include/float.h:75:#define LDBL_MAX_EXP    16384
/usr/include/float.h:76:#define LDBL_MAX        1.1897314953572317650E+4932L
/usr/include/float.h:77:#define LDBL_MAX_10_EXP 4932

Notice the difference in definition of LDBL_MAX, the values in system headers are tiny bit larger than that defined by GCC itself.

machine/float.h:76:#define LDBL_MAX        1.1897314953572317650E+4932L
float.h:76:#define LDBL_MAX                1.1897314953572317650E+4932L
GCC: __LDBL_MAX__                          1.1897314953572316e+4932L

A simple test shows the following:

shell::wilx:~/tmp> cat >longdouble.cxx
#include <iostream>
#include <limits>
#include <cfloat>

int
main ()
{
  typedef std::numeric_limits<long double> limits;
  std::cout << "max: " << limits::max () << "\n";
  std::cout << "__LDBL_MAX__: " << __LDBL_MAX__ << "\n";
  std::cout << "LDBL_MAX: " << LDBL_MAX << "\n";
}
shell::wilx:~/tmp> g++ -o longdouble longdouble.cxx
shell::wilx:~/tmp> ./longdouble
max: 1.18973e+4932
__LDBL_MAX__: 1.18973e+4932
LDBL_MAX: inf

This is on 6.3/i386. 7.1/AMD64 does not print inf for LDBL_MAX. I
think this is a bug in 6.x headers or in GCC 3.4.x that it
uses. Either way, this is probably a show stopper for long double
support in STLport port.

-----------------------------------------------------------------------


I hope all this will be useful to somebody more motivated than I am who could update the port :)

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
RCS file: /home/services/cvsupin/ncvs/ports/devel/stlport/Makefile,v
retrieving revision 1.49
diff -u -p -d -r1.49 Makefile
--- Makefile	31 Jul 2008 18:34:23 -0000	1.49
+++ Makefile	30 Dec 2008 22:14:16 -0000
@@ -7,7 +7,7 @@
 #
 
 PORTNAME=	stlport
-PORTVERSION=	5.1.5
+PORTVERSION=	5.2.1
 PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	SF
@@ -21,6 +21,7 @@ USE_BZIP2=	yes
 
 WRKSRC=		${WRKDIR}/STLport-${PORTVERSION:S/.b/b/}/build/lib
 PATCH_WRKSRC=	${WRKDIR}/STLport-${PORTVERSION:S/.b/b/}
+CONFIGURE_WRKSRC= ${WRKDIR}/STLport-${PORTVERSION:S/.b/b/}
 USE_GMAKE=	yes
 COMPILER?=	gcc
 MAKEFILE=	${COMPILER}.mak
@@ -30,6 +31,10 @@ MAKE_ARGS+=	INSTALLDIR=${PREFIX} PTHREAD
 PLIST_SUB+=	COMPILER=${COMPILER} VER=${PORTVERSION} V2=${PORTVERSION:R}	\
 		V1=${PORTVERSION:R:R}
 
+# Reset CPUTYPE because it fucks up somewhere in makefile leaving bare
+# e.g. "pentium4" string on command line of C compiler if specified as
+# p4. This is probably STLport's make files problem.
+CPUTYPE=
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-lib-motif=${COMPILER}
 USE_LDCONFIG=	yes
@@ -55,10 +60,12 @@ EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-
 .endif
 
 .if defined(WITH_BOOST_SUPPORT)
+BROKEN= STLport 5.2.1 does not work with Boost 1.34 anymore.
 EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-boost-support-user_config.h.diff
 MAKE_ENV+= STLP_BUILD_BOOST_PATH=${LOCALBASE}/include
 BUILD_DEPENDS+= ${LOCALBASE}/include/boost/config/stdlib/stlport.hpp:${PORTSDIR}/devel/boost
 RUN_DEPENDS+= ${LOCALBASE}/include/boost/config/stdlib/stlport.hpp:${PORTSDIR}/devel/boost
+CONFIGURE_ARGS+= --with-boost=${LOCALBASE}/include
 .endif
 
 pre-configure:
Index: distinfo
===================================================================
RCS file: /home/services/cvsupin/ncvs/ports/devel/stlport/distinfo,v
retrieving revision 1.10
diff -u -p -d -r1.10 distinfo
--- distinfo	20 Jul 2008 14:19:26 -0000	1.10
+++ distinfo	27 Dec 2008 20:29:27 -0000
@@ -1,3 +1,6 @@
 MD5 (STLport-5.1.5.tar.bz2) = e31d0dc9141c4f264d887754b559cc84
 SHA256 (STLport-5.1.5.tar.bz2) = 2470ca40adc89750c69affffde8a9e6ab6a03f4e3c93640067089f99e76f6dc5
 SIZE (STLport-5.1.5.tar.bz2) = 682914
+MD5 (STLport-5.2.1.tar.bz2) = a8341363e44d9d06a60e03215b38ddde
+SHA256 (STLport-5.2.1.tar.bz2) = 755b007b982c4545086c43affc8ed32c0acd577ee206eb1f6967e250c3546fc9
+SIZE (STLport-5.2.1.tar.bz2) = 717202
Index: files/extra-patch-boost-support-user_config.h.diff
===================================================================
RCS file: /home/services/cvsupin/ncvs/ports/devel/stlport/files/extra-patch-boost-support-user_config.h.diff,v
retrieving revision 1.1
diff -u -p -d -r1.1 extra-patch-boost-support-user_config.h.diff
--- files/extra-patch-boost-support-user_config.h.diff	31 Jul 2008 18:34:24 -0000	1.1
+++ files/extra-patch-boost-support-user_config.h.diff	27 Dec 2008 20:35:37 -0000
@@ -1,14 +1,14 @@
---- stlport/stl/config/user_config.h	2008-07-30 22:57:38.719239317 +0200
-+++ stlport/stl/config/user_config.h	2008-07-30 22:58:06.413639084 +0200
-@@ -298,9 +298,9 @@
-  * to use this feature at STLport built time you will have to define the
+--- stlport/stl/config/user_config.h.orig	2008-12-27 21:32:57.396537324 +0100
++++ stlport/stl/config/user_config.h	2008-12-27 21:35:26.449442901 +0100
+@@ -312,9 +312,9 @@
   * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path.
   */
+ 
 -/*
 +
  #define _STLP_USE_BOOST_SUPPORT 1
 -*/
 +
  
- /*==========================================================*/
  
+ /*==========================================================*/
Index: files/extra-patch-no-short-string-optim-user_config.h.diff
===================================================================
RCS file: /home/services/cvsupin/ncvs/ports/devel/stlport/files/extra-patch-no-short-string-optim-user_config.h.diff,v
retrieving revision 1.1
diff -u -p -d -r1.1 extra-patch-no-short-string-optim-user_config.h.diff
--- files/extra-patch-no-short-string-optim-user_config.h.diff	23 Dec 2007 17:00:36 -0000	1.1
+++ files/extra-patch-no-short-string-optim-user_config.h.diff	27 Dec 2008 20:33:48 -0000
@@ -1,6 +1,6 @@
---- stlport/stl/config/user_config.h	Sun Dec  2 19:53:27 2007
-+++ stlport/stl/config/user_config.h	Sun Dec  2 19:55:33 2007
-@@ -273,9 +273,9 @@
+--- stlport/stl/config/user_config.h.orig	2008-12-27 21:32:57.396537324 +0100
++++ stlport/stl/config/user_config.h	2008-12-27 21:33:03.072468332 +0100
+@@ -279,9 +279,9 @@
   * prefer systematical dynamic allocation turn on this macro.
   * STLport rebuild: Yes
   */
Index: files/extra-patch-ptr_spec-user_config.h.diff
===================================================================
RCS file: /home/services/cvsupin/ncvs/ports/devel/stlport/files/extra-patch-ptr_spec-user_config.h.diff,v
retrieving revision 1.1
diff -u -p -d -r1.1 extra-patch-ptr_spec-user_config.h.diff
--- files/extra-patch-ptr_spec-user_config.h.diff	23 Dec 2007 17:00:36 -0000	1.1
+++ files/extra-patch-ptr_spec-user_config.h.diff	27 Dec 2008 20:35:16 -0000
@@ -1,8 +1,8 @@
---- stlport/stl/config/user_config.h	Sun Dec  2 19:53:27 2007
-+++ stlport/stl/config/user_config.h	Sun Dec  2 19:53:41 2007
-@@ -285,9 +285,9 @@
-  * but after link phase and optimization you will only experiment benefit if you use
-  * many container with pointer types.
+--- stlport/stl/config/user_config.h.orig	2008-12-27 21:32:57.396537324 +0100
++++ stlport/stl/config/user_config.h	2008-12-27 21:35:06.017238519 +0100
+@@ -298,9 +298,9 @@
+  *   - you won't be able to use complex Standard allocator implementations which are
+  *     allocators having pointer nested type not being a real C pointer.
   */
 -/*
 +
Index: files/extra-patch-templ-expr-user_config.h.diff
===================================================================
RCS file: /home/services/cvsupin/ncvs/ports/devel/stlport/files/extra-patch-templ-expr-user_config.h.diff,v
retrieving revision 1.1
diff -u -p -d -r1.1 extra-patch-templ-expr-user_config.h.diff
--- files/extra-patch-templ-expr-user_config.h.diff	23 Dec 2007 17:00:36 -0000	1.1
+++ files/extra-patch-templ-expr-user_config.h.diff	27 Dec 2008 20:34:45 -0000
@@ -1,7 +1,7 @@
---- stlport/stl/config/user_config.h	Sun Dec  2 19:53:27 2007
-+++ stlport/stl/config/user_config.h	Sun Dec  2 19:56:17 2007
-@@ -261,9 +261,9 @@
-  * The drawback can be longer compilation time and bigger executable size.
+--- stlport/stl/config/user_config.h.orig	2008-12-27 21:32:57.396537324 +0100
++++ stlport/stl/config/user_config.h	2008-12-27 21:34:11.211305351 +0100
+@@ -266,9 +266,9 @@
+  * if do with class derived from string (see unit tests for details).
   * STLport rebuild: Yes
   */
 -/*
@@ -10,5 +10,5 @@
 -*/
 +
  
+ 
  /*
-  * By default the STLport basic_string implementation use a little static buffer
Index: files/patch-src_num_get_float.cpp
===================================================================
RCS file: files/patch-src_num_get_float.cpp
diff -N files/patch-src_num_get_float.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-src_num_get_float.cpp	27 Dec 2008 22:02:32 -0000
@@ -0,0 +1,42 @@
+--- src/num_get_float.cpp.orig	2008-12-10 10:56:51.000000000 +0100
++++ src/num_get_float.cpp	2008-12-27 23:02:08.431450984 +0100
+@@ -28,7 +28,8 @@
+ #endif
+ 
+ #if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+-    defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
++    defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC) || \
++    defined (__FreeBSD__)
+ 
+ #  if defined (__BORLANDC__)
+ typedef unsigned int uint32_t;
+@@ -476,7 +477,8 @@ static double _Stl_atod(char *buffer, pt
+ #endif
+ 
+ #if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+-    defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
++    defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC) || \
++    defined (__FreeBSD__)
+ 
+ template <class D, class IEEE, int M, int BIAS>
+ D _Stl_atodT(char *buffer, ptrdiff_t ndigit, int dexp)
+@@ -742,7 +744,8 @@ static double _Stl_string_to_double(cons
+ #endif
+ 
+ #if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \
+-    defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC)
++    defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC) || \
++    defined (__FreeBSD__)
+ 
+ template <class D, class IEEE, int M, int BIAS>
+ D _Stl_string_to_doubleT(const char *s)
+@@ -865,7 +868,8 @@ __string_to_float(const __iostring& v, d
+ void _STLP_CALL
+ __string_to_float(const __iostring& v, long double& val) {
+ #if !defined (__linux__) && !defined (__MINGW32__) && !defined (__CYGWIN__) && \
+-    !defined (__BORLANDC__) && !defined (__DMC__) && !defined (__HP_aCC)
++    !defined (__BORLANDC__) && !defined (__DMC__) && !defined (__HP_aCC) && \
++    !defined (__FreeBSD__)
+   //The following function is valid only if long double is an alias for double.
+   _STLP_STATIC_ASSERT( sizeof(long double) <= sizeof(double) )
+   val = _Stl_string_to_double(v.c_str());
Index: files/patch-stlport_stl__gcc.h
===================================================================
RCS file: files/patch-stlport_stl__gcc.h
diff -N files/patch-stlport_stl__gcc.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-stlport_stl__gcc.h	27 Dec 2008 22:29:57 -0000
@@ -0,0 +1,36 @@
+--- stlport/stl/config/_gcc.h.orig	2008-12-10 10:56:51.000000000 +0100
++++ stlport/stl/config/_gcc.h	2008-12-27 23:28:34.672362493 +0100
+@@ -90,7 +90,7 @@
+ #endif
+ 
+ #if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__))
+-#  if !defined (__MINGW32__) && !defined (__CYGWIN__)
++#  if !defined (__MINGW32__) && !defined (__CYGWIN__) && !defined (__FreeBSD__)
+ #    define _STLP_NO_NATIVE_MBSTATE_T    1
+ #  endif
+ #  if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
+@@ -131,7 +131,7 @@ typedef unsigned int wint_t;
+ #  define _STLP_NO_LONG_DOUBLE
+ #endif
+ 
+-#if defined (__OpenBSD__) || defined (__FreeBSD__)
++#if defined (__OpenBSD__)
+ #  define _STLP_NO_VENDOR_MATH_L
+ #  define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
+ #  ifndef __unix
+@@ -139,6 +139,15 @@ typedef unsigned int wint_t;
+ #  endif
+ #endif
+ 
++#if defined (__FreeBSD__)
++#  define _STLP_NO_VENDOR_MATH_L
++#  define _STLP_NO_VENDOR_STDLIB_L /* no llabs */
++#  define _STLP_VENDOR_LONG_DOUBLE_MATH  1
++#  ifndef __unix
++#    define __unix
++#  endif
++#endif
++
+ #if defined (__alpha__)
+ #  define _STLP_NO_VENDOR_MATH_L
+ #endif
Index: files/patch-stlport_stl__mbstate_t.h
===================================================================
RCS file: files/patch-stlport_stl__mbstate_t.h
diff -N files/patch-stlport_stl__mbstate_t.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-stlport_stl__mbstate_t.h	27 Dec 2008 22:13:01 -0000
@@ -0,0 +1,11 @@
+--- stlport/stl/_mbstate_t.h.orig	2008-12-27 23:11:29.384988402 +0100
++++ stlport/stl/_mbstate_t.h	2008-12-27 23:11:41.421022569 +0100
+@@ -16,7 +16,7 @@
+ #ifndef _STLP_INTERNAL_MBSTATE_T
+ #define _STLP_INTERNAL_MBSTATE_T
+ 
+-#if (defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__hpux)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
++#if (defined (__OpenBSD__) || defined (__hpux)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T)
+ #  define _STLP_CPP_MBSTATE_T /* mbstate_t defined in native <cwchar>, so not defined in C! */
+ #endif
+ 
Index: files/patch-stlport_stl_config_features.h
===================================================================
RCS file: files/patch-stlport_stl_config_features.h
diff -N files/patch-stlport_stl_config_features.h
--- files/patch-stlport_stl_config_features.h	23 Dec 2007 17:00:36 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
---- ./stlport/stl/config/features.h.orig	2007-08-18 22:45:42.000000000 +0200
-+++ ./stlport/stl/config/features.h	2007-12-23 11:18:22.000000000 +0100
-@@ -218,7 +218,7 @@
- #endif
- 
- /* Operating system recognition (basic) */
--#if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX)  || defined (__NetBSD__) || defined(__OpenBSD__) || defined (__Lynx__)
-+#if defined (__unix) || defined (__linux__) || defined (__QNX__) || defined (_AIX)  || defined (__NetBSD__) || defined(__OpenBSD__) || defined (__Lynx__) || defined(__FreeBSD__)
- #  define _STLP_UNIX 1
- #elif defined(macintosh) || defined (_MAC)
- #  define _STLP_MAC  1
-@@ -305,6 +305,7 @@
- #endif
- 
- #if (defined (_REENTRANT) || defined (_THREAD_SAFE) || \
-+    (defined (_POSIX_THREADS) && defined (__FreeBSD__)) && \
-     (defined (_POSIX_THREADS) && defined (__OpenBSD__))) && \
-     !defined (_STLP_THREADS)
- #  define _STLP_THREADS


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list