From: Patrick Ohly <patrick.ohly@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Milan Crha <mcrha@redhat.com>,
ying.an.deng@intel.com, ulf.hofemeier@intel.com,
ning.w.wang@intel.com
Subject: bluez 4.97: build failure when used in C++ apps
Date: Mon, 16 Jan 2012 09:25:41 +0100 [thread overview]
Message-ID: <1326702341.3360.107.camel@pohly-mobl1.fritz.box> (raw)
[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]
Hello!
Bluez 4.97 has entered some distros recently (Fedora Core, MeeGo 1.2
update), which broke compilation of the C++ code in SyncEvolution
using /usr/lib/bluetooth.h.
The compiler error is:
/usr/include/bluetooth/bluetooth.h::131:9: error: invalid conversion from 'void*' to 'bt_get_le64(void*)::<anonymous struct>*'
...
The reason is that C++, in contrast to C, does not allow conversion of
void * to anything, and this code gets compiled as C++ when the app is
written in C++. The macro with the assignment itself is older, but only
recent Bluez starts to use it in inline functions, thus triggering the
problem.
Attached is a proposed solution. Note that I have only verified that it
now compiles in C and C++, I have not actually tested the resulting
Bluez, because compilation fails for me on Debian Testing for another
reason (libcheck.a linked into shared object, doesn't work because not
relocatable).
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
[-- Attachment #2: bluez-4.97-cplusplus.patch --]
[-- Type: text/x-patch, Size: 819 bytes --]
*** bluez-4.97/lib/bluetooth.h.orig 2012-01-16 09:06:07.171931288 +0100
--- bluez-4.97/lib/bluetooth.h 2012-01-16 09:07:02.523930152 +0100
***************
*** 113,119 ****
({ \
struct __attribute__((packed)) { \
typeof(*(ptr)) __v; \
! } *__p = (void *) (ptr); \
__p->__v; \
})
--- 113,119 ----
({ \
struct __attribute__((packed)) { \
typeof(*(ptr)) __v; \
! } *__p = (typeof(__p)) (ptr); \
__p->__v; \
})
***************
*** 121,127 ****
do { \
struct __attribute__((packed)) { \
typeof(*(ptr)) __v; \
! } *__p = (void *) (ptr); \
__p->__v = (val); \
} while(0)
--- 121,127 ----
do { \
struct __attribute__((packed)) { \
typeof(*(ptr)) __v; \
! } *__p = (typeof(__p)) (ptr); \
__p->__v = (val); \
} while(0)
next reply other threads:[~2012-01-16 8:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-16 8:25 Patrick Ohly [this message]
2012-01-16 8:48 ` bluez 4.97: build failure when used in C++ apps Deng, Ying An
2012-01-16 9:24 ` Marcel Holtmann
2012-01-16 10:09 ` Patrick Ohly
2012-02-05 10:56 ` Patrick Ohly
2012-02-05 10:57 ` [PATCH] bluetooth.h: fix compile issue in C++ with ifdef Patrick Ohly
2012-02-05 11:07 ` Rohan Garg
2012-02-05 11:33 ` Patrick Ohly
2012-02-05 11:33 ` Rohan Garg
2012-02-05 12:23 ` Rohan Garg
2012-02-05 12:28 ` Rohan Garg
2012-02-05 10:59 ` bluez 4.97: build failure when used in C++ apps Rohan Garg
2012-02-05 12:02 ` Rohan Garg
2012-02-06 8:46 ` Milan Crha
2012-02-06 9:29 ` Patrick Ohly
2012-02-06 9:51 ` Milan Crha
2012-02-05 14:29 ` Tino Keitel
2012-02-05 14:50 ` Rohan Garg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326702341.3360.107.camel@pohly-mobl1.fritz.box \
--to=patrick.ohly@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mcrha@redhat.com \
--cc=ning.w.wang@intel.com \
--cc=ulf.hofemeier@intel.com \
--cc=ying.an.deng@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).