无法在OSx上的firebreath项目中链接libmtp

时间:2013-07-10 01:22:08

标签: xcode firebreath mtp

我有一个功能强大的插件,我已经使用firebreath框架编写了。我需要为它添加MTP读写支持。

经过一些研究后,我登陆了 libmtp http://libmtp.sourceforge.net/)。我下载了构建它的源代码,并能够运行示例并读取/写入MTP设备。

接下来我尝试在我的Firebreath插件项目中添加使用此库。我可以编译好,但我得到以下链接器错误。我已经在我的搜索库路径中添加了libusb.a和libiconv.a文件的目录。

我也尝试过使用Mac Ports版本(sudo ports install libmtp + universal)

注意:使用libmtp需要libiconv,并且安装了libusb

以下是xcode中的链接器错误。

Undefined symbols for architecture i386:
  "_libiconv", referenced from:
      _ptp_unpack_string in libmtp.a(libmtp_la-ptp.o)
      _ptp_pack_string in libmtp.a(libmtp_la-ptp.o)
      _utf16_to_utf8 in libmtp.a(libmtp_la-unicode.o)
      _utf8_to_utf16 in libmtp.a(libmtp_la-unicode.o)
  "_libiconv_close", referenced from:
      _LIBMTP_Release_Device in libmtp.a(libmtp_la-libmtp.o)
  "_libiconv_open", referenced from:
      _LIBMTP_Open_Raw_Device_Uncached in libmtp.a(libmtp_la-libmtp.o)
  "_libusb_bulk_transfer", referenced from:
      _ptp_write_func in libmtp.a(libmtp_la-libusb1-glue.o)
      _ptp_usb_getdata in libmtp.a(libmtp_la-libusb1-glue.o)
      _ptp_read_func in libmtp.a(libmtp_la-libusb1-glue.o)
      _ptp_usb_event in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_claim_interface", referenced from:
      _init_ptp_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_clear_halt", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _close_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_close", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _close_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_control_transfer", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _ptp_usb_control_cancel_request in libmtp.a(libmtp_la-libusb1-glue.o)
      _init_ptp_usb in libmtp.a(libmtp_la-libusb1-glue.o)
      _close_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_detach_kernel_driver", referenced from:
      _init_ptp_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_free_config_descriptor", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_free_device_list", referenced from:
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_bus_number", referenced from:
      _LIBMTP_Detect_Raw_Devices in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_config_descriptor", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_device", referenced from:
      _dump_usbinfo in libmtp.a(libmtp_la-libusb1-glue.o)
      _get_playlist_extension in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_device_address", referenced from:
      _LIBMTP_Detect_Raw_Devices in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_device_descriptor", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _LIBMTP_Detect_Raw_Devices in libmtp.a(libmtp_la-libusb1-glue.o)
      _dump_usbinfo in libmtp.a(libmtp_la-libusb1-glue.o)
      _get_playlist_extension in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_device_list", referenced from:
      _LIBMTP_Check_Specific_Device in libmtp.a(libmtp_la-libusb1-glue.o)
      _LIBMTP_Detect_Raw_Devices in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_get_string_descriptor_ascii", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_init", referenced from:
      _LIBMTP_Check_Specific_Device in libmtp.a(libmtp_la-libusb1-glue.o)
      _LIBMTP_Detect_Raw_Devices in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_kernel_driver_active", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _dump_usbinfo in libmtp.a(libmtp_la-libusb1-glue.o)
      _init_ptp_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_open", referenced from:
      _probe_device_descriptor in libmtp.a(libmtp_la-libusb1-glue.o)
      _init_ptp_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_release_interface", referenced from:
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
      _close_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_reset_device", referenced from:
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
      _close_usb in libmtp.a(libmtp_la-libusb1-glue.o)
  "_libusb_set_debug", referenced from:
      _LIBMTP_Check_Specific_Device in libmtp.a(libmtp_la-libusb1-glue.o)
      _LIBMTP_Detect_Raw_Devices in libmtp.a(libmtp_la-libusb1-glue.o)
      _configure_usb_device in libmtp.a(libmtp_la-libusb1-glue.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

1 个答案:

答案 0 :(得分:1)

它不会自动链接其他库...您需要将其他库实际添加到target_link_libraries语句中。