2013-07-10 48 views
0

我使用firebreath框架編寫了一個功能正常的插件。我需要爲它添加MTP讀寫支持。無法在OSx上的firebreath項目中鏈接libmtp

經過一番研究,我登陸了libmtphttp://libmtp.sourceforge.net/)。我下載了構建它的源代碼,並能夠運行這些示例並讀取/寫入MTP設備。

接下來我嘗試在我的Firebreath插件項目中添加使用這個lib。我可以編譯好,但我得到下面的鏈接器錯誤。我已經將libusb.a和libiconv.a文件的目錄添加到搜索庫路徑中。

我使用Mac版本的端口(須藤端口安裝libmtp +通用)

注也試過:使用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

它不會只是鏈接的其他庫自動...實際上你需要其他的庫添加到您的target_link_libraries聲明。

+0

我正在手動添加lib搜索路徑到xcode以進行概念驗證。我會嘗試通過CMake添加它們。感謝 – Joel

+0

target_link_libraries($ {PROJECT_NAME} /opt/local/lib/libmtp.a) target_link_libraries($ {PROJECT_NAME} /opt/local/lib/libiconv.a) target_link_libraries($ {PROJECT_NAME}/opt/local/lib /libusb-1.0.a) 工作就像一個魅力再次感謝! – Joel

+0

你可以在一個電話中實際做到這一點。另外考慮使用find_library使它更容忍在其他系統上使用。 – taxilian

相關問題