Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 180619 - sys-block/iscsitarget-0.4.15 fails to compile on gcc-3.4.x (hardened)
Summary: sys-block/iscsitarget-0.4.15 fails to compile on gcc-3.4.x (hardened)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-02 09:38 UTC by Natanael Copa
Modified: 2008-02-22 03:35 UTC (History)
0 users

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


Attachments
files/iscsitarget-0.4.15-gcc-3.4-fix.patch (iscsitarget-0.4.15-gcc-3.4-fix.patch,488 bytes, patch)
2007-06-14 13:35 UTC, Natanael Copa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Natanael Copa 2007-06-02 09:38:58 UTC
>>> Compiling source in /var/tmp/portage/sys-block/iscsitarget-0.4.15/work/iscsitarget-0.4.15 ...
 * Building userspace
gcc: /lib/modules/2.6.21-gentoo-r1/build/include/linux/version.h: No such file or directory
gcc: no input files
/bin/sh: line 0: [: -le: unary operator expected
/bin/sh: line 0: [: -lt: unary operator expected
make -C usr
make[1]: Entering directory `/var/tmp/portage/sys-block/iscsitarget-0.4.15/work/iscsitarget-0.4.15/usr'
cc  -march=i386 -Os -pipe -fomit-frame-pointer -Wall -Wstrict-prototypes -I../include   -c -o ietd.o ietd.c
cc  -march=i386 -Os -pipe -fomit-frame-pointer -Wall -Wstrict-prototypes -I../include   -c -o iscsid.o iscsid.c

...

cc  -march=i386 -Os -pipe -fomit-frame-pointer -Wall -Wstrict-prototypes -I../include   -c -o plain.o plain.c
cc  -march=i386 -Os -pipe -fomit-frame-pointer -Wall -Wstrict-prototypes -I../include   -c -o isns.o isns.c
isns.c: In function `isns_scn_register':
isns.c:259: error: syntax error before '{' token
isns.c:259: warning: unused variable `__v'
isns.c:259: error: syntax error before "__v"
isns.c:231: warning: unused variable `err'
isns.c:232: warning: unused variable `flags'
isns.c: At top level:
isns.c:259: error: syntax error before ')' token
isns.c:259: warning: type defaults to `int' in declaration of `scn_flags'
isns.c:259: error: initializer element is not constant
isns.c:259: warning: data definition has no type or storage class
isns.c:259: warning: type defaults to `int' in declaration of `scn_flags'
isns.c:259: error: redefinition of 'scn_flags'
isns.c:259: error: previous definition of 'scn_flags' was here
isns.c:259: error: initializer element is not constant

...

isns.c:267: error: initializer element is not constant
isns.c:267: warning: data definition has no type or storage class
isns.c:268: error: syntax error before "if"
make[1]: *** [isns.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/var/tmp/portage/sys-block/iscsitarget-0.4.15/work/iscsitarget-0.4.15/usr'
make: *** [usr] Error 2

!!! ERROR: sys-block/iscsitarget-0.4.15 failed.
Comment 1 Natanael Copa 2007-06-02 09:39:28 UTC
emerge --info:

Portage 2.1.2.7 (uclibc/x86/hardened, gcc-3.4.6, uclibc-0.9.28.3-r0, 2.6.21-gentoo-r1 i686)
=================================================================
System uname: 2.6.21-gentoo-r1 i686 Intel(R) Pentium(R) D CPU 3.00GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Fri, 01 Jun 2007 07:30:01 +0000
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.61
sys-devel/automake:  1.6.3, 1.8.5-r3, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i386-gentoo-linux-uclibc"
CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
CHOST="i386-gentoo-linux-uclibc"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/terminfo"
CXXFLAGS="-Os -pipe"
DISTDIR="/var/cache/distfiles"
FEATURES="autoconfig buildpkg distlocks metadata-transfer nodoc noinfo noman sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
MAKEOPTS="-j3"
PKGDIR="/var/cache/packages/default"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/alpine-portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X509 bitmap-fonts bri bzip2 cli cracklib dri encode expat extensions hardened iproute2 ipv6 jpeg lua mad midi mudflap ncurses netboot nonfsv4 ntfs ogg openmp oss pci pcmcia pic png pppd pri readline reflection rrdtool sensord session snmp speex spl ssl tdb truetype truetype-fonts type1-fonts uclibc uclibc++ udev usb userlocales wifi wordexp x86 xorg zaptel zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="uclibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" MISDN_CARDS="avmfritz hfcmulti hfcpci hfcsmini hfcsusb netjetpci sedlfax w6692pci xhfc" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l apm ark chips cirrus cyrix epson glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng vesa vga via voodoo"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 2 Natanael Copa 2007-06-02 09:41:09 UTC
(In reply to comment #0)
> >>> Compiling source in /var/tmp/portage/sys-block/iscsitarget-0.4.15/work/iscsitarget-0.4.15 ...
>  * Building userspace
> gcc: /lib/modules/2.6.21-gentoo-r1/build/include/linux/version.h: No such file
> or directory
> gcc: no input files
> /bin/sh: line 0: [: -le: unary operator expected
> /bin/sh: line 0: [: -lt: unary operator expected


FYI. Those comes from the fact that I compile in an uclibc chroot. I can work around the messages by setting KSRC=/usr/src/linux.

Comment 3 Natanael Copa 2007-06-14 12:55:36 UTC
The problem has to do with my gcc-3.4.6 compiler version and not uclibc.

First is set_scn_flag(x) defined:

#if __BYTE_ORDER == __LITTLE_ENDIAN
#define set_scn_flag(x)                                         \
{                                                               \
        x = (x & 0x55555555) << 1 | (x & 0xaaaaaaaa) >> 1;      \
        x = (x & 0x33333333) << 2 | (x & 0xcccccccc) >> 2;      \
        x = (x & 0x0f0f0f0f) << 4 | (x & 0xf0f0f0f0) >> 4;      \
        x = (x & 0x00ff00ff) << 8 | (x & 0xff00ff00) >> 8;      \
        x = (x & 0x0000ffff) << 16 | (x & 0xffff0000) >> 16;    \
}
#else
#define set_scn_flag(x) (x)
#endif

Later this code appears:
	scn_flags = ISNS_SCN_FLAG_INITIATOR | ISNS_SCN_FLAG_OBJECT_REMOVE |
		ISNS_SCN_FLAG_OBJECT_ADDED | ISNS_SCN_FLAG_OBJECT_UPDATED;
	scn_flags = htonl(set_scn_flag(scn_flags));

If i understand that correctly gcc-3.4.6 will expand it as:

  scn_flags = htonl( { scn_flags  = (scn_flags & 0x55555555) << 1 | ... ; ... } );

which is invaild.

Comment 4 Natanael Copa 2007-06-14 13:35:22 UTC
Created attachment 122028 [details, diff]
files/iscsitarget-0.4.15-gcc-3.4-fix.patch

makes it compile on gcc-3.4
Comment 5 Vieri 2007-08-15 09:39:05 UTC
(In reply to comment #4)
> files/iscsitarget-0.4.15-gcc-3.4-fix.patch
> makes it compile on gcc-3.4

iscsitarget 0.4.15 emerged without errors on:

# emerge --info
Portage 2.1.2.9 (hardened/x86/2.6, gcc-3.4.6, glibc-2.5-r4, 2.6.20-hardened-r5 i686)
=================================================================
System uname: 2.6.20-hardened-r5 i686 Pentium III (Coppermine)
Gentoo Base System release 1.12.9
Timestamp of tree: Thu, 26 Jul 2007 08:00:02 +0000
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=i686 -mtune=pentium3 -O2 -pipe -fforce-addr"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib/fax /var/spool/fax/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=i686 -mtune=pentium3 -O2 -pipe -fforce-addr"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.ovh.net/gentoo-distfiles/"
LANG="es_ES.UTF-8@euro"
LC_ALL=""
LINGUAS="es"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="7zip acl apache2 berkdb bzip2 cracklib crypt cups extensions hardened iconv jbig jpeg jpeg2k kerberos ldap midi ncurses nls nptl nptlonly pam php pic png ppds readline samba ssl tcpd tiff urandom winbind x86 xorg zip zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="es" USERLAND="GNU"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

I didn't try it with a kernel v. > 2.6.20.
Comment 6 Vieri 2007-08-15 09:40:30 UTC
(In reply to comment #5)
> iscsitarget 0.4.15 emerged without errors

That is, without the iscsitarget-0.4.15-gcc-3.4-fix.patch file.
Comment 7 Vieri 2007-08-15 09:43:01 UTC
(In reply to comment #5)

Sorry for the mess. Not using uclibc... 
Comment 8 SpanKY gentoo-dev 2008-02-22 03:20:49 UTC
please try changing the macro to read:
#define set_scn_flag(x) ({ .... })

in other words, just add the parens before/after the braces