Skip to contentSkip to conversation

Error compiling bluez-utils for buildroot/ARM

Bluez-devel Stephan Henningsen 2 participants 7 messages Mar 17, 2005 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,

This is not about a bug in bluez-utils, but I would like some help integrating BlueZ into the buildroot crossplatform environment.

I've made two packages (i.e. Config.in and .mk file) for the buildroot environment, that should support bluez-libs and bluez-utils. The libs appear to install smoothly, but the utils fail during configure.

I've attached both the packages in a .tar.gz which can be extracted into buildroot/package/ where it will create both BlueZ packages. These packages basically delegate to the Makefile of BlueZ, so you guys should be home free ;)

The attached packages result in this error, when installing bluez-libs:

sth@speedball:~/au/buildroot$ make bluez-utils-dirclean bluez-utils
rm -rf /home/sth/au/buildroot/build_arm/bluez-utils-2.15
zcat /home/sth/au/buildroot/dl/bluez-utils-2.15.tar.gz | tar -C /home/sth/au/buildroot/build_arm -xf -
touch /home/sth/au/buildroot/build_arm/bluez-utils-2.15/.source
(cd /home/sth/au/buildroot/build_arm/bluez-utils-2.15; \
PATH=/home/sth/au/buildroot/build_arm/staging_dir/bin:/bin:/sbin:/usr/bin:/usr/sbin AR=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-ar AS=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-as LD=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-ld NM=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-nm CC=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc GCC=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc CXX=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-g++ RANLIB=/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-ranlib \
        CFLAGS="-Os -pipe " \
        ./configure \
        --target=arm-linux \
        --host=arm-linux \
        --build=i386-pc-linux-gnu \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --libexecdir=/usr/lib \
        --datadir=/usr/share \
        --sysconfdir=/etc \
        --localstatedir=/var \
        --infodir=/usr/info \
        --mandir=/usr/man \
        --with-bluez=/usr \

);
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
...
...
...
checking bluetooth/bluetooth.h usability... yes
checking bluetooth/bluetooth.h presence... yes
checking for bluetooth/bluetooth.h... yes
checking for hci_open_dev in -lbluetooth... no
configure: error: Bluetooth library not found
make: *** [/home/sth/au/buildroot/build_arm/bluez-utils-2.15/.configured] Error 1 sth@speedball:~/au/buildroot$

If I add --libdir=${TARGET_DIR}/usr/lib (which expands to --libdir=/home/sth/au/buildroot/build_arm/root/usr/lib) to the configure command, the configuring succeeds, but compilation fails:

...

/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc -I/usr/include -DDBUS_API_SUBJECT_TO_CHANGE -Os -pipe -o hcid main.o security.o storage.o lib.o parser.o lexer.o kword.o glib-ectomy.o -L/home/sth/au/buildroot/build_arm/root/usr/lib -lbluetooth
lexer.o(.text+0x7e0): In function `yy_get_next_buffer':
: undefined reference to `_IO_getc'
collect2: ld returned 1 exit status
make[3]: *** [hcid] Error 1
make[3]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15/hcid' make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15' make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15'
make: *** [/home/sth/au/buildroot/build_arm/bluez-utils-2.15/src/l2ping.o] Error 2 sth@speedball:~/au/buildroot$

I am new to buildroot and not very experinced with compiler flags, especially not in a cross-compile environment. For all I know, the extra --libdir may very well result in a hardcoded path, that doesn't resolve on the target system.

Any help is appreciated as I am stuck!

Signature · 1 line
Stephan Henningsen
maintainer
#1 lore raw

Hi Stephan,

Quoted 6 lines

If I add --libdir=${TARGET_DIR}/usr/lib (which expands to --libdir=/home/sth/au/buildroot/build_arm/root/usr/lib) to the configure command, the configuring succeeds, but compilation fails:

...

Quoted 8 lines

/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc
-I/usr/include -DDBUS_API_SUBJECT_TO_CHANGE -Os -pipe -o hcid
main.o security.o storage.o lib.o parser.o lexer.o kword.o
glib-ectomy.o -L/home/sth/au/buildroot/build_arm/root/usr/lib
-lbluetooth
lexer.o(.text+0x7e0): In function `yy_get_next_buffer':
: undefined reference to `_IO_getc'
collect2: ld returned 1 exit status

this looks like we have a problem with the generated code for the parser. Try to remove parser.[ch] and lexer.c. Maybe you need to add another library for the target platform to provide _IO_getc().

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Hi,

Quoted 3 lines · Marcel Holtmann

this looks like we have a problem with the generated code for the parser. Try to remove parser.[ch] and lexer.c. Maybe you need to add another library for the target platform to provide _IO_getc().

I am not sure what you mean, but I did the following with the same unsuccessful result:

