Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 142393 - [PATCH] net-wireless/bluez-libs - bluetooth.h doesn`t compile cleanly with -std=iso9899:1990 flag
Summary: [PATCH] net-wireless/bluez-libs - bluetooth.h doesn`t compile cleanly with -s...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High trivial
Assignee: Alastair Tse (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-01 02:25 UTC by Maciej Grela
Modified: 2006-08-22 02:44 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Grela 2006-08-01 02:25:02 UTC
Recently when I`ve tried to compile KDE (ktnef to be exact) I came upon 
an error in Bluetooth include files:

configure:34044: result: /usr/bin/doxygen
configure:34133: checking bluetooth/bluetooth.h usability
configure:34145: 
i686-pc-linux-gnu-gcc -c -std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes
 -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -DNDEBUG -O2  -O2 -march=k6 -mtune=athlon-xp -pipe -Wformat-security -Wmissing-fo
rmat-attribute  -DQT_THREAD_SUPPORT  -D_REENTRANT conftest.c >&5
In file included from conftest.c:101:
/usr/include/bluetooth/bluetooth.h:113: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/usr/include/bluetooth/bluetooth.h:117: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
configure:34151: $? = 1

After checking the header file it became clear that the 'inline' keyword 
is responsible for the mess. As you can see ./configure is executing 
gcc with -std=iso9899:1990 flag which sets the language dialect to pure 
C89. Unfortunately this doesn`t support the 'inline' keyword. 
To reproduce this bug try:

thermal@newhope ~ $ cat > a.c
#include <bluetooth.h>
thermal@newhope ~ $ gcc -std=iso9899:1990 -c -I ~/bluez-libs-3.2/include 
a.c
In file included from a.c:1:
/home/thermal/bluez-libs-3.2/include/bluetooth.h:113: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/home/thermal/bluez-libs-3.2/include/bluetooth.h:117: error: 
expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
thermal@newhope ~ $

So I wrote a tiny patch to fix this:

--- bluez-libs-3.2/include/bluetooth.h  2006-07-31 20:57:08.000000000 
+0200
+++ /usr/include/bluetooth/bluetooth.h  2006-07-31 20:55:55.000000000 
+0200
@@ -109,12 +109,19 @@
 #define BDADDR_ALL   (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 
0xff}})
 #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})

+/* No inline keyword in the iso8988:1990 standard */
+#ifdef __STRICT_ANSI__
+    #define __INLINE
+#else
+    #define __INLINE inline
+#endif
+
 /* Copy, swap, convert BD Address */
-static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
+static __INLINE int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
 {
        return memcmp(ba1, ba2, sizeof(bdaddr_t));
 }
-static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
+static __INLINE void bacpy(bdaddr_t *dst, const bdaddr_t *src)
 {
        memcpy(dst, src, sizeof(bdaddr_t));
 }

After applying it all compiles nicely:

thermal@newhope ~ $ cat > a.c
#include <bluetooth/bluetooth.h>
thermal@newhope ~ $ gcc -std=iso9899:1990 -c a.c
thermal@newhope ~ $

(Note: my patched header file lives in /usr/inlude/bluetooth). It would 
be nice if the patch was included in the bluez-libs patchset.

emerge --info
Portage 2.1-r1 (default-linux/x86/2006.0, gcc-4.1.1, glibc-2.3.6-r4, 2.6.16-gentoo-r3-newhope i686)
=================================================================
System uname: 2.6.16-gentoo-r3-newhope i686 AMD Athlon(tm) XP 1700+
Gentoo Base System version 1.6.15
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.3 [enabled]
app-admin/eselect-compiler: [Not Present]
dev-lang/python:     2.3.5-r2, 2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.3
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-r2
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.13-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=k6 -mtune=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=k6 -mtune=athlon-xp -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache collision-protect distlocks metadata-transfer nodoc parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.prz.rzeszow.pl http://gentoo.zie.pg.gda.pl"
LANG="pl_PL"
LC_ALL="pl_PL"
LINGUAS="en pl"
MAKEOPTS="-j2"
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'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowext X aalib acl acpi adns alsa apache2 arts avi bash-completion berkdb bitmap-fonts bluetooth bzip2 cairo cdr cli crypt cups curl dedicated dio dlloader dmi dri dvd embedded emboss encode esd exif ffmpeg fftw foomaticdb fortran ftp gd gdbm gif glitz glut gmp gnutls gpgme gpm gsm gtk gtk2 hal iconv idn imap ipv6 irda isdnlog jabber jack java javascript joystick jpeg jpeg2k kde kdeenablefinal kdehiddenvisibility ldap libcaca libg++ libwww lm_sensors mad maildir matroska mikmod mime mmx mmxext motif mp3 mpeg mysql ncurses netboot nls nntp nptl nptlonly ogg openal opengl pam pcre pdflib perl png pop pppd python qt qt3 quicktime readline real reflection rtc samba sasl sdl sensord session sharedmem slp smartcard smime snmp sockets socks5 sox speex spl sse ssl svg sysfs tcpd theora threads threadstruetype tiff truetype truetype-fonts type1-fonts udev unicode usb userlocales vcd vorbis win32codecs xcomposite xine xinerama xinetd xml xml2 xmms xorg xv xvid zlib elibc_glibc input_devices_keyboard input_devices_mouse input_devices_evdev kernel_linux linguas_en linguas_pl userland_GNU video_cards_radeon video_cards_i810 video_cards_mach64 video_cards_nv video_cards_r128 video_cards_s3virge video_cards_s3 video_cards_savage video_cards_sis video_cards_tdfx video_cards_v4l video_cards_vesa video_cards_vga video_cards_via"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-08-01 04:25:20 UTC
Reopen w/ ebuild name and version.
Comment 2 Maciej Grela 2006-08-01 09:29:17 UTC
Right, forgot about that:

net-wireless/bluez-libs/bluez-libs-2.25.ebuild
Comment 3 Alastair Tse (RETIRED) gentoo-dev 2006-08-01 16:00:11 UTC
ok, this seems to make sense. just curious, is there any reason why -std=iso9899-.. is added to your CFLAGS in that instance? i'm not familiar with those flags.
Comment 4 Maciej Grela 2006-08-02 03:43:33 UTC
The -std flag sets the language dialect used by gcc (the info manual has a detailed section about that). It`s used by configure to ensure that headers will work even on nasty, pedantic C89-only compilers used in some obscure UNIX systems (though I can`t think of any).
Comment 5 Alastair Tse (RETIRED) gentoo-dev 2006-08-02 04:14:59 UTC
I think the problem I have is that in your emerge info there is no mention of this flag. Where is this CFLAG coming from? Is it in the bluez-libs configure.{ac,in}?

If this is such an obscure flag and obsleted spec, then I don't feel particular comfortable maintaining the patch for future versions. 
Comment 6 Alastair Tse (RETIRED) gentoo-dev 2006-08-22 02:44:08 UTC
i'm closing this bug as WONTFIX. there is enough stuff that needs to be maintained regarding bluez that I don't have the time to maintain a patch for a single rarely used CFLAG.