Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Apr 2009 16:16:02 +0200 (CEST)
From:      Oliver Lehmann <lehmann@ans-netz.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/133487: endianess detection wrong in devel/boost
Message-ID:  <200904081416.n38EG2bV001894@kartoffel.salatschuessel.net>
Resent-Message-ID: <200904081420.n38EK14K001850@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         133487
>Category:       ports
>Synopsis:       endianess detection wrong in devel/boost
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 08 14:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Lehmann
>Release:        FreeBSD 7.1-STABLE amd64
>Organization:
>Environment:
System: FreeBSD kartoffel.salatschuessel.net 7.1-STABLE FreeBSD 7.1-STABLE #0: Sun Mar 8 02:58:44 CET 2009 olivleh1@kartoffel.salatschuessel.net:/usr/obj/usr/src/sys/KARTOFFEL amd64


>Description:
	The endianess detection in boost/detail/endian.hpp is not working for
        FreeBSD because on FreeBSD _BIG_ENDIAN and _LITTLE_ENDIAN is defined all the
        time.
	If _GLIBC_ is not defined, the hpp file checks first if _BIG_ENDIAN is defined
	and this is the case the endianess for boost is set to BIG_ENDIAN and the check
	ends.

	The hpp file should check if _BYTE_ORDER is defined for FreeBSD and how it is
	defined (See Fix section)

>How-To-Repeat:
	create the following C file:

        #include <stdio.h>
        #include <machine/endian.h>
        #include <boost/detail/endian.hpp>

        int main() { printf("%d\n",BOOST_BYTE_ORDER); }

	and compile it with cc -I/usr/local/include cfile

	Execute now a.out and you'll get always 4321
>Fix:

--- ./boost/detail/endian.hpp.orig      2009-04-08 16:12:11.000000000 +0200
+++ ./boost/detail/endian.hpp   2009-04-08 16:13:28.000000000 +0200
@@ -42,6 +42,18 @@
 #  error Unknown machine endianness detected.
 # endif
 # define BOOST_BYTE_ORDER __BYTE_ORDER
+#elif defined (__FreeBSD__)
+# include <machine/endian.h>
+# if (_BYTE_ORDER == _LITTLE_ENDIAN)
+#  define BOOST_LITTLE_ENDIAN
+# elif (_BYTE_ORDER == _BIG_ENDIAN)
+#  define BOOST_BIG_ENDIAN
+# elif (_BYTE_ORDER == _PDP_ENDIAN)
+#  define BOOST_PDP_ENDIAN
+# else
+#  error Unknown machine endianness detected.
+# endif
+# define BOOST_BYTE_ORDER _BYTE_ORDER
 #elif defined(_BIG_ENDIAN)
 # define BOOST_BIG_ENDIAN
 # define BOOST_BYTE_ORDER 4321



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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904081416.n38EG2bV001894>