Bug 120194 - dev-embedded/avrdude-5.1 compilation fails on amd64
Bug#: 120194 Product:  Gentoo Linux Version: 2005.1 Platform: AMD64
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: dev-embedded@gentoo.org Reported By: luksan@gmail.com
Component: Applications
URL: 
Summary: dev-embedded/avrdude-5.1 compilation fails on amd64
Keywords:  
Status Whiteboard: 
Opened: 2006-01-24 08:34 0000
Description:   Opened: 2006-01-24 08:34 0000
Emerging of avrdude-5.1 fails with the following error:

<..snipped..>
checking for parallel device... /dev/parport0
checking for serial device... /dev/ttyS0
configure: creating ./config.status
config.status: creating windows/Makefile
config.status: creating avrdude.spec
config.status: creating Makefile
config.status: creating avrdude.conf.tmp
config.status: creating ac_cfg.h
config.status: executing depfiles commands
make  all-recursive
make[1]: Entering directory `/var/tmp/portage/avrdude-5.1/work/avrdude-5.1'
make[2]: Entering directory `/var/tmp/portage/avrdude-5.1/work/avrdude-5.1'
if x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.  -DCONFIG_DIR=\"/etc\" 
-Wall   -O2 -pipe -march=k8  -MT avrdude-config_gram.o -MD -MP -MF
".deps/avrdude-config_gram.Tpo" -c -o avrdude-config_gram.o `test -f
'config_gram.c' || echo './'`config_gram.c; \
then mv -f ".deps/avrdude-config_gram.Tpo" ".deps/avrdude-config_gram.Po"; else
rm -f ".deps/avrdude-config_gram.Tpo"; exit 1; fi
if x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.  -DCONFIG_DIR=\"/etc\" 
-Wall   -O2 -pipe -march=k8  -MT avrdude-lexer.o -MD -MP -MF
".deps/avrdude-lexer.Tpo" -c -o avrdude-lexer.o `test -f 'lexer.c' || echo
'./'`lexer.c; \
then mv -f ".deps/avrdude-lexer.Tpo" ".deps/avrdude-lexer.Po"; else rm -f
".deps/avrdude-lexer.Tpo"; exit 1; fi
In file included from /usr/include/bits/stat.h:8,
                 from /usr/include/gentoo-multilib/amd64/sys/stat.h:105,
                 from /usr/include/sys/stat.h:8,
                 from lexer.l:29:
