我有一个使用firebreath框架编写的功能插件。我需要添加MTP读写支持。
经过一些研究,我登陆了libmtp(http://libmtp.sourceforge.net/)。我下载了构建它的源代码,并能够运行示例和读/写MTP设备。
接下来,我尝试在我的Firebreath插件项目中添加使用这个库。我可以很好地编译,但我得到了以下链接器错误。我在搜索库中添加了带有libusb.a和libiconv.a文件的目录路径。
我还尝试过使用Mac端口版本(sudo端口安装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)
它不会自动链接其他库。。。实际上,您需要将其他库添加到targetlinkbraries语句中。