2012-08-22 16:35:51

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required

If we use the BlueZ version less than 4.100, then the following
compilation error happens.

Error:
======
btio/btio.c: In function ‘l2cap_connect’:
btio/btio.c:301:6: error: ‘struct sockaddr_l2’ has no member named
‘l2_bdaddr_type’
btio/btio.c: In function ‘parse_set_opts’:
btio/btio.c:707:19: error: ‘BDADDR_BREDR’ undeclared (first use in
this function)
btio/btio.c:707:19: note: each undeclared identifier is reported only
once for each function it appears in
make[1]: *** [btio/btio.o] Error 1
make: *** [all] Error 2
---

configure.ac | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 69d71b2..c8e61ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,8 +79,8 @@ PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

-PKG_CHECK_MODULES(BLUEZ, bluez >= 4.99, dummy=yes,
- AC_MSG_ERROR(BlueZ >= 4.99 is required))
+PKG_CHECK_MODULES(BLUEZ, bluez >= 4.100, dummy=yes,
+ AC_MSG_ERROR(BlueZ >= 4.100 is required))
AC_SUBST(BLUEZ_CFLAGS)
AC_SUBST(BLUEZ_LIBS)

--
1.7.4.1



2012-08-24 13:46:46

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later

On Fri, Aug 24, 2012 at 6:45 AM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Syam,
>
> On Thu, Aug 23, 2012 at 1:36 AM, Luiz Augusto von Dentz
> <[email protected]> wrote:
>> Hi Syam,
>>
>> On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
>> <[email protected]> wrote:
>>> Hi Syam,
>>>
>>> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <[email protected]> wrote:
>>>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>>>> the following build error may occure in a 32 bit.
>>>
>>> We had the issue with BlueZ but we did not bump the glib version,
>>> which makes me wonder if you are able to compile bluetoothd?
>>
>> It looks like we fix it with use of a variable:
>>
>> commit e34836262ba6a46491b6a760520158d70e8b51b5
>> Author: Johan Hedberg <[email protected]>
>> Date: Wed Oct 12 00:48:59 2011 +0300
>>
>> Fix compilation error on 32-bit systems
>>
>> This fixes the following compilation error with GLib on 32-bit sytems:
>>
>> audio/media.c: In function 'get_setting':
>> audio/media.c:1109:44: error: cast to pointer from integer of
>> different size [-Werror=int-to-pointer-cast]
>> audio/media.c: In function 'set_setting':
>> audio/media.c:1132:41: error: cast to pointer from integer of
>> different size [-Werror=int-to-pointer-cast]
>
> How about the following patch:

I will say the same thing when the other similar fix was committed to
BlueZ: creating an extra variable all over the repository because the
macro was not defined correctly is not good. Mainly because over the
time we would create the same problem in other places as well because
in general devs are using more recent versions of glib (as shown in
the places this patch is fixing now) .

So, I'd propose the following: if we don't want to increase the
minimum required version of glib, lets define this macro ourselves. Or
make it a build-time conditional in glib-helper.h


Lucas De Marchi

2012-08-24 09:45:37

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later

Hi Syam,

On Thu, Aug 23, 2012 at 1:36 AM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Syam,
>
> On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
> <[email protected]> wrote:
>> Hi Syam,
>>
>> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <[email protected]> wrote:
>>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>>> the following build error may occure in a 32 bit.
>>
>> We had the issue with BlueZ but we did not bump the glib version,
>> which makes me wonder if you are able to compile bluetoothd?
>
> It looks like we fix it with use of a variable:
>
> commit e34836262ba6a46491b6a760520158d70e8b51b5
> Author: Johan Hedberg <[email protected]>
> Date: Wed Oct 12 00:48:59 2011 +0300
>
> Fix compilation error on 32-bit systems
>
> This fixes the following compilation error with GLib on 32-bit sytems:
>
> audio/media.c: In function 'get_setting':
> audio/media.c:1109:44: error: cast to pointer from integer of
> different size [-Werror=int-to-pointer-cast]
> audio/media.c: In function 'set_setting':
> audio/media.c:1132:41: error: cast to pointer from integer of
> different size [-Werror=int-to-pointer-cast]

How about the following patch:

diff --git a/gobex/gobex-apparam.c b/gobex/gobex-apparam.c
index 8f72aa7..d29dfc1 100644
--- a/gobex/gobex-apparam.c
+++ b/gobex/gobex-apparam.c
@@ -112,12 +112,14 @@ GObexApparam *g_obex_apparam_decode(const void
*data, gsize size)
while (count < size) {
struct apparam_tag *tag;
gsize parsed;
+ guint id;

tag = apparam_tag_decode(data + count, size - count, &parsed);
if (tag == NULL)
break;

- g_hash_table_insert(tags, GUINT_TO_POINTER(tag->id), tag);
+ id = tag->id;
+ g_hash_table_insert(tags, GUINT_TO_POINTER(id), tag);

count += parsed;
}
@@ -167,12 +169,14 @@ GObexApparam
*g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id,
const void *value, gsize len)
{
struct apparam_tag *tag;
+ guint uid;

if (apparam == NULL)
apparam = g_obex_apparam_new();

tag = tag_new(id, len, value);
- g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(id), tag);
+ uid = id;
+ g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(uid), tag);

return apparam;
}
@@ -232,6 +236,12 @@ GObexApparam
*g_obex_apparam_set_string(GObexApparam *apparam, guint8 id,
return g_obex_apparam_set_bytes(apparam, id, value, len);
}

+static struct apparam_tag *g_obex_apparam_find_tag(GObexApparam *apparam,
+ guint id)
+{
+ return g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+}
+
gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id,
guint8 *dest)
{
@@ -239,7 +249,7 @@ gboolean g_obex_apparam_get_uint8(GObexApparam
*apparam, guint8 id,

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);

- tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+ tag = g_obex_apparam_find_tag(apparam, id);
if (tag == NULL)
return FALSE;

@@ -257,7 +267,7 @@ gboolean g_obex_apparam_get_uint16(GObexApparam
*apparam, guint8 id,

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);

- tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+ tag = g_obex_apparam_find_tag(apparam, id);
if (tag == NULL)
return FALSE;

@@ -278,7 +288,7 @@ gboolean g_obex_apparam_get_uint32(GObexApparam
*apparam, guint8 id,

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);

- tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+ tag = g_obex_apparam_find_tag(apparam, id);
if (tag == NULL)
return FALSE;

@@ -299,7 +309,7 @@ gboolean g_obex_apparam_get_uint64(GObexApparam
*apparam, guint8 id,

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);

- tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+ tag = g_obex_apparam_find_tag(apparam, id);
if (tag == NULL)
return FALSE;

@@ -320,7 +330,7 @@ char *g_obex_apparam_get_string(GObexApparam
*apparam, guint8 id)

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);

- tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+ tag = g_obex_apparam_find_tag(apparam, id);
if (tag == NULL)
return NULL;

@@ -338,7 +348,7 @@ gboolean g_obex_apparam_get_bytes(GObexApparam
*apparam, guint8 id,

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);

- tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+ tag = g_obex_apparam_find_tag(apparam, id);
if (tag == NULL)
return FALSE;

--
1.7.11.4



--
Luiz Augusto von Dentz

2012-08-23 14:12:04

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required

Hi Syam,

On Thu, Aug 23, 2012 at 5:04 PM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Syam,
>
> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <[email protected]> wrote:
>> If we use the BlueZ version less than 4.100, then the following
>> compilation error happens.
>>
>> Error:
>> ======
>> btio/btio.c: In function ?l2cap_connect?:
>> btio/btio.c:301:6: error: ?struct sockaddr_l2? has no member named
>> ?l2_bdaddr_type?
>> btio/btio.c: In function ?parse_set_opts?:
>> btio/btio.c:707:19: error: ?BDADDR_BREDR? undeclared (first use in
>> this function)
>> btio/btio.c:707:19: note: each undeclared identifier is reported only
>> once for each function it appears in
>> make[1]: *** [btio/btio.o] Error 1
>> make: *** [all] Error 2
>> ---
>
> Strange I don't get this error with 4.99, anyway I guess it is fine to
> bump 4.100

Patches 1,3 and 4 are now upstream, for the issue about glib Im
figuring out how to fix it properly.


--
Luiz Augusto von Dentz

2012-08-23 14:04:01

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required

Hi Syam,

