bravohe / sma-bluetooth

Automatically exported from code.google.com/p/sma-bluetooth
0 stars 0 forks source link

make sqlite errors #103

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Followed steps as per 
http://rcphills-sma-bluetooth-dbabstraction.googlecode.com/hg/ubuntu-setup-howto
.html

2. received errors unsure why 
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
ubuntu 12.04

Please provide any additional information below.

nas@NAS:~/bin/sma-bluetooth$ make sqlite
gcc -ggdb -Wall -pedantic -std=c99 -c smatool.c  -o smatool.o
In file included from smatool.c:29:0:
/usr/include/bluetooth/bluetooth.h: In function âbt_get_le64â:
/usr/include/bluetooth/bluetooth.h:133:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:133:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_be64â:
/usr/include/bluetooth/bluetooth.h:138:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:138:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_le32â:
/usr/include/bluetooth/bluetooth.h:143:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:143:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_be32â:
/usr/include/bluetooth/bluetooth.h:148:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:148:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_le16â:
/usr/include/bluetooth/bluetooth.h:153:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:153:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_be16â:
/usr/include/bluetooth/bluetooth.h:158:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:158:9: error: âstruct __sâ has no member 
named â__vâ
smatool.c: In function âfix_length_sendâ:
smatool.c:211:16: warning: variable âdeltaâ set but not used 
[-Wunused-but-set-variable]
smatool.c: In function âcheck_send_errorâ:
smatool.c:379:12: warning: statement with no effect [-Wunused-value]
smatool.c: In function âget_timezone_in_secondsâ:
smatool.c:435:11: warning: variable âreturntimeâ set but not used 
[-Wunused-but-set-variable]
smatool.c: In function âGetInverterSettingâ:
smatool.c:911:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c:914:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c:916:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c:918:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c: In function âmainâ:
smatool.c:1284:38: warning: variable ârangedatastartedâ set but not used 
[-Wunused-but-set-variable]
smatool.c:1284:23: warning: variable âsetupstartedâ set but not used 
[-Wunused-but-set-variable]
smatool.c:1284:9: warning: variable âinitstartedâ set but not used 
[-Wunused-but-set-variable]
make: *** [smatool.o] Error 1
nas@NAS:~/bin/sma-bluetooth$ sudo make sqlite
gcc -ggdb -Wall -pedantic -std=c99 -c smatool.c  -o smatool.o
In file included from smatool.c:29:0:
/usr/include/bluetooth/bluetooth.h: In function âbt_get_le64â:
/usr/include/bluetooth/bluetooth.h:133:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:133:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_be64â:
/usr/include/bluetooth/bluetooth.h:138:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:138:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_le32â:
/usr/include/bluetooth/bluetooth.h:143:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:143:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_be32â:
/usr/include/bluetooth/bluetooth.h:148:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:148:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_le16â:
/usr/include/bluetooth/bluetooth.h:153:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:153:9: error: âstruct __sâ has no member 
named â__vâ
/usr/include/bluetooth/bluetooth.h: In function âbt_get_be16â:
/usr/include/bluetooth/bluetooth.h:158:9: error: expected 
specifier-qualifier-list before âtypeofâ
/usr/include/bluetooth/bluetooth.h:158:9: error: âstruct __sâ has no member 
named â__vâ
smatool.c: In function âfix_length_sendâ:
smatool.c:211:16: warning: variable âdeltaâ set but not used 
[-Wunused-but-set-variable]
smatool.c: In function âcheck_send_errorâ:
smatool.c:379:12: warning: statement with no effect [-Wunused-value]
smatool.c: In function âget_timezone_in_secondsâ:
smatool.c:435:11: warning: variable âreturntimeâ set but not used 
[-Wunused-but-set-variable]
smatool.c: In function âGetInverterSettingâ:
smatool.c:911:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c:914:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c:916:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c:918:24: warning: format â%Xâ expects argument of type âunsigned 
int *â, but argument 3 has type âunsigned char *â [-Wformat]
smatool.c: In function âmainâ:
smatool.c:1284:38: warning: variable ârangedatastartedâ set but not used 
[-Wunused-but-set-variable]
smatool.c:1284:23: warning: variable âsetupstartedâ set but not used 
[-Wunused-but-set-variable]
smatool.c:1284:9: warning: variable âinitstartedâ set but not used 
[-Wunused-but-set-variable]
make: *** [smatool.o] Error 1

Original issue reported on code.google.com by cjrow...@gmail.com on 29 Sep 2012 at 6:04

GoogleCodeExporter commented 9 years ago
I had similar issues when compiling under ArchLinux on a raspberry pi.
The errors were due to typos in the bluetooth.h file (bluez 4.101-1 
(archlinuxarm does not have libbluetooth-dev)
Look for the line /* Bluetooth unaligned access */ in bluetooth.h
The next two defines are bt_get_unaligned(ptr) and bt_put_unaligned(val,ptr)

I replaced them with the following and the compile errors went away.

#ifndef __cplusplus
/*
 * traditional code, doesn't work in c++ because
 * of the void * to struct pointer assignment
 */

#define bt_get_unaligned(ptr)                   \
({                                              \
        struct __attribute__((packed)) {        \
                __typeof__(*(ptr)) __v;         \
        } *__p = (void *) (ptr);                \
        __p->__v;                               \
})

#define bt_put_unaligned(val, ptr)              \
do {                                            \
        struct __attribute__((packed)) {        \
                __typeof__(*(ptr)) __v;         \
        } *__p = (void *) (ptr);                \
        __p->__v = (val);                       \
} while(0)

#else /* __cplusplus */

#define bt_get_unaligned(ptr)                   \
({                                              \
        struct __attribute__((packed)) {        \
                __typeof__(*(ptr)) __v;         \
        } *__p = (__typeof__(__p)) (ptr);       \
        __p->__v;                               \
})

#define bt_put_unaligned(val, ptr)              \
do {                                            \
        struct __attribute__((packed)) {        \
                __typeof__(*(ptr)) __v;         \
        } *__p = (__typeof__(__p)) (ptr);               \
        __p->__v = (val);                       \
} while(0)

#endif /* __cplusplus */

Original comment by peter.f....@gmail.com on 2 Dec 2012 at 10:54

GoogleCodeExporter commented 9 years ago
Hi

I have the same issue. I'm afraid I'm a very recent convert to linux and ubuntu 
and whilst I have found the bluetooth.h file, I am unable to save the changes 
due to permission errors. What am I doing wrong? I am signed-in with admin 
rights (using 12.04).

Cheers
Bob

Original comment by bobbilli...@gmail.com on 13 Feb 2013 at 9:02