From buildroot/ I did:

sth@speedball:~/au/buildroot$ make bluez-utils-cleandir \
				bluez-utils-configure
<blahblah..successful>
sth@speedball:~/au/buildroot$ rm \
			build_arm/bluez-utils-2.15/*/parser.[ch] \
			build_arm/bluez-utils-2.15/*/lexer.c -fv
removed `build_arm/bluez-utils-2.15/hcid/parser.c'
removed `build_arm/bluez-utils-2.15/hcid/parser.h'
removed `build_arm/bluez-utils-2.15/rfcomm/parser.c'
removed `build_arm/bluez-utils-2.15/rfcomm/parser.h'
removed `build_arm/bluez-utils-2.15/hcid/lexer.c'
removed `build_arm/bluez-utils-2.15/rfcomm/lexer.c'
sth@speedball:~/au/buildroot$ make bluez-utils 

<blahblah>
/home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc -I/usr/include -DDBUS_API_SUBJECT_TO_CHANGE -Os -pipe -L/home/sth/au/buildroot/build_arm/root/usr/lib -o hcid main.o security.o storage.o lib.o parser.o lexer.o kword.o glib-ectomy.o
-lbluetooth
lexer.o(.text+0x7e0): In function `yy_get_next_buffer':
: undefined reference to `_IO_getc'
collect2: ld returned 1 exit status
make[3]: *** [hcid] Error 1
make[3]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15/hcid'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15'
make: *** [/home/sth/au/buildroot/build_arm/bluez-utils-2.15/src/l2ping.o] Error 2
sth@speedball:~/au/buildroot$

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#3 lore raw

Hi Stephan,

Quoted 36 lines
Quoted 3 lines

this looks like we have a problem with the generated code for the parser. Try to remove parser.[ch] and lexer.c. Maybe you need to add another library for the target platform to provide _IO_getc().

I am not sure what you mean, but I did the following with the same unsuccessful result:

From buildroot/ I did:

sth@speedball:~/au/buildroot$ make bluez-utils-cleandir \
				bluez-utils-configure
<blahblah..successful>
sth@speedball:~/au/buildroot$ rm \
			build_arm/bluez-utils-2.15/*/parser.[ch] \
			build_arm/bluez-utils-2.15/*/lexer.c -fv
removed `build_arm/bluez-utils-2.15/hcid/parser.c'
removed `build_arm/bluez-utils-2.15/hcid/parser.h'
removed `build_arm/bluez-utils-2.15/rfcomm/parser.c'
removed `build_arm/bluez-utils-2.15/rfcomm/parser.h'
removed `build_arm/bluez-utils-2.15/hcid/lexer.c'
removed `build_arm/bluez-utils-2.15/rfcomm/lexer.c'
sth@speedball:~/au/buildroot$ make bluez-utils 

<blahblah> /home/sth/au/buildroot/build_arm/staging_dir/bin/arm-linux-uclibc-gcc

(quoted diff) +0 -2
-I/usr/include -DDBUS_API_SUBJECT_TO_CHANGE  -Os -pipe 
-L/home/sth/au/buildroot/build_arm/root/usr/lib -o hcid  main.o 

security.o storage.o lib.o parser.o lexer.o kword.o glib-ectomy.o
-lbluetooth
lexer.o(.text+0x7e0): In function `yy_get_next_buffer':
: undefined reference to `_IO_getc'
collect2: ld returned 1 exit status
make[3]: *** [hcid] Error 1
make[3]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15/hcid' make[2]: *** [all-recursive] Error 1

Quoted 8 lines

make[2]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/sth/au/buildroot/build_arm/bluez-utils-2.15'
make: *** [/home/sth/au/buildroot/build_arm/bluez-utils-2.15/src/l2ping.o] Error 2 sth@speedball:~/au/buildroot$

then you must find the library that provides _IO_getc() or replace yacc or bison to generate correct code for your platform.

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw
Quoted 2 lines

then you must find the library that provides _IO_getc() or replace yacc or bison to generate correct code for your platform.

Please se my other message. I don't think the library is the problem, as I can build without it, if I issue make manually.

Signature · 12 lines
Stephan.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
#5 lore raw
In reply to Marcel Holtmann

Ok, I've discovered some weird things, one of them may very well be a bug in the build scripts of bluez-libs which isn't normally unless compiling for another target.

Any help clairfying these errors would be of great help:

Bluez-libs: --------------------------------------------------------

I cannot get bluez-libs installed where I want; The header files and the library files seem to install relative to different paths.

First of all, I configure bluez-libs like this (in my buildroot script, bluez-libs.mk):

