Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 277654 - sci-libs/gdal-1.6.0-r1 fails to compile because of wrong number of parameter for macros min/max
Summary: sci-libs/gdal-1.6.0-r1 fails to compile because of wrong number of parameter ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Sci-geo Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-13 13:32 UTC by Juergen Rose
Modified: 2010-10-05 18:06 UTC (History)
3 users (show)

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


Attachments
Change order of includes in gdal (gentoo277654a.patch,928 bytes, patch)
2009-07-30 08:27 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Rose 2009-07-13 13:32:43 UTC
'emerge gdal' fails to emerge, with:
...
x86_64-pc-linux-gnu-g++ -O2 -pipe -fPIC  -Wall  -I.. -I../.. -I/var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/port -I/var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/gcore -I/var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/alg -I/var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/ogr -I/var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/ogr/ogrsf_frmts -I/usr/include/mysql -DOGR_ENABLED -I/var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/port  -c -o ../o/ogrmysqldriver.o ogrmysqldriver.cpp
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/char_traits.h:46,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/string:47,
                 from /var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/port/cpl_string.h:169,
                 from ../../ogr_featurestyle.h:34,
                 from ../../ogr_feature.h:34,
                 from ../ogrsf_frmts.h:33,
                 from ogr_mysql.h:41,
                 from ogrmysqldriver.cpp:30:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/stl_algobase.h:232:56: error: macro "min" passed 3 arguments, but takes just 2
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/stl_algobase.h:252:56: error: macro "max" passed 3 arguments, but takes just 2
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/char_traits.h:46,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/string:47,
                 from /var/tmp/portage/sci-libs/gdal-1.6.0-r1/work/gdal-1.6.0/port/cpl_string.h:169,
                 from ../../ogr_featurestyle.h:34,
                 from ../../ogr_feature.h:34,
                 from ../ogrsf_frmts.h:33,
                 from ogr_mysql.h:41,
                 from ogrmysqldriver.cpp:30:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/stl_algobase.h:188: error: expected unqualified-id before 'const'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/stl_algobase.h:188: error: expected `)' before 'const'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/stl_algobase.h:188: error: expected `)' before 'const'
