gattlib icon indicating copy to clipboard operation
gattlib copied to clipboard

Make throws an error when building GATTLIB

Open PTmv opened this issue 6 years ago • 4 comments

When trying to build gattlib for Raspbian GNU/Linux v 9 (stretch) for Raspberry Pi 3 on Ubuntu v 16.04.2, having installed BlueZ v 5.49 and Linaro cross-compiler v 4.9, I am getting the following error when running MAKE command:

$ make [ 1%] Building C object bluez/CMakeFiles/gattlib.dir/gattlib_adapter.c.o In file included from /home/ptomov/Toolchains/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed/syslimits.h:7:0, from /home/ptomov/Toolchains/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed/limits.h:34, from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:11, from /usr/include/glib-2.0/glib/gtypes.h:32, from /usr/include/glib-2.0/glib/galloca.h:32, from /usr/include/glib-2.0/glib.h:30, from /home/ptomov/Downloads/GATTLIB/gattlib-master/bluez/gattlib_internal.h:27, from /home/ptomov/Downloads/GATTLIB/gattlib-master/bluez/gattlib_adapter.c:1: /home/ptomov/Toolchains/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/4.9.3/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory #include_next <limits.h> /* recurse down to the real one */ ^ compilation terminated. bluez/CMakeFiles/gattlib.dir/build.make:62: recipe for target 'bluez/CMakeFiles/gattlib.dir/gattlib_adapter.c.o' failed make[2]: *** [bluez/CMakeFiles/gattlib.dir/gattlib_adapter.c.o] Error 1 CMakeFiles/Makefile2:85: recipe for target 'bluez/CMakeFiles/gattlib.dir/all' failed make[1]: *** [bluez/CMakeFiles/gattlib.dir/all] Error 2 Makefile:149: recipe for target 'all' failed make: *** [all] Error 2

I have installed in my Ubuntu system libc:i386 with version 2.23-0ubuntu10. I have also applied the fix in: https://github.com/labapart/gattlib/issues/66. The problem still persists. Please advise me how to solve this problem. Thanks.

PTmv avatar Apr 17 '18 21:04 PTmv

I was able to successfully build GATTLIB in my Raspberry Pi 3 board. The settings were:

1- Downloaded and unzipped GATTLIB sources to /home/pi/Downloads folder as directed in https://github.com/labapart/gattlib.

2- Created a /build folder in cd /home/pi/Downloads/gattlib-src-root and selected it:

  • $ cd /home/pi/Downloads/gattlib-src-root/gattlib-master
  • $ mkdir build && cd build

3- Created environmental variables:

  • environmental variable to the Raspbian gcc ARM-64 cross-compiler(s): $ export CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
  • verified that there is access to the cross-compiler: $ arm-linux-gnueabihf-gcc -v
  • environmental variable to the Raspbian /lib/, /opt, and /usr folders: $ SYSROOT=/

4- Fixed the file CMakeLists.txt in cd /home/pi/Downloads/gattlib-src-root/gattlib-master folder in order to reflect the relation between BlueZ and DBus versions correctly:

  • L.52: was: set(GATTLIB_DBUS FALSE), is: set(GATTLIB_DBUS TRUE)
  • L. 60: was: set(GATTLIB_DBUS TRUE), is: set(GATTLIB_DBUS FALSE)

5- Compiled: $ cmake ..

6- Built: $ make

There was just one warning about a unused variable ‘len’ in /home/pi/Downloads/gattlib-src-root/gattlib-master/bluez/gattlib_adapter.c:91:6.

7- Tried to package the ouput $ cpack ..

But got errors:

CPack: Create package using DEB CPack: Install projects CPack: - Run preinstall target for: gattlib CPack: - Install project: gattlib CPack: Create package CPack: - package: /home/pi/Downloads/gattlib-src-root/gattlib-master/build/gattlib_0.2-dev_armhf.deb generated. CPack: Create package using RPM CPack: Install projects CPack: - Run preinstall target for: gattlib CPack: - Install project: gattlib CPack: Create package CMake Error at /usr/share/cmake-3.7/Modules/CPackRPM.cmake:1573 (message): RPM package requires rpmbuild executable Call Stack (most recent call first): /usr/share/cmake-3.7/Modules/CPackRPM.cmake:2442 (cpack_rpm_generate_package)

CPack Error: Error while execution CPackRPM.cmake CPack Error: Problem compressing the directory CPack Error: Error when generating package: gattlib

Please advise me how to solve this problem in Raspberry Pi3. I still would like to make a successful build in Ubuntu also.

PTmv avatar Apr 18 '18 01:04 PTmv

After installing RPM in Raspberry Pi 3 by using: $ sudo apt-get install rpm I was able to package the build: CPack: - package: /home/pi/Downloads/gattlib-src-root/gattlib-master/build/gattlib_0.2-dev_armhf.zip generated.

Still I would like to build GATTLIB in Ubuntu. Please advise me how to do this.

PTmv avatar Apr 18 '18 16:04 PTmv

When I tried to install gattlib from /home/pi/Downloads/gattlib-src-root/gattlib-master/build folder with: $ sudo apt-get install gattlib

it reported:

Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package gattlib

Please advise me how to solve this problem Thanks

PTmv avatar Apr 19 '18 20:04 PTmv

I got help. sudo dpkg -i gattlib_0.2-dev_armhf.deb was the correct command.

PTmv avatar Apr 20 '18 02:04 PTmv