svn commit: r383843 - head/games/megaglest

Jan Beich jbeich at FreeBSD.org
Sun Apr 12 17:15:22 UTC 2015


John Marino <marino at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 602 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-ports-all/attachments/20150412/9abaf763/attachment.sig>


More information about the svn-ports-all mailing list