OK , this may be the last post on this subject.
To implement bluez package usable for C++ development, one starts with "configure".
This script is "automatically generated"(?) and guesses many usable options / parameters to be implemented when the bluez package is actually installed - either by make and make install or checkinstall.
I took the liberty to edit it and here is a basic , no options provided output.
sudo bash configure_edit
[sudo] password for jim:
@ line # 53 **** CONFIGURE EDIT *****
**** CONFIGURE EDIT **** checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking how to create a pax tar archive... gnutar
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
3716 **** CONFIGURE EDIT **** checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for pkg-config... /usr/bin/pkg-config
configure_edit: *** CONFIGURE EDIT *** WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for C/C++ restrict keyword... __restrict
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking whether gcc accepts -fPIE... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
6586 ***CONFIGURE EDIT *** why build NAME to host FORMAT ??? checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
6643 ***CONFIGURE EDIT **** buidl name to toolchain format ??? checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
12829 ***CONFIGURE EDIT *** checking if libtool supports shared libraries... yes
12834 ***CONFIGURE EDIT *** checking whether to build shared libraries... yes
12863 ***CONFIGURE EDIT *** checking whether to build static libraries... no
checking for signalfd... yes
checking for clock_gettime in -lrt... yes
checking for pthread_create in -lpthread... yes
checking for dlopen in -ldl... yes
checking linux/types.h usability... yes
checking linux/types.h presence... yes
checking for linux/types.h... yes
checking linux/if_alg.h usability... yes
checking linux/if_alg.h presence... yes
checking for linux/if_alg.h... yes
checking for GLIB... yes
checking for DBUS... yes
checking D-Bus configuration directory... /etc
checking D-Bus system bus services dir... /usr/share/dbus-1/system-services
checking D-Bus session bus services dir... /usr/share/dbus-1/services
checking for UDEV... yes
checking for udev_hwdb_new in -ludev... yes
checking udev directory... /lib/udev
checking for ICAL... yes
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking systemd system unit dir... /lib/systemd/system
checking systemd user unit dir... /usr/lib/systemd/user
checking that generated files are newer than configure... done
configure_edit: creating ./config.status
@ line # 14959 **** CONFIGURE EDIT ***** executing config.status ?
config.status: creating Makefile
config.status: creating src/bluetoothd.8
config.status: creating lib/bluez.pc
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
I do not expect the forum to analyze the enclosed, but please note highlighted.
In my view - the "configure" found the not optioned triplet, is agreeable to build shared libraries etc.
The most important part is the LAST line - that SHOULD actually build the NOT requested libbluetooth.so file of NOT specified , correctly guessed x86 architecture.
The "configure" output looks much different when both --host and --build are optioned.
End of story.
Sorry, little hard to figure out what you are trying to say.
Just for update
I am using bluez source to build a C++ library for specific (--host= arm) architecture using (--build=x86) architecture.
It supposedly works, but not for me.
I am in process of analyzing the "lead script" - configure - to find out how it should process the options. It is a slow process.
You can fix that by editing /etc/apt/sources.list and changing all the lines that start
deb [arch=amd64,i386] http://...
and add the ubuntu ports repo
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports bionic main universe
However, that doesn't help a lot - then you get:
sudo apt-get install libbluetooth-dev:armhf
Reading package lists... Done
Building dependency tree<br />
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:
The following packages have unmet dependencies:
libbluetooth-dev:armhf : Depends: libbluetooth3:armhf (= 5.48-0ubuntu3) but it is not going to be installed
Depends: libc6-dev:armhf but it is not going to be installed or
E: Unable to correct problems, you have held broken packages.
I tried following along by adding all the dependencies manually e.g.
thinking I'd eventually get all the dependencies were added, but then you get to gcc-8-base:armhf and you get this
$ sudo apt-get install gcc-8-base:armhf
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
amd64-microcode gcc-7-arm-linux-gnueabihf-base gcc-7-cross-base
gcc-8-cross-base libasan4-armhf-cross libatomic1-armhf-cross
libc6-armhf-cross libc6-dev-armhf-cross libcilkrts5-armhf-cross
libgcc-7-dev-armhf-cross libgcc1-armhf-cross libgomp1-armhf-cross
libstdc++6-armhf-cross libubsan0-armhf-cross linux-libc-dev
linux-libc-dev-armhf-cross m17n-db manpages-dev ncurses-term vim-gui-common
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
accountsservice acl acpi-support acpid adduser adwaita-icon-theme aisleriot
alsa-base alsa-utils anacron apg apparmor apport apport-gtk appstream apt
[ ... about 300 lines removed ...]
xserver-xorg-video-vesa xserver-xorg-video-vmware xul-ext-ubufox xwayland
xxd xz-utils yelp zeitgeist-core zenity zip zlib1g
The following NEW packages will be installed:
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
apt adduser (due to apt) gpgv (due to apt) libapt-pkg5.0 (due to apt)
libc6 (due to apt) libgcc1 (due to apt) libgnutls30 (due to apt)
[ .. more lines removed ...]
0 upgraded, 1 newly installed, 1421 to remove and 0 not upgraded.
Need to get 18.2 kB of archives.
After this operation, 3,343 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
$ apt list --installed 2>/dev/null | wc -l1648
So that's not the way to go, either. There seems to be something broken with Ubuntu's foreign-arch handling.
Debian and Ubuntu are very close, so maybe you could switch to Debian for your PC rather than Ubuntu - otherwise, you could try installing virtualbox or VmWare, and install Debian as a guest OS. Guest OS's run only very slightly slower than the host. For example, it took about 4 minutes to compile the source code for postgresql-11.1 on my host, and about 4:30 on the guest. Not much in it, and eclipse is available for Debian, so you should be at home. If you run your host in full-screen mode, you'd hardly be aware you're not running the OS natively on the PC.
I got "virtualbox" loaded , but after selecting Debian as OS I get "no bootable medium...process halted ". It actually asked for "optical disk" to use as boot (?)
I'll try different "virtual disk" next try.
$ file debian-9.8.0-amd64-netinst.iso
debian-9.8.0-amd64-netinst.iso: ISO 9660 CD-ROM filesystem data (DOS/MBR boot sector) 'Debian 9.8.0 amd64 n' (bootable)
$ md5sum debian-9.8.0-amd64-netinst.iso
In VitrualBox Manager, select your guest image, settings -> storage. Select Controler IDE, then the ()Empty slot. The right pane should show Optical Drive : [IDE Secondary Master v]. CLick on the icon next to that. If the iso image is in the drop-down, select it, otherwise select [Choose Virtual Optical Drive ...] navigate to your iso image and select. Under storage tree -> Controller:IDE it should now show "debian-9.8.0 amd64-netinst.iso"
Boot and install .... hopefully
Couple of things ...
If you want to ssh into the guest from the host, change the Network Adapter from NAT to Bridged or Host only (see the help file for the difference). In either case you'll need to either have a DHCP server or configure the IP manually.
By default the disk size is 8GB - that's barely big enough to install Debian with a GUI. You should probably have at least 16GB of drive space.
This is part of README file included in BlueZ.
Here is a part I am not sure about.
Could somebody please translate this techno-talk to plain English (talk ) ?
For a working system, certain configuration options need to be enabled:
Of course I want working system
Enable installation of Bluetooth library
What is the name of this library and where is it going to be installed ?
Installed by configure itself or make / make install?
By default the Bluetooth library is no longer installed.
The user interfaces or command line utilities do not
require an installed Bluetooth library anymore. This
option is provided for legacy third party applications
that still depend on the library.
When the library installation is enabled, it is a good
idea to use a separate bluez-library or libbluetooth
package for it.Any suggestion HOW to do the above highlighted text ?
Build a NEW packages??
You'll probably get better results if you direct your questions to the bluez user mailing list. While people here can answer questions of a general nature, specific questions relating to a specific package are, I think, outside of the intended scope of this forum. That doesn't mean that someone with related experience won't respond just because its out of scope (though that might be the case), but those with the information you seek are more likely to be in the user-group/mailing lists for that package.
I agree with k5054, and have already suggested you go to the Bluez site. While I have a reasonable knowledge of Linux, configurable packages, compiling and linking etc., all your questions are specific to Bluez. And I (and I guess k5054) have no experience of this package or how it is put together.
I am trying to figure out how BlueZ is actually used , so I did purge Bluez.
There is no package "Bluez".
Before that I fully configured Bluez - and I added enable-library to the configuration.
I did not even run make make install and tested my app and it run with the -lbluetooth linker option.
It appears the "bluetooth" library was build by running BlueZ -> configure and "purge Bluez" won't delete it.
I like to prove this by deleting it manually, but need to know where it is.
Not sure exactly what your question is, but "make clean" should purge all the generated objects. To be honest you may get better answers at The BlueZ website[^]; that's where the knowledge is likely to be.
As has been explained before, -lbluetooth tells the linker to look for a library file named either libbluetooth.so or libbluetooth.a. Your find doesn't find it because -name option uses standard file globbing so -name "bluetooth.*" wont find any files that look like .../libbluetooth.a. You need to use -name "libbluetooth.*", or -name "*bluetooth.*"
I think you said you had built and installed bluez from source. Unless you changed the installation location, it probably put the libraries under /usr/local. When you purged bluez (I'm assuming you mean the command apt-get delete --purge bluez), that will only remove the packages installed by apt. Any packages you built and installed yourself will not be touched (unless you deliberately configured the package to overwrite the system packages).
using --prefix=/usr put all the generated files in /usr. If you still have your build directory, you should be able to remove everything with using make uninstall. If you've already deleted your build directory, then unpack the source again, re-run configure as you did before, then run make uninstall. Note that installing into /usr means that you've overwritten anything that apt installed previously, so you might end up with the apt thinking thinking that some of its files have gone missing. If you plan to build a cross-compilation library DO NOT USE --prefix=/usr. That will overwrite the X86 executables, libraries, etc with the ARM versions, which will lead to further pain on your part. If you still want to create a cross-compile bluez instalation, use --prefix=/usr/local/arm --sysconfdir=/usr/local/arm/etc --localstatedir=/usr/local/arm/var. Of course, you can use any path you wish in place of "/usr/local/arm", just not "/usr" or "/", as that will overwrite your X86 system files.
Last Visit: 31-Dec-99 18:00 Last Update: 28-Jul-21 17:59