Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 592442

Summary: x11-libs/wxGTK-2.8.12.1-r2: building w/gcc-6: error: narrowing conversion of '128' from 'int' to 'char' inside { } [-Wnarrowing]
Product: Gentoo Linux Reporter: Francesco Turco <fturco>
Component: Current packagesAssignee: Gentoo wxWidgets project <wxwidgets>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=632144
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 582084    
Attachments: emerge --info
build log for wxGTK-2.8.12.1-r2 using gcc-6.2.0
wxGTK-2.8.12.1-r2-gcc6.patch

Description Francesco Turco 2016-08-30 15:45:10 UTC
Created attachment 444446 [details]
emerge --info

After having upgraded to gcc-6.2.0 I can't build x11-libs/wxGTK-2.8.12.1-r2 anymore.

Error snippet:

> In file included from /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r2/work/wxPython-src-2.8.12.1/src/gtk/dcclient.cpp:46:0:
> /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r2/work/wxPython-src-2.8.12.1/src/gtk/bdiag.xbm: At global scope:
> /var/tmp/portage/x11-libs/wxGTK-2.8.12.1-r2/work/wxPython-src-2.8.12.1/src/gtk/bdiag.xbm:6:50: error: narrowing conversion of '128' from 'int' to 'char' inside { } [-Wnarrowing]
>    0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01};
>                                                  ^

I can build wxGTK just fine with gcc-5.4.0.

-------------

# emerge -pv =x11-libs/wxGTK-2.8.12.1-r2

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] x11-libs/wxGTK-2.8.12.1-r2:2.8::gentoo  USE="X gnome gstreamer opengl sdl tiff (-aqua) -debug -doc -odbc -pch" ABI_X86="(64) -32 (-x32)" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
Comment 1 Francesco Turco 2016-08-30 15:47:04 UTC
Created attachment 444448 [details]
build log for wxGTK-2.8.12.1-r2 using gcc-6.2.0
Comment 2 Denis Kaganovich 2016-08-31 12:22:00 UTC
Unlike wxGTK-3, this is solved for me by global "-w". I add to make.conf:
CXXFLAGS="$CXXFLAGS -fpermissive -fno-strict-aliasing -w"

PS Global "-w" for CFLAGS mostly good, but some random packages builds broken.
Comment 3 Francesco Turco 2016-08-31 22:01:16 UTC
Created attachment 444672 [details, diff]
wxGTK-2.8.12.1-r2-gcc6.patch
Comment 4 Mart Raudsepp gentoo-dev 2016-09-16 17:29:57 UTC
Soap found https://github.com/wxWidgets/wxWidgets/commit/1780a38b7bc9a9c04d33775a3176fe8516465f50 done to 3.0, which does some churn to .cpp too, as gdk-pixbuf is taking a gchar (and it's C and doesn't care of this signedness really) and would instead warn there if the proper fix of converting to unsigned char or uint8_t is used.
So I think given this is old 2.8, backporting upstream patch would change some of the .cpp too, and many other places have received just a cast to char as well, this char casting is ACK for 2.8.
Comment 5 David Seifert gentoo-dev 2016-09-16 22:26:56 UTC
commit b98cf3b8e69fc19e26600992a236e99d175da5dc
Author: David Seifert <soap@gentoo.org>
Date:   Fri Sep 16 23:48:11 2016 +0200

    x11-libs/wxGTK: Allow for compiling with GCC 6
    
    Gentoo-bug: 592442
    * Patch by Francesco Turco