Bug 133487 - endianess detection wrong in devel/boost
Summary: endianess detection wrong in devel/boost
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Li-Wen Hsu
Depends on:
Reported: 2009-04-08 15:20 UTC by Oliver Lehmann
Modified: 2009-05-12 11:40 UTC (History)
0 users

See Also:

file.diff (706 bytes, patch)
2009-04-08 15:20 UTC, Oliver Lehmann
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Lehmann 2009-04-08 15:20:01 UTC
	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
	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

	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
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2009-04-08 15:20:11 UTC
Maintainer of devel/boost,

Please note that PR ports/133487 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:

Edwin Groothuis via the GNATS Auto Assign Tool
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2009-04-08 15:20:13 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Alexander Churanov 2009-04-27 14:19:21 UTC
Suggest applying this patch and keeping it until updating to boost-1.38.

The root cause of the issue is boost matching endianess using method
of GNU libc, which is not compatible with the way BSDs define
endianess. They've fixed this in 1.38 by applying a patch from NetBSD.
See https://svn.boost.org/trac/boost/ticket/1922 for details.

Future directions:
The fix applied in 1.38 is to match against CPU architecture if
matching using GNU method fails. This may re-introduce bugs for
platforms, not specifically listed in boost header file. Suggest
proposing the patch, attached to this issue, for permanent inclusion
into boost libraries.

Alexander Churanov,
maintainer of devel/boost
Comment 4 Li-Wen Hsu freebsd_committer freebsd_triage 2009-05-11 21:15:40 UTC
Responsible Changed
From-To: freebsd-ports-bugs->lwhsu

I'll take it.
Comment 5 Li-Wen Hsu freebsd_committer freebsd_triage 2009-05-12 11:36:33 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 6 dfilter service freebsd_committer freebsd_triage 2009-05-12 11:36:37 UTC
lwhsu       2009-05-12 10:36:22 UTC

  FreeBSD ports repository

  Modified files:
    devel/boost          Makefile 
  Added files:
    devel/boost/files    patch-boost__detail__endian.hpp 
  - Add a patch to fix endianess detection
  PR:             ports/133487
  Submitted by:   Oliver Lehmann <lehmann AT ans-netz.de>
  Approved by:    Alexander Churanov <alexanderchuranov AT gmail.com> (maintainer)
  Revision  Changes    Path
  1.45      +1 -0      ports/devel/boost/Makefile
  1.1       +21 -0     ports/devel/boost/files/patch-boost__detail__endian.hpp (new)
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"