编译bluez-5.25 遇到的错误及解决方法
在編譯前我已經做好了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
最后的配置命令是:./configure --prefix=/wsh_space/my_install/usr/lib/lib --host=arm --build=arm-cortex_a9-linux-gnueabi CC=arm-cortex_a9-linux-gnueabi-gcc --sysconfdir=/etc --localstatedir=/var --enable-experimental --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd
一定要注意CC后面的編譯器,千萬不要加上D-bus1.8.10,glib2.28.6,bluez-libs-3.36,bluez-utils-3.36這些庫的安裝路徑,好像是新版的bluez-5.25集成了一些東西,不再需要依賴bluez-libs-3.36提供的頭文件,加上的話會報錯的(sdp_lib.h的481行與sdpd-request.c的225行,函數調用參數不匹配)。不添加安裝路徑就使用默認的路徑,也就是在bluez-5.25/lib/bluetooth目錄下的sdp_lib.h(實際上是bluez-5.25/lib/目錄下的sdp_lib.h),這個是正確的函數聲明。
重新配置,終于大功告成。
附上配置的整個流程:
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
上面配置雖然沒問題了,可是編譯還是有問題的,如下:
1.tools/hid2hci.c:43:21: fatal error: libudev.h: 沒有那個文件或目錄
obexd/plugins/phonebook-dummy.c:40:26: fatal error: libical/ical.h: 沒有那個文件或目錄
解決方法是:沒有了。
重來,前面都廢了,編譯不過去。
總結
以上是生活随笔為你收集整理的编译bluez-5.25 遇到的错误及解决方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 编译bluez-utils-3.36,死
- 下一篇: 编译bluez-5.25 通过 Lin