On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <[email protected]> wrote:
> If we use the BlueZ version less than 4.100, then the following
> compilation error happens.
>
> Error:
> ======
> btio/btio.c: In function ?l2cap_connect?:
> btio/btio.c:301:6: error: ?struct sockaddr_l2? has no member named
> ?l2_bdaddr_type?
> btio/btio.c: In function ?parse_set_opts?:
> btio/btio.c:707:19: error: ?BDADDR_BREDR? undeclared (first use in
> this function)
> btio/btio.c:707:19: note: each undeclared identifier is reported only
> once for each function it appears in
> make[1]: *** [btio/btio.o] Error 1
> make: *** [all] Error 2
> ---

Strange I don't get this error with 4.99, anyway I guess it is fine to
bump 4.100


--
Luiz Augusto von Dentz

2012-08-22 22:36:51

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later

Hi Syam,

On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
<[email protected]> wrote:
> Hi Syam,
>
> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <[email protected]> wrote:
>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>> the following build error may occure in a 32 bit.
>
> We had the issue with BlueZ but we did not bump the glib version,
> which makes me wonder if you are able to compile bluetoothd?

It looks like we fix it with use of a variable:

commit e34836262ba6a46491b6a760520158d70e8b51b5
Author: Johan Hedberg <[email protected]>
Date: Wed Oct 12 00:48:59 2011 +0300

Fix compilation error on 32-bit systems

This fixes the following compilation error with GLib on 32-bit sytems:

audio/media.c: In function 'get_setting':
audio/media.c:1109:44: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
audio/media.c: In function 'set_setting':
audio/media.c:1132:41: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]


--
Luiz Augusto von Dentz

2012-08-22 22:27:57

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later

Hi Syam,

On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <[email protected]> wrote:
> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
> the following build error may occure in a 32 bit.

We had the issue with BlueZ but we did not bump the glib version,
which makes me wonder if you are able to compile bluetoothd?

--
Luiz Augusto von Dentz

2012-08-22 16:35:54

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH obexd v1 4/4] core: Remove redundant include errno.h

---
v1 => Corrected commit message typo

src/server.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/server.c b/src/server.c
index 52f7f1e..16be849 100644
--- a/src/server.c
+++ b/src/server.c
@@ -31,7 +31,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
-#include <errno.h>
#include <string.h>
#include <inttypes.h>

--
1.7.4.1


2012-08-22 16:35:53

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH obexd v1 3/4] plugins: Remove redundant include sys/stat.h

---
v1 => Corrected commit message typo

plugins/filesystem.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/plugins/filesystem.c b/plugins/filesystem.c
index e664fc5..1132a34 100644
--- a/plugins/filesystem.c
+++ b/plugins/filesystem.c
@@ -32,7 +32,6 @@
#include <string.h>
#include <unistd.h>
#include <dirent.h>
-#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
--
1.7.4.1


2012-08-22 16:35:52

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later

If we use GLib version less than 2.32 (more precisely < 2.31.2) then
the following build error may occure in a 32 bit.

cc1: warnings being treated as errors
gobex/gobex-apparam.c: In function ‘g_obex_apparam_set_bytes’:
gobex/gobex-apparam.c:176:38: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint8’:
gobex/gobex-apparam.c:243:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint16’:
gobex/gobex-apparam.c:261:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint32’:
gobex/gobex-apparam.c:282:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint64’:
gobex/gobex-apparam.c:303:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_string’:
gobex/gobex-apparam.c:324:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_bytes’:
gobex/gobex-apparam.c:342:43: error: cast to pointer from integer of
different size
make[1]: *** [gobex/gobex-apparam.o] Error 1
make: *** [all] Error 2
---

Reference:
GLib tree: Commit: 16292dd753cb63f8ccb2267644aefbd2632dd52c
Author: Lucas De Marchi <[email protected]>
Date: Thu Oct 6 11:18:03 2011 -0300
Fix G*_TO_POINTER casts on 32 bits

If we don't do the cast to the proper size in 32 bits, things like below
doesn't work:

uint8_t u = 20;

void *p;

p = GUINT_TO_POINTER(u);

Signed-off-by: Colin Walters <[email protected]>


Thanks Luiz for giving this reference.

Btb I'm not very sure, is this the best way to solve this problem.

configure.ac | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index c8e61ac..78da420 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,8 +69,8 @@ fi
AC_CHECK_LIB(dl, dlopen, dummy=yes,
AC_MSG_ERROR(dynamic linking loader is required))

-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
- AC_MSG_ERROR(GLib >= 2.28 is required))
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.32, dummy=yes,
+ AC_MSG_ERROR(GLib >= 2.32 is required))
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

--
1.7.4.1