Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 135346 - VisualBoyAdvance 1.7.2/-r1 won't build with GCC 4.1.1
Summary: VisualBoyAdvance 1.7.2/-r1 won't build with GCC 4.1.1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 117482
  Show dependency tree
 
Reported: 2006-06-02 21:59 UTC by Andre Ryan
Modified: 2006-10-13 10:12 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Quick build fix (VBA_amd64.patch,1.41 KB, patch)
2006-06-02 22:07 UTC, Andre Ryan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Ryan 2006-06-02 21:59:44 UTC
The emerge fails on src/prof/prof.cpp and src/sdl/debugger.cpp when building with GCC 4.1.1. Both files contain casts from pointers to u32, on amd64 the pointers are, of course, 64bit and gcc throws an "error: cast from 'char*' to 'u32' loses precision".

Portage 2.0.54-r2 (default-linux/amd64/2006.0, gcc-4.1.1, glibc-2.3.6-r3, 2.6.16-gentoo-r7 x86_64)
=================================================================
System uname: 2.6.16-gentoo-r7 x86_64 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.6.14
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.4.2
dev-python/pycrypto: [Not Present]
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -march=k8 -mmmx -msse -msse2 -m3dnow -pipe -fomit-frame-pointer -mfpmath=sse -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts -ftree-vectorize -ftracer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=k8 -mmmx -msse -msse2 -m3dnow -pipe -fomit-frame-pointer -mfpmath=sse -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts -ftree-vectorize -ftracer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks nostrip sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.isp.net.au/ftp/pub/gentoo/ http://adelie.polymtl.ca/ ftp://ftp.swin.edu.au/gentoo http://gentoo.osuosl.org/ http://www.gtlib.gatech.edu/pub/gentoo http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://gentoo.arcticnetwork.ca/ ftp://mirror.isp.net.au/pub/gentoo/ ftp://ftp.planetmirror.com/pub/gentoo/ http://ftp.swin.edu.au/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.au.gentoo.org/gentoo-portage"
USE="amd64 X a52 aac aalib acl acpi alsa apache2 arts audiofile avi berkdb bitmap-fonts bzip2 cairo cdr cli crypt cscope cups curl directfb dri dvd dvdr eds emboss encode esd exif expat fam fbcon ffmpeg flac flash foomaticdb ftp gd gecko-sdk gif glut gmp gpm gstreamer gtk gtk2 iconv idn ieee1394 imagemagick imlib innodb ipv6 java javascript jpeg jpeg2k kde kdeenablefinal kdehiddenvisibility lcms lzw lzw-tiff mad matroska mhash mime ming mng mp3 mpeg mplayer mpm-prefork msn mysql mysqli ncurses nls nptl nsplugin nvidia objc objc++ offensive ogg openal opengl pam pcre pdf pdflib perl php png python qt quicktime readline recode reflection ruby samba sdl session sharedext sharedmem spell spl ssl subversion svg symlink tcpd tidy tiff truetype truetype-fonts type1-fonts udev unicode usb utf8 vcd visualization vorbis wmf xine xml xml2 xorg xpm xsl xv xvid zlib video_cards_nvidia input_devices_keyboard input_devices_mouse input_devices_joystick userland_GNU kernel_linux elibc_glibc"
Unset:  CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS, PORTAGE_RSYNC_OPTS
Comment 1 Andre Ryan 2006-06-02 22:07:01 UTC
Created attachment 88226 [details, diff]
Quick build fix

This is a quick hack I wrote to get it to build, I just cast the pointer to intptr_t then truncate that to u32. There is potentially a crash condition if more than 4GB virtual memory is used, but that condition was likely always present, just GCC didn't complain about it before.
Comment 2 Reimar Döffinger 2006-08-20 03:10:27 UTC
The compilation errors can be avoided more easily by add -fpermissive to you CXXFLAGS.
Also the code in debugger.cpp, although ugly, should be correct.
Neither is the one in prof.cpp a real problem, since selfpc was assigned for an u32, thus casting it back again can't overflow.
Comment 3 Chris Gianelloni (RETIRED) gentoo-dev 2006-08-23 16:40:57 UTC
So what's the best approach without changing CXXFLAGS?
Comment 4 Andre Ryan 2006-08-26 23:52:20 UTC
(In reply to comment #3)
> So what's the best approach without changing CXXFLAGS?

The -fpermissive flag does work, the patch and flag are essentially equivalent solutions although the patch doesn't doesn't have the risk of knock-on effects from a package wide flag change.

I've been using the patch for a while and haven't encountered any segfaults so I believe it's stable enough, at least until another release that fixes the problem.
Comment 5 Chris Gianelloni (RETIRED) gentoo-dev 2006-10-13 10:12:10 UTC
Added to CVS... thanks for the patch!