How to find what name and where the (bluetooth) library is located?
-
It is against my conviction to use "blueZ' but .... I am trying locate the actual library to link my program with. From experience I know the file names change so I really do not know what to search for bluez ... bluetooth..libbluetooth... libbluetooth.so... I decided to remove and install and hoped for answers.. No go! What name am I looking for and where is such file located? Cheers q5@q5-desktop:~$ sudo apt-get remove libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libbluetooth-dev 0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded. After this operation, 847 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 195509 files and directories currently installed.) Removing libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$ sudo apt-get install libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following NEW packages will be installed: libbluetooth-dev 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 0 B/252 kB of archives. After this operation, 847 kB of additional disk space will be used. Selecting previously unselected package libbluetooth-dev:amd64. (Reading database ... 195466 files and directories currently installed.) Preparing to unpack .../libbluetooth-dev_5.60-0ubuntu2.2_amd64.deb ... Unpacking libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... Setting up libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$
-
It is against my conviction to use "blueZ' but .... I am trying locate the actual library to link my program with. From experience I know the file names change so I really do not know what to search for bluez ... bluetooth..libbluetooth... libbluetooth.so... I decided to remove and install and hoped for answers.. No go! What name am I looking for and where is such file located? Cheers q5@q5-desktop:~$ sudo apt-get remove libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libbluetooth-dev 0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded. After this operation, 847 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 195509 files and directories currently installed.) Removing libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$ sudo apt-get install libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following NEW packages will be installed: libbluetooth-dev 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 0 B/252 kB of archives. After this operation, 847 kB of additional disk space will be used. Selecting previously unselected package libbluetooth-dev:amd64. (Reading database ... 195466 files and directories currently installed.) Preparing to unpack .../libbluetooth-dev_5.60-0ubuntu2.2_amd64.deb ... Unpacking libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... Setting up libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$
Short answer is you don't need to know. When linking your program with
-lbluetooth
should be enough, if it's installed in the usual place. Depending on what your development environment is, you can use pkg-config to tell you what flags you need to use to find headers and libs e.gk5054@localhost:~$ pkg-config --cflags bluez
k5054@localhost:~$ pkg-config --libs bluez
-lbluetooth
k5054@localhost:~$This tells us that we don't need any additional flags for compilation, and only need to add -lbluetooth when linking. If you really want to know where the lib is, you can use
dpkg
to tell you where it isk5054@localhost:~$ dpkg -S libbluetooth | grep .so
libbluetooth3:amd64: /usr/lib/x86_64-linux-gnu/libbluetooth.so.3
libbluetooth3:amd64: /usr/lib/x86_64-linux-gnu/libbluetooth.so.3.19.3
libbluetooth-dev:amd64: /usr/lib/x86_64-linux-gnu/libbluetooth.so
k5054@localhost:~$Note that debian/ubuntu uses the target architecture as part of the filename for libraries, so for a PI with a 32 bit Raspberry Pi OS, the path is
/usr/lib/arm-linux-gnueabihf/libbluetooth.so.3
, and it would be different again for a PI with a 64-bit OS, or an i386, MIPS, etc.Keep Calm and Carry On
-
It is against my conviction to use "blueZ' but .... I am trying locate the actual library to link my program with. From experience I know the file names change so I really do not know what to search for bluez ... bluetooth..libbluetooth... libbluetooth.so... I decided to remove and install and hoped for answers.. No go! What name am I looking for and where is such file located? Cheers q5@q5-desktop:~$ sudo apt-get remove libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libbluetooth-dev 0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded. After this operation, 847 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 195509 files and directories currently installed.) Removing libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$ sudo apt-get install libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following NEW packages will be installed: libbluetooth-dev 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 0 B/252 kB of archives. After this operation, 847 kB of additional disk space will be used. Selecting previously unselected package libbluetooth-dev:amd64. (Reading database ... 195466 files and directories currently installed.) Preparing to unpack .../libbluetooth-dev_5.60-0ubuntu2.2_amd64.deb ... Unpacking libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... Setting up libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$
Member 14968771 wrote:
The following NEW packages will be installed: libbluetooth-dev
So the option to use in your build should be
-lbluetooth-dev
. But you also need to check that it is installed in one of the automatically searched locations. The names of these will be in the environment variableLD_LIBRARY_PATH
. If the library is not in one of those places then you can: 1. Add its name to the envoronment variable, or 2. Use the -L option on the build. -
It is against my conviction to use "blueZ' but .... I am trying locate the actual library to link my program with. From experience I know the file names change so I really do not know what to search for bluez ... bluetooth..libbluetooth... libbluetooth.so... I decided to remove and install and hoped for answers.. No go! What name am I looking for and where is such file located? Cheers q5@q5-desktop:~$ sudo apt-get remove libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libbluetooth-dev 0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded. After this operation, 847 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 195509 files and directories currently installed.) Removing libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$ sudo apt-get install libbluetooth-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following NEW packages will be installed: libbluetooth-dev 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 0 B/252 kB of archives. After this operation, 847 kB of additional disk space will be used. Selecting previously unselected package libbluetooth-dev:amd64. (Reading database ... 195466 files and directories currently installed.) Preparing to unpack .../libbluetooth-dev_5.60-0ubuntu2.2_amd64.deb ... Unpacking libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... Setting up libbluetooth-dev:amd64 (5.60-0ubuntu2.2) ... q5@q5-desktop:~$
nice