/usr/include/gentoo-multilib/amd64/bits/stat.h:103: error: parse error before
'[' token
make[2]: *** [avrdude-lexer.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/var/tmp/portage/avrdude-5.1/work/avrdude-5.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/avrdude-5.1/work/avrdude-5.1'
make: *** [all] Error 2

!!! ERROR: dev-embedded/avrdude-5.1 failed.
!!! Function src_compile, Line 26, Exitcode 2
!!! emake failed
!!! If you need support, post the topmost build error, NOT this status message.

emerge --info:

Portage 2.0.54 (default-linux/amd64/2005.1, gcc-3.4.4, glibc-2.3.5-r2,
2.6.15-rc7-git x86_64)
=================================================================
System uname: 2.6.15-rc7-git x86_64 AMD Athlon(tm) 64 Processor 3200+
Gentoo Base System version 1.6.14
ccache version 2.3 [disabled]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
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
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="-O2 -pipe -march=k8 "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env
/usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/
/usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -march=k8 "
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.du.se/pub/os/gentoo http://ftp.du.se/pub/os/gentoo
http://ds.thn.htu.se/linux/gentoo http://mirror.pudas.net/gentoo
ftp://mirror.pudas.net/gentoo"
LANG="en_US.ISO-8859-1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="amd64 X alsa audiofile avi berkdb bitmap-fonts bzip2 cairo cdb cdparanoia
cdr crypt curl dga divx4linux dts dvd dvdr dvdread emboss encode esd exif expat
fam ffmpeg firefox flac foomaticdb fortran gcj gdbm gif glitz glut gnome gpm
gstreamer gtk gtk2 gtkhtml idn imagemagick imlib java jpeg junit kde lcms ldap
libwww lzo lzw lzw-tiff mad matroska mng motif mp3 mpeg mysql ncurses nls nptl
nptlonly nvidia ogg oggvorbis openal opengl pam pcre pdflib perl png python qt
quicktime readline real recode samba sdl spell ssl svf tcltk tcpd tetex tga
theora tiff truetype truetype-fonts type1-fonts udev unicode usb userlocales
vcd vorbis wmf xanim xine xml2 xpm xv xvid xvmc zlib userland_GNU kernel_linux
elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, LINGUAS

------- Comment #1 From Henrik Brix Andersen 2006-01-24 08:56:00 0000 -------
AMD64 herd, any idea about this issue?

/usr/include/gentoo-multilib/amd64/bits/stat.h:103: error: parse error before
'[' token

------- Comment #2 From Simon Stelling (RETIRED) 2006-01-24 09:26:53 0000 -------
Lukas, please attach your '/usr/include/gentoo-multilib/amd64/bits/stat.h'

------- Comment #3 From Lukas Sandström 2006-01-24 11:07:33 0000 -------
Created an attachment (id=78017) [details]
My stat.h

------- Comment #4 From Lukas Sandström 2006-01-24 11:09:46 0000 -------
Note that I tried compiling a short C program which #included <sys/stat.h>
and it compiled just fine.

#include <sys/stat.h>

int main() {
return 0;
}

------- Comment #5 From Sandro Bonazzola (RETIRED) 2006-01-24 12:32:31 0000 -------
I can reproduce this here on ~amd64.
Going into building directory:
avrdude-5.1 # gcc -c lexer.c
In file included from /usr/include/bits/stat.h:8,
                 from /usr/include/gentoo-multilib/amd64/sys/stat.h:105,
                 from /usr/include/sys/stat.h:8,
                 from lexer.l:29:
/usr/include/gentoo-multilib/amd64/bits/stat.h:103: error: syntax error before
'[' token

looking into /usr/include/bits/stat.h
#ifdef __x86_64__
# include <gentoo-multilib/amd64/bits/stat.h>
#endif /* __x86_64__ */

looking /usr/include/gentoo-multilib/amd64/sys/stat.h:105
#include <bits/stat.h>

looking /usr/include/sys/stat.h
#ifdef __x86_64__
# include <gentoo-multilib/amd64/sys/stat.h>
#endif /* __x86_64__ */

lexer.l: 
#include <math.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>

/usr/include/gentoo-multilib/amd64/bits/stat.h
#if __WORDSIZE == 64
    long int __unused[3];
#else
# ifndef __USE_FILE_OFFSET64
    unsigned long int __unused4;
    unsigned long int __unused5;
# else
    __ino64_t st_ino;                   /* File serial number.  */
# endif
#endif

I can't see any syntax error in those files. But still fails to compile.

------- Comment #6 From Lukas Sandström 2006-01-24 13:17:36 0000 -------
Created an attachment (id=78026) [details]
avrdude-5.1.patch

It builds with this path, but I haven't tested it much.
The problem is that __unused is defined in lexer.c in the
avrdude sources.

------- Comment #7 From Simon Stelling (RETIRED) 2006-01-24 13:59:57 0000 -------
right, so this is dev-embedded's territory

------- Comment #8 From Lukas Sandström 2006-01-26 05:26:17 0000 -------
I filed a bug report upstream.

http://savannah.nongnu.org/bugs/index.php?func=detailitem&item_id=15536

------- Comment #9 From Simon Stelling (RETIRED) 2006-01-26 06:12:22 0000 -------
Created an attachment (id=78160) [details]
slightly improved patch

Brix, I tested this patch and it works (of course), but I'm not sure how
dev-embedded handles patching. Should I use patch or is epatch fine? If epatch
is fine, please apply this :)

------- Comment #10 From SpanKY 2006-01-26 07:23:02 0000 -------
> Brix, I tested this patch and it works (of course), but I'm not sure how
> dev-embedded handles patching. Should I use patch or is epatch fine?

uhh, ebuilds should *always* use epatch

------- Comment #11 From Lukas Sandström 2006-01-26 11:46:08 0000 -------
An avrdude developer suggested the following workaround, which worked for me:

lexer.c is a generated file, from lexer.l.  Thus, there is
no CVS file for it, so we cannot patch it that way.

I'm a bit surprised this file even makes it into the source
distribution, but that's the way "make distcheck" created
the tarball.  I rather suspect a bug in the autoconf/automake
configuration files used in avrdude.

As a workaround, I suggest you remove lexer.c, config_gram.c,
and config_gram.h locally before starting the build, so the
make process will recreate them using your local lex and yacc.

------- Comment #12 From Daniel Black 2006-01-27 15:52:38 0000 -------
Thanks Lukas - I've changed it to remove the autogenerated files.

Please reopen if any problems remain.

------- Comment #13 From Eric Thibodeau 2007-02-24 20:16:01 0000 -------
I just tried avrdude 5.3.1 and it seems the files aren't auto-generated
unfortunately (build complains about those files missing exactly).

------- Comment #14 From Eric Thibodeau 2007-02-24 20:22:33 0000 -------
Okay, make gets ahead of itself on this one:
MAKEOPTS=-j1
..needs to be added to the ebuild and all should be nice to unmask it ;)