Workaround for clang-linux + GNU stdlib + Boost.Iostreams

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 There's a discrepancy in the definition of wint_t between GCC and some later versions of clang (clang defines it as an int, GCC an unsigned int). This ends breaking Boost.Iostreams with a GNU GCC compiled version of the GNU stdlib and clang (I'll restrain myself from giving the lengthy technical explaination - if you have link-time errors with clang + GCC compiled stdlib + Boost.Iostreams, this is probably the issue). Unfortunately, I cannot patch this issue with a workaround in Boost easily. The right combination of clang flags can work around this by not using the clang intrinsic/builtin headers, but this has a good chance of causing other problems. The simplest solution here is to rebuild clang (building the GNU stdlib with clang is tricky at best). I think newer version of the mainstream clang trunk may have fixed this, but if not, you need to change the assignment to WIntType in the clang::TargetInfo ctor ($CLANG_ROOT/lib/Basic/TargetInfo.cpp, line 40-50ish). It should be UnsignedInt. You also need to hack $CLANG_ROOT/lib/Headers/stdint.h, around 630 - the macro definition of WINT_MIN and WINT_MAX need to be changed to: #define WINT_MIN 0u #define WINT_MAX __UINTN_MAX(__WINT_WIDTH__) If you'd rather not recompile clang, you can try hacking your clang intrinsic headers (not advisable, might break more stuff). Find the resource/intrinsic header directory (usually something like /usr/local/clang/2.9/include/), and make the change specified above to the stdint.h header there. In the stddef.h header, around like 60, you can change the wint_t typedef. - -- Bryce Lelbach aka wash boost-spirit.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAk0fnjQACgkQO/fqqIuE2t7NVQCgowl7TqnCRgWyjRGN+/u3fh2R NywAoK59zWsZiB7vVvtKU0IehHiMIVdz =COrS -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Now that the clang-linux tester is back online, I realized this is a pretty widespread issue. A fix for this on x86 (32bit and 64bit) will be in Boost trunk. <boost/detail/wint_t.hpp> and boost::wint_t should be used for maximum portability. If not on clang + linux + gnu stdlib + x86, boost::wint_t is typedef'd to std::wint_t (Boost.Config ensures std::wint_t is in the std namespace). On Mon, 03 Jan 2011 11:25:34 +0100 Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote:
- -- Bryce Lelbach aka wash boost-spirit.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAk0o2vUACgkQ9cB/V3/s9ExBswCfSehuSIMc/3yQoPcy5Vt9GTlf IV4Anj65YwDTUBOkbxdE7NC972XHeLJo =LWGz -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 My attempts to patch this on the Boost end of things didn't go so well. I have filed a bug report on this now: http://llvm.org/bugs/show_bug.cgi?id=8938 - -- Bryce Lelbach aka wash boost-spirit.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAk0pCEcACgkQ9cB/V3/s9EyCzgCdHFbak1pIhbiHCP/YiF/sqTXP +iMAn1nuYdeAwvfN8yVfoisR39mB0Czs =UN+8 -----END PGP SIGNATURE-----

Hi, On Monday, 3. January 2011 20:32:28 Doug Gregor wrote:
Is there a corresponding Clang bug?
I talked to Bruce on IRC and he said he would file one and mail. Seems he had no time for it (yet). Meanwhile, please find a patch based on his original mail attached (including patched tests ;-) ) Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !
participants (4)
-
Bryce Lelbach
-
Doug Gregor
-
Jürgen Hunold
-
Mathias Gaunard