...
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/stl_algobase.h:904: error: expected unqualified-id before '(' token
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/string:58,
...
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/basic_string.tcc: In member function 'typename std::basic_string<_CharT, _Traits, _Alloc>::size_type std::basic_string<_CharT, _Traits, _Alloc>::rfind(const _CharT*, typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type) const':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/basic_string.tcc:759: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/basic_string.tcc: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&) const':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/basic_string.tcc:896: error: expected unqualified-id before '(' token
...
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include/g++-v4/bits/basic_string.tcc:961: error: expected unqualified-id before '(' token
make[3]: *** [../o/ogrmysqldriver.o] Error 1


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
...



root@lynx:/root(7)# emerge --info
Portage 2.1.6.13 (default/linux/amd64/2008.0/desktop, gcc-4.3.3, glibc-2.10.1-r0, 2.6.30-gentoo-r2 x86_64)
=================================================================
System uname: Linux-2.6.30-gentoo-r2-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T8300_@_2.40GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 13 Jul 2009 05:00:01 +0000
app-shells/bash:     4.0_p24
dev-java/java-config: 2.1.8-r1
dev-lang/python:     2.6.2-r1
dev-python/pycrypto: 2.0.1-r8
dev-util/cmake:      2.6.4
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    2.0
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
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/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/g
entoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandb
ox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
FFLAGS="-march=nocona -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS="-Wl,-O1"
LINGUAS="de fr"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --excl
ude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/n4g /usr/local/portage/layman/dotnet /usr/local/portage/layman/science /usr/local/portage/layma
n/java-overlay /usr/local/portage/layman/suka /usr/local/portage/layman/zugaina /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X Xaw3d a52 aac acl acpi administrator afs aiglx alsa amd64 amrr ao aotuv apache2 asf atlas auctex audacious audiofile automount bash
-completion beagle berkdb bjam blas bluetooth bonobo boo boost branding bzip2 c++ cairo cardbus cdda cddb cdf cdio cdparanoia cdr cgi chm 
cli consolekit corba cracklib cran crypt cups curl cxx daap dbus device-mapper dga dia divx djvu dlloader dmi doc dri ds3490 dv dvb dvd dv
dr dvdread dvi dxr3 dynagraph eds effects elf emacs emboss encode epiphany esd evo examples exif expat extra fam fame ffmpeg fftw firefox 
fits flac fltk foomaticdb fortran fpx fuse galago garmin gd gdal gdbm geos gif gimp gimpprint ginac glade glib glitz gml gmp gnokii gnome 
gnome-keyring gnuplot gnutls gphoto2 gpm graphics graphviz gs gsl gsm gstreamer gtk guile hal hardened harness hddtemp hdf hdf5 hlapi http
 httpd hvm iconv icq icu id3 ide imagemagick imap innodb ipod ipv6 irda irmc isdnlog ithreads jabber java java5 java6 jbig john jpeg jpeg2
k kde kde4 kerberos kexi keyring kvm ladspa lame lapack laptop latex lcms ldap libffi libgda libnotify libsamplerate lirc lua lzo lzw mad 
maildir mailwrapper math matroska midi mikmod mmx mmxext mng mod mono motif mozdevelop mozilla mozsvg mozxmlterm mp3 mp4 mp4live mpeg mpeg
2 mplayer mtp mudflap multilib musicbrainz mysql mysqli nautilus ncurses neXt netcdf netpbm network networkmanager nfs nls nntp nptl nptlo
nly nsplugin ntfs ntp numarray numeric nvidia obex objc ocaml octave odbc ogdi ogg ole openexr opengl openmp pae pam pcre pda pdf perl pip
echan plotutils plugins png podcast policykit posix postgres postscript ppds pppd preview-latex proj projectx pstricks python qhull qt3 qt
3support qt4 quicktime readline reflection reiserfs rhythmbox rle rpc rrdcgi rrdtool samba sasl science sdl server session slang slp smp s
ndfile snmp soup sox speex spell spl sqlite sse sse2 ssl startup-notification stlport subtitles subversion suexec svg sysfs szip t1lib tcl
 tcpd tex theora threads thunderbird tidy tiff tk tntc truetype unicode usb userlocales utempter v4l2 vorbis wav webdav webdav-serf webkit
 wifi wmf wxwindows xattr xcb xemacs xext xine xml xmlreader xmlrpc xorg xpm xulrunner xv xvid xvmc zlib zvbi" ALSA_CARDS="intel8x0" ALSA_
PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw mul
ti null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_defa
ult authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate d
ir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic nego
tiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias
" DVB_CARDS="usb-wt220u" ELIBC="glibc" INPUT_DEVICES="keyboard mouse                 synaptics               " KERNEL="linux" LCD_DEVICES=
"bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de fr" NETBEANS_MODULES="ide websvccommon nb harness apis
upport groovy gsf j2ee java xml" USERLAND="GNU" VIDEO_CARDS="nv nvidia vesa"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_
OPTS
Comment 1 Patrick Williams 2009-07-14 02:09:20 UTC
I could not recreate with gcc 4.4.2 or 4.4.3, but this appears to be an issue with MySQL, addressed upstream: http://bugs.mysql.com/bug.php?id=28184

The min and max macros are defined in /usr/include/mysql/my_global.h and conflict with stl library definitions when compiling C++ code.  

One quick patch for gdal might be to move the include in ogr/ogrsf_frmts/mysql/ogr_mysql.h to after "ogrsf_frmts.h":
----------------
#include <my_global.h>      
#include <mysql.h>

#ifdef bool
#undef bool
#endif

#include "ogrsf_frmts.h"   <---- move this up to before mysql includes
-------------

I also noticed that the DEPEND in gdal-1.6.0-r1.ebuild does not appear right:

DEPEND="${RDEPEND}
	perl? ( python? ( ruby? ( >=dev-lang/swig-1.3.28 ) ) )
	doc? ( app-doc/doxygen )"

swig is needed for "if (perl || python || ruby)" not "if (perl && python && ruby)", which is how it is currently written.
Comment 2 Martin von Gagern 2009-07-30 08:27:01 UTC
Created attachment 199619 [details, diff]
Change order of includes in gdal

(In reply to comment #1)
> One quick patch for gdal might be to move the include in
> ogr/ogrsf_frmts/mysql/ogr_mysql.h to after "ogrsf_frmts.h":

Tried that, looks good, as it did compile successfully. Patch attached.

Should the mysql herd be cc'ed to this report, in order to deal with the issue more properly? I had a look at the mysql sources on launchpad, both 5.1 and 6.0 branches. Seems that this is the only thing they did to those min/max macros:
http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/revision/2476.385.1
While this probably makes mysql itself compile under gcc 4.2.1, it doesn't solve the issue for gdal. So this patch against gdal is still required, at least until there is a better fix for mysql.
Comment 3 Juergen Rose 2009-07-30 18:34:18 UTC
The patch worked for me, even after installing hdf5-1.8.3.
Comment 4 Andreas K. Hüttel archtester gentoo-dev 2010-07-01 18:52:25 UTC
Is this still relevant for more recent versions of sci-libs/gdal?
Comment 5 Tomáš Chvátal (RETIRED) gentoo-dev 2010-10-04 14:51:59 UTC
I cant reproduce this with mysql-5.1 and gdal-1.7 please reopen if you have issues with such setup.
Comment 6 Juergen Rose 2010-10-05 18:06:04 UTC
I can't reproduce this issue with mysql-5.1.50-r1 and gdal-1.7.2-r1 either.