尝试编译BluezTools时,到处都是未定义的引用?

时间:2013-09-18 17:20:15

标签: c linux

我正在尝试使用以下命令编译BluezTools:

./autogen.sh && ./configure && make

以下是输出的片段:

obextransfer.c:(.text+0x4d5): undefined reference to `g_type_check_instance_cast'
obextransfer.c:(.text+0x4f1): undefined reference to `dbus_g_proxy_disconnect_signal'
obextransfer.c:(.text+0x4fd): undefined reference to `g_object_unref'
obextransfer.c:(.text+0x50a): undefined reference to `g_free'
obextransfer.c:(.text+0x517): undefined reference to `g_object_unref'
obextransfer.c:(.text+0x528): undefined reference to `g_type_check_class_cast'
lib/obexd/obextransfer.o: In function `obextransfer_cancel':
obextransfer.c:(.text+0x56a): undefined reference to `g_type_check_instance_is_a'
obextransfer.c:(.text+0x58a): undefined reference to `g_assertion_message_expr'
lib/obexd/obextransfer.o: In function `obextransfer_get_dbus_object_path':
obextransfer.c:(.text+0x5e2): undefined reference to `g_type_check_instance_is_a'
obextransfer.c:(.text+0x602): undefined reference to `g_assertion_message_expr'
lib/obexd/obextransfer.o: In function `_obextransfer_get_property':
obextransfer.c:(.text+0x64f): undefined reference to `g_type_check_instance_cast'
obextransfer.c:(.text+0x660): undefined reference to `g_type_name'
obextransfer.c:(.text+0x66f): undefined reference to `g_type_name'
obextransfer.c:(.text+0x6a3): undefined reference to `g_log'
lib/obexd/obextransfer.o: In function `progress_handler':
obextransfer.c:(.text+0x4af): undefined reference to `g_signal_emit'
lib/obexd/obextransfer.o: In function `obextransfer_cancel':
obextransfer.c:(.text+0x5ad): undefined reference to `dbus_g_proxy_call'
lib/obexd/obextransfer.o: In function `obextransfer_get_dbus_object_path':
obextransfer.c:(.text+0x619): undefined reference to `dbus_g_proxy_get_path'
lib/obexd/obextransfer.o: In function `_obextransfer_get_property':
obextransfer.c:(.text+0x6e7): undefined reference to `g_value_set_string'
collect2: error: ld returned 1 exit status
make[2]: *** [bt-monitor] Error 1
make[2]: Leaving directory `/home/[]/Downloads/bluez-tools-bluez-tools/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/[]/Downloads/bluez-tools-bluez-tools

这是我在Linux上构建C项目的第一次尝试,我哪里错了?

运行Linux Mint 15 Olivia 64bit。

2 个答案:

答案 0 :(得分:3)

你是否安装了bluez和obexd? https://code.google.com/p/bluez-tools/#Requirements 您可以检查./configure的输出是否有任何错误。通常有一个 configure.log 或类似于grep的grep。

我不知道Mint包管理,但你可能至少需要某种obex * -dev包或自己安装obex源。

编辑编辑回答评论。

我认为obexd-client不够用,但试试这个方法,看看是否存在。否则你需要寻找一些-dev软件包,比如 libglib2.0-cil-dev libglib2.0-dev libdbus-glib-1-dev 。 (这些是Ubuntu上的名字)。

以下是我如何编译它(但仍会发出警告)。

  1. 为glib和dbus安装一堆-dev软件包(ddg / google无法链接的函数,因此您可以看到它们来自哪些库。)

  2. 执行pkg-config --libs --cflags dbus-1 dbus-glib-1 glib-2.0

  3. 使用./configure中的命令输出例如: env LIBS="-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0" ./configure

  4. 执行make
  5. 另请参阅此问题:Compilation error dbus-ping-pong

答案 1 :(得分:0)

通过添加~解决了类似的问题。也许可以帮助某人。