$(BLUEZLIBS_DIR)/.configured: $(BLUEZLIBS_DIR)/.source

	(cd $(BLUEZLIBS_DIR); \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)" \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libexecdir=/usr/lib \
		--sysconfdir=/etc \
		--datadir=/usr/share \
		--localstatedir=/var \
		--mandir=/usr/man \
		--infodir=/usr/info \
	);
	touch $(BLUEZLIBS_DIR)/.configured;

Now I use two different install-targets to cover a complete installation:

First I have my install-target do this:

	$(MAKE) prefix=$(TARGET_DIR)/usr -C $(BLUEZLIBS_DIR) install

..which results in this error durring installation (line breaks in the e-mail make everything even more difficult, so I've added the '\' to join breaked lines):

/bin/sh ../libtool --mode=install /usr/bin/install -c \
libbluetooth.la /usr/lib/libbluetooth.la

/usr/bin/install -c .libs/libbluetooth.so.1.0.15 \
			/usr/lib/libbluetooth.so.1.0.15

/usr/bin/install: cannot remove `/usr/lib/libbluetooth.so.1.0.15': \
Permission denied

Seems to me like the library files ignore the DESTIDIR. The header files, however, are installed properly under $(TARGET_DIR)/usr/include (bluetooth/bluetooth.h and friends).

Now I change my install-target to do this (added DESTDIR):

	$(MAKE) DESTDIR=$(TARGET_DIR) prefix=$(TARGET_DIR)/usr \
		-C $(BLUEZLIBS_DIR) install

..which installs incorrectly but without any error messages. The library files are installed $(TARGET_DIR)/usr/lib BUT the header files are installed under $(TARGET_DIR)/home/sth/au/buildroot/build_arm/root/usr/include where $(TARGET_DIR) is in fact /home/sth/au/buildroot/build_arm/root.

So two different prefixes are in use (with my current and possibly wrong configuration).

Anyway! Though errors occured and files are dublicated and misplaced, at least now bluez-libs is installed completely on the target system! ;) This brings me to my second problem with bluez-utils.

Bluez-utils: -------------------------------------------------------

This is weird: I can build the bluez-utils manually, i.e. without the help of buildroot's scripts but with the help of its toolchain), but still not the right way (with buildroot's script).

For building bluez-tools manually I do this:

sth@speedball:~/au/buildroot$ make bluez-utils-dirclean
sth@speedball:~/au/buildroot$ make bluez-utils-source
sth@speedball:~/au/buildroot$ cd build_arm/
sth@speedball:~/au/buildroot/build_arm$ tar zxfv \
	../dl/bluez-utils-2.15.tar.gz
sth@speedball:~/au/buildroot/build_arm$ cd bluez-utils-2.15/
sth@speedball:~/au/buildroot/build_arm/bluez-utils-2.15$ export \
	PATH=/home/sth/au/buildroot/build_arm/staging_dir/bin/:$PATH
sth@speedball:~/au/buildroot/build_arm/bluez-utils-2.15$ \
	LDFLAGS="-L/home/sth/au/buildroot/build_arm/root/" \
	./configure --host=arm-linux-uclibc \
	--build=i686-pc-linux-gnu \
	--prefix="/home/sth/au/buildroot/build_arm/root/usr"

This builds bluez-libs successfully!

But doing it the buildroot-way like this, fails:

The configure target:

	(cd $(BLUEZUTILS_DIR); \
		$(TARGET_CONFIGURE_OPTS) \
		LDFLAGS="-L$(TARGET_DIR)/usr/lib" \
		CFLAGS="$(TARGET_CFLAGS)" \
		CPPFLAGS="-I$(TARGET_DIR)/usr/include" \
		./configure \
		--target=$(GNU_TARGET_NAME) \
		--host=$(GNU_TARGET_NAME) \
		--build=$(GNU_HOST_NAME) \
		--prefix=/usr \
		--exec-prefix=/usr \
		--bindir=/usr/bin \
		--sbindir=/usr/sbin \
		--libexecdir=/usr/lib \
		--libdir=$(TARGET_DIR)/usr/include \
		--includedir=$(TARGET_DIR)/usr/include \
		--datadir=/usr/share \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--infodir=/usr/info \
		--mandir=/usr/man \
		--with-bluez=/usr \
	);
	touch $(BLUEZUTILS_DIR)/.configured;

The compile target:

	$(MAKE) DESTDIR=$(TARGET_DIR) prefix=$(TARGET_DIR)/usr \
		-C $(BLUEZUTILS_DIR) install

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw
Quoted 3 lines

Bluez-libs: --------------------------------------------------------

I cannot get bluez-libs installed where I want; The header files and the library files seem to install relative to different paths.

This part works now. Seems like I did mess up the parameters after all. So bluez-libs compiles and installes correctly now, ie. no errors and the files appear in the tree as expected.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel