Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Apr 2015 16:00:18 +0300
From:      Jan Beich <jbeich@FreeBSD.org>
To:        John Marino <marino@FreeBSD.org>
Cc:        svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, ports-committers@freebsd.org
Subject:   Re: svn commit: r383843 - head/games/megaglest
Message-ID:  <7fth-sdr1-wny@FreeBSD.org>
In-Reply-To: <201504120832.t3C8W2oh056956@svn.freebsd.org> (John Marino's message of "Sun, 12 Apr 2015 08:32:02 %2B0000 (UTC)")
References:  <201504120832.t3C8W2oh056956@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain

John Marino <marino@FreeBSD.org> writes:

>   Megaglest cannot be built under c++11 standard from the latest clang.
>   It catches a narrowing error.  The real solution is to fix the c++
>   code (it wasn't the only problem, but the first to trigger an error over
>   a warning).  The c++11 standard is required for wx, so it can't be
>   unspecified.  It turns out that gcc48 will not catch the error that clang
>   does so the temporary fix is to require gcc48 for all FreeBSD releases.
>   This may work for gcc49 as well, but it's likely that gcc5 will also
>   catch the bug and break.

CXXFLAGS += -Wno-c++11-narrowing ? GCC ignores unknown -Wno-foo.

Or maybe poke upstream if it has a fix:

#v+
Clang fix for tdefl_write_image_to_png_file_in_memory() from toffaletti

--- source/shared_lib/sources/miniz/miniz.c	(revision 56)
+++ source/shared_lib/sources/miniz/miniz.c	(revision 57)
@@ -2777,8 +2777,9 @@ void *tdefl_write_image_to_png_file_in_m
   // write real header
   *pLen_out = out_buf.m_size-41;
   {
+    static const mz_uint8 chans[] = {0x00, 0x00, 0x04, 0x02, 0x06};
     mz_uint8 pnghdr[41]={0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
-      0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,"\0\0\04\02\06"[num_chans],0,0,0,0,0,0,0,
+      0,0,(mz_uint8)(w>>8),(mz_uint8)w,0,0,(mz_uint8)(h>>8),(mz_uint8)h,8,chans[num_chans],0,0,0,0,0,0,0,
       (mz_uint8)(*pLen_out>>24),(mz_uint8)(*pLen_out>>16),(mz_uint8)(*pLen_out>>8),(mz_uint8)*pLen_out,0x49,0x44,0x41,0x54};
     c=(mz_uint32)mz_crc32(MZ_CRC32_INIT,pnghdr+12,17); for (i=0; i<4; ++i, c<<=8) ((mz_uint8*)(pnghdr+29))[i]=(mz_uint8)(c>>24);
     memcpy(out_buf.m_pBuf, pnghdr, 41);
#v-

[...]
> -USES=		cmake compiler:c++11-lib display:build dos2unix lua openal:al,alut pkgconfig tar:xz
> +# Clang catches a c++11 violation that older GCC misses, so until the
> +# code is fixed, remove USES+=compiler:c++11-lib and set USE_GCC=yes
> +USES=		cmake display:build dos2unix lua openal:al,alut pkgconfig \
> +		tar:xz
> +USE_GCC=	yes

Replace USE_GCC with USES=compiler:gcc-c++11-lib[1]. It's not safe to
link against libstdc++ on 10+ systems if any of the library dependencies
links against libc++.

  $ megaglest
  Segmentation fault

  $ ldd =megaglest | fgrep c++
          libstdc++.so.6 => /usr/local/lib/gcc49/libstdc++.so.6 (0x805092000)
          libc++.so.1 => /usr/local/lib/libc++.so.1 (0x8061f4000)

[1] Caveat1: may expose different subset of build and runtime errors
    Caveat2: relies on devel/libc++ and base libc++ being ABI compatible

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQF8BAEBCgBmBQJVKmxiXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXREQjQ0MzY3NEM3RDIzNTc4NkUxNDkyQ0VF
NEM3Nzg4MzQ3OURCRERCAAoJEOTHeINHnb3bJlIH/1HLlieHWhI7hzo+p5RJ8x+c
2Cg8MHyG5jVKq3S84uuLiPOgkHwpFlXgEuz+xCyqwlM2fx65YTaHRXfxdWeGZQeb
UlNoGvXG8cgLwhl4F/gEaqKNgckiWf9jBIqUq9YgE4Umpk9H8IumTF8Vb9dOm6SX
8vhUNoys67bbP0+pSE17RWoHVwVILUi26vlOC2oRhfgyjUwekMsJoN8A6Zj1dDEq
er8sS3HXt/chrlw4jSguMD3Sifw0VCyGLaD0dOZIHfT3N70VZKNHM0vJBcMxqhKW
lKd3ee71Jgrexp3QhBdrVK4Y6J2aS3J3G/VqLF1Q7nSSAYfKPuZ/GBUOO+l6ZPA=
=h3dT
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7fth-sdr1-wny>