在编译前我已经做好了D-bus1.8.10,glib2.28.6,bluez-libs-3.36,bluez-utils-3.36的编译,并且已经设置好了环境,如果遇到明明已经成功了编译,却找不到编译后的库文件,可以参考http://blog.csdn.net/wang_shuai_ww/article/details/41720841。
我这里在完成上面说的之后,编译bluez-5.25遇到的问题如下:
首先是找不到libudev。
这个错误使用命令sudo apt-get install libudev-dev。如果使用的是Ubuntu的官方源,可能会报错,具体的解决方法,参考http://blog.csdn.net/wang_shuai_ww/article/details/41720605。
安装完之后,再次配置出现error: libical is required的错误,找不到 libical 。
解决方法同上sudo apt-get install libical-dev,如果参考http://blog.csdn.net/wang_shuai_ww/article/details/41720605已经修改了源,那么这一步是没有问题的。
然后又报错error: readline header files are required,这个可以参考http://blog.chinaunix.net/uid-20196318-id-3930371.html或者http://ubuntuforums.org/showthread.php?t=1670531,实际上使用sudo apt-get install libreadline-dev命令即可。如果使用的arm编译器没有改头文件,即使安装了,可能仍然解决不了,这时只需要把宿主机的/usr/includereadline整个目录拷贝到自己的arm-linux的编译器的usr/include目录下即可。不同的arm编译器可能路径不同,我这里的路径是/usr/local/arm/arm-cortex_a9-eabi-4.7/arm-cortex_a9-linux-gnueabi/sysroot/usr/include/。
然后还有错误checking systemd system unit dir... configure: error: systemd system unit directory is required,错误真多,烦死人。
该错误可以参考http://askubuntu.com/questions/343663/ubuntu-13-04-and-bluez-5-8-configure-error-systemd-system-unit-directory-is-re,具体的就是加上编译选项--sysconfdir=/etc
--localstatedir=/var --enable-experimental --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd
重新配置,终于大功告成。
附上配置的整个流程:
checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for arm-strip... no checking for strip... strip checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk 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 arm-gcc... arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include accepts -g... yes checking for arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include option to accept ISO C89... none needed checking dependency style of arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include... gcc3 checking how to run the C preprocessor... arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include -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 arm-pkg-config... no checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for C/C++ restrict keyword... __restrict checking for arm-gcc... (cached) arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include checking whether we are using the GNU C compiler... (cached) yes checking whether arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include accepts -g... (cached) yes checking for arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include option to accept ISO C89... (cached) none needed checking dependency style of arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include... (cached) gcc3 checking whether arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include and cc understand -c and -o together... yes checking whether arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include accepts -fPIE... yes checking build system type... arm-cortex_a9-linux-gnueabi checking host system type... arm-unknown-none 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 arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include... /usr/local/arm/arm-cortex_a9-eabi-4.7/arm-cortex_a9-linux-gnueabi/bin/ld checking if the linker (/usr/local/arm/arm-cortex_a9-eabi-4.7/arm-cortex_a9-linux-gnueabi/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... no checking for arm-dumpbin... no checking for arm-link... no checking for dumpbin... no checking for link... link -dump checking the name lister (nm) 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 checking how to convert arm-cortex_a9-linux-gnueabi file names to arm-unknown-none format... func_convert_file_noop checking how to convert arm-cortex_a9-linux-gnueabi file names to toolchain format... func_convert_file_noop checking for /usr/local/arm/arm-cortex_a9-eabi-4.7/arm-cortex_a9-linux-gnueabi/bin/ld option to reload object files... -r checking for arm-objdump... no checking for objdump... objdump checking how to recognize dependent libraries... unknown checking for arm-dlltool... no checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for arm-ar... no checking for ar... ar checking for archiver @FILE support... @ checking for arm-strip... strip checking for arm-ranlib... no checking for ranlib... ranlib checking command to parse nm output from arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include object... ok checking for sysroot... no checking for arm-mt... no checking for mt... mt checking if mt is a manifest tool... no checking for dlfcn.h... yes checking for objdir... .libs checking if arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include supports -fno-rtti -fno-exceptions... no checking for arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include option to produce PIC... -fPIC -DPIC checking if arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include PIC flag -fPIC -DPIC works... yes checking if arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include static flag -static works... yes checking if arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include supports -c -o file.o... yes checking if arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include supports -c -o file.o... (cached) yes checking whether the arm-cortex_a9-linux-gnueabi-gcc -L/wsh_space/my_install/usr/lib/lib -I/wsh_space/my_install/usr/lib/include linker (/usr/local/arm/arm-cortex_a9-eabi-4.7/arm-cortex_a9-linux-gnueabi/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... no checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... no checking whether to build shared libraries... no checking whether to build static libraries... yes 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 for GLIB... yes checking for DBUS... yes checking D-Bus configuration directory... /wsh_space/my_install/usr/lib/etc checking D-Bus system bus services dir... /wsh_space/my_install/usr/lib/share/dbus-1/system-services checking D-Bus session bus services dir... /wsh_space/my_install/usr/lib/share/dbus-1/services checking for UDEV... yes checking for udev_hwdb_new in -ludev... no 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 configure: creating ./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
这里做个记录,希望能够解决其他人碰到的此类问题。