Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the found libusb #355

Merged
merged 1 commit into from
Jul 18, 2016
Merged

Use the found libusb #355

merged 1 commit into from
Jul 18, 2016

Conversation

ljani
Copy link
Contributor

@ljani ljani commented Jul 17, 2016

No description provided.

@Benjamin-Dobell Benjamin-Dobell merged commit 9784dd2 into Benjamin-Dobell:master Jul 18, 2016
@dulacp
Copy link

dulacp commented Jul 19, 2016

I have an issue with this commit, whereas no issue with the previous commit 7ebee1e :

cmake --build .                                                                                               
Scanning dependencies of target pit
[  3%] Building CXX object libpit/CMakeFiles/pit.dir/source/libpit.cpp.o
[  6%] Linking CXX static library libpit.a
[  6%] Built target pit
Scanning dependencies of target heimdall
[ 10%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/Arguments.cpp.o
[ 13%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/BridgeManager.cpp.o
[ 16%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/ClosePcScreenAction.cpp.o
[ 20%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/DetectAction.cpp.o
[ 23%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/DownloadPitAction.cpp.o
[ 26%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/FlashAction.cpp.o
[ 30%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/HelpAction.cpp.o
[ 33%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/InfoAction.cpp.o
[ 36%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/Interface.cpp.o
[ 40%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/main.cpp.o
[ 43%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/PrintPitAction.cpp.o
[ 46%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/Utility.cpp.o
[ 50%] Building CXX object heimdall/CMakeFiles/heimdall.dir/source/VersionAction.cpp.o
[ 53%] Linking CXX executable ../bin/heimdall
Undefined symbols for architecture x86_64:
  "_CFGetTypeID", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFNumberGetTypeID", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFNumberGetValue", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRelease", referenced from:
      _darwin_close in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRetain", referenced from:
      _darwin_open in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopAddSource", referenced from:
      _darwin_open in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopGetCurrent", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopRemoveSource", referenced from:
      _darwin_close in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopRun", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopStop", referenced from:
      _darwin_exit in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFUUIDGetConstantUUIDWithBytes", referenced from:
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFUUIDGetUUIDBytes", referenced from:
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOCreatePlugInInterfaceForService", referenced from:
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOIteratorNext", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_detached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_attached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_clear_iterator in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_get_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOKitWaitQuiet", referenced from:
      _darwin_hotplug_poll in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IONotificationPortCreate", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IONotificationPortDestroy", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IONotificationPortGetRunLoopSource", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOObjectRelease", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_detached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_attached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      ...
  "_IORegistryEntryCreateCFProperty", referenced from:
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IORegistryEntryGetParentEntry", referenced from:
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOServiceAddMatchingNotification", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOServiceGetMatchingServices", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOServiceMatching", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "___CFConstantStringClassReference", referenced from:
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFAllocatorDefault", referenced from:
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFAllocatorSystemDefault", referenced from:
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFRunLoopCommonModes", referenced from:
      _darwin_open in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFRunLoopDefaultMode", referenced from:
      _darwin_close in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kIOMasterPortDefault", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_hotplug_poll in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_objc_registerThreadWithCollector", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/heimdall] Error 1
make[1]: *** [heimdall/CMakeFiles/heimdall.dir/all] Error 2
make: *** [all] Error 2

This PR brought something not compatible with all host config, I suggest to rollback before more people experience issues, or we can dig in the root cause.

Cheers

@ljani
Copy link
Contributor Author

ljani commented Jul 20, 2016

@dulaccc Sorry, I tested only on Windows. Can you try changing LIBUSB_LIBRARY to LIBUSB_LIBRARIES and see what happens?

It was an oversight on my part. I'll create a PR after you've confirmed it works on OSX too (I don't have OSX to test).

Benjamin-Dobell added a commit that referenced this pull request Jul 20, 2016
This reverts commit 9784dd2, reversing
changes made to 7ebee1e.
@Benjamin-Dobell
Copy link
Owner

I've reverted for now.

@dulacp
Copy link

dulacp commented Jul 20, 2016

No problem, cross platform testing is intense.
I tried LIBUSB_LIBRARIES but it seems to be the same :

...
[ 53%] Linking CXX executable ../bin/heimdall
Undefined symbols for architecture x86_64:
  "_CFGetTypeID", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFNumberGetTypeID", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFNumberGetValue", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRelease", referenced from:
      _darwin_close in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRetain", referenced from:
      _darwin_open in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopAddSource", referenced from:
      _darwin_open in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopGetCurrent", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopRemoveSource", referenced from:
      _darwin_close in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopRun", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFRunLoopStop", referenced from:
      _darwin_exit in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFUUIDGetConstantUUIDWithBytes", referenced from:
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_CFUUIDGetUUIDBytes", referenced from:
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOCreatePlugInInterfaceForService", referenced from:
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOIteratorNext", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_detached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_attached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_clear_iterator in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_get_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOKitWaitQuiet", referenced from:
      _darwin_hotplug_poll in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IONotificationPortCreate", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IONotificationPortDestroy", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IONotificationPortGetRunLoopSource", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOObjectRelease", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_detached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_devices_attached in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      ...
  "_IORegistryEntryCreateCFProperty", referenced from:
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IORegistryEntryGetParentEntry", referenced from:
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOServiceAddMatchingNotification", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOServiceGetMatchingServices", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_IOServiceMatching", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "___CFConstantStringClassReference", referenced from:
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      CFString in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFAllocatorDefault", referenced from:
      _darwin_kernel_driver_active in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFAllocatorSystemDefault", referenced from:
      _process_new_device in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFRunLoopCommonModes", referenced from:
      _darwin_open in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kCFRunLoopDefaultMode", referenced from:
      _darwin_close in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_kIOMasterPortDefault", referenced from:
      _darwin_init in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_hotplug_poll in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
  "_objc_registerThreadWithCollector", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(libusb_1_0_la-darwin_usb.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/heimdall] Error 1
make[1]: *** [heimdall/CMakeFiles/heimdall.dir/all] Error 2
make: *** [all] Error 2

@dulacp
Copy link

dulacp commented Jul 20, 2016

Btw, CF means CoreFoundation on Mac OSX. So it's probably just a missing linkage step.

@ljani
Copy link
Contributor Author

ljani commented Jul 20, 2016

Ah, too bad. I tested changing LIBUSB_LIBRARY to LIBUSB_LIBRARIES on Debian Jessie and it seemed to fix the issue.

EDIT: did you remove or your build directory to make sure you started from clean slate?
EDIT2: nope, it was not switching the variable, but me installing libusb-1.0-0-dev instead of libusb-dev on Debian and cleaning my build directory after only switching the text (which I didn't do when I installed 1.0), which fixed the build on Debian. Sorry for that. Anyway, I have no idea about OSX, maybe it's picking up a wrong libusb.

@dulacp
Copy link

dulacp commented Jul 20, 2016

Ok I make it works by adding these :

  • -lobjc to CMAKE_CXX_FLAGS
  • target_link_libraries(heimdall "-framework CoreFoundation")
  • target_link_libraries(heimdall "-framework IOKit")

It's ugly and raise cmake warnings but the build succeeded, with this output

...
clang: warning: -lobjc: 'linker' input unused
[ 53%] Linking CXX executable ../bin/heimdall
[ 53%] Built target heimdall
Scanning dependencies of target heimdall-frontend_automoc
[ 56%] Automatic moc for target heimdall-frontend
Generating moc_aboutform.cpp
Generating moc_mainwindow.cpp
[ 56%] Built target heimdall-frontend_automoc
[ 60%] Generating qrc_mainwindow.cpp
RCC: Warning: No resources in '/Users/peteralaoui/Desktop/AndroidFlashS5/Heimdall/heimdall-frontend/mainwindow.qrc'.
[ 63%] Generating ui_mainwindow.h
[ 66%] Generating ui_aboutform.h
Scanning dependencies of target heimdall-frontend
[ 70%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/aboutform.cpp.o
[ 73%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/Alerts.cpp.o
[ 76%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/FirmwareInfo.cpp.o
[ 80%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/main.cpp.o
[ 83%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/mainwindow.cpp.o
[ 86%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/PackageData.cpp.o
[ 90%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/source/Packaging.cpp.o
[ 93%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/qrc_mainwindow.cpp.o
[ 96%] Building CXX object heimdall-frontend/CMakeFiles/heimdall-frontend.dir/heimdall-frontend_automoc.cpp.o
[100%] Linking CXX executable ../bin/heimdall-frontend.app/Contents/MacOS/heimdall-frontend
[100%] Built target heimdall-frontend

@seankibler
Copy link

seankibler commented Oct 5, 2017

I had the same issue. The changes @dulaccc suggested also resolved the error for me. I changed the target_link_libraries calls to fix the cmake warnings about mixing function signature compatibility with prior calls.

target_link_libraries(heimdall PRIVATE "-framework CoreFoundation")
target_link_libraries(heimdall PRIVATE "-framework IOKit")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants