【发布时间】:2015-11-04 18:05:25
【问题描述】:
我希望编辑和重新编译 bluez 5.31 版的 hcitool.c。我按照这个答案的过程安装了bluez 5.31: Bluetooth Low Energy in C - using Bluez to create a GATT server
在我的试用中,我复制了 hcitool.c 文件并在工具文件夹中将其命名为 myhcitool.c 并使用命令
gcc -o myhcitool.o myhcitool.c.
这给了我一个错误
myhcitool.c:43:27: fatal error: lib/bluetooth.h: No such file or directory
#include "lib/bluetooth.h"
^
compilation terminated.
我尝试将 myhcitool.c 复制到工具文件夹之外并在那里编译。这给了我一堆类似这样的错误:
/tmp/ccj1QmZK.o: In function `dev_info':
myhcitool.c:(.text+0x293): undefined reference to `ba2str'
/tmp/ccj1QmZK.o: In function `conn_list':
myhcitool.c:(.text+0x501): undefined reference to `ba2str'
myhcitool.c:(.text+0x50f): undefined reference to `hci_lmtostr'
myhcitool.c:(.text+0x586): undefined reference to `bt_free'
/tmp/ccj1QmZK.o: In function `cmd_dev':
我还尝试通过在其中修改一个简单的 printf 来编辑 hcitool.c 本身,然后为整个 bluez 重做“make”和“make install”命令。之后,当我尝试运行 hcitool 时,我所做的修改没有任何效果。
【问题讨论】:
-
你之前做过
make clean吗? -
没有。我现在才试了一下。
-
我刚刚尝试了“make clean”然后重做“./configure”、“make”和“make install”。我在hcitool中的修改还是没有生效。
-
应用程序具有构建系统,并且不只是由单个文件组成。你不能只复制一个文件并编译它。对原始文件进行编辑,然后运行标准的 configure/make/make-install 序列。
-
@davmac。如果我明白你的意思,我认为这就是我在我的一次试验中所做的,正如我在问题的最后部分所描述的那样。
标签: linux makefile bluetooth-lowenergy