[SOLVED] Undefined symbols for architecture x86_64 when building hidapi
-
wrote on 16 Oct 2012, 20:57 last edited by tekojo 3 Dec 2015, 13:21
I've got a C-project (Qt Creator 2.5.2, Qt 4.8.2, OSX 10.7.5) and am trying to compile others among this file: https://github.com/signal11/hidapi/blob/master/mac/hid.c
These are the first few lines of compiler-output:
make: Entering directory '/Users/user/Documents/big_red_button' g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version min=10.5 -o BigRedButton.app/Contents/MacOS/BigRedButton main.o hidapi-mac.o dream_cheeky.o dream_cheeky_big_red_button.o Undefined symbols for architecture x86_64: "_CFGetTypeID", referenced from: _get_int_property in hidapi-mac.o "_CFNumberGetTypeID", referenced from: _get_int_property in hidapi-mac.o "_CFNumberGetValue", referenced from: _get_int_property in hidapi-mac.o "_CFRelease", referenced from: _free_hid_device in hidapi-mac.o _hid_exit in hidapi-mac.o _hid_enumerate in hidapi-mac.o _hid_open_path in hidapi-mac.o "_CFRunLoopAddSource", referenced from: _read_thread in hidapi-mac.o "_CFRunLoopGetCurrent", referenced from: _init_hid_manager in hidapi-mac.o _read_thread in hidapi-mac.o "_CFRunLoopGetMain", referenced from: _hid_close in hidapi-mac.o "_CFRunLoopRunInMode", referenced from: _process_pending_events in hidapi-mac.o _read_thread in hidapi-mac.o "_CFRunLoopSourceCreate", referenced from: _read_thread in hidapi-mac.o
What am I doing wrong?
-
wrote on 17 Oct 2012, 09:15 last edited by
This is a linker problem. My guess would be that your -mmacosx-version-min=10.5 is conflicting somehow with your requirement to build with the x86_64 architecture.
-
wrote on 17 Oct 2012, 09:16 last edited by tekojo 3 Dec 2015, 13:21
Oups, sorry... You are missing a link to the CoreFoundation framework!
LIBS += CoreFoundation
-
wrote on 17 Oct 2012, 15:43 last edited by tekojo 3 Dec 2015, 13:22
Thank you. After adding it to the .pro file I get the error message:
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version min=10.5 -o BigRedButton.app/Contents/MacOS/BigRedButton main.o hidapi-mac.o dream_cheeky.o dream_cheeky_big_red_button.o CoreFoundation i686-apple-darwin11-llvm-g++-4.2: CoreFoundation: No such file or directory
XCode and all required frameworks are installed though.
-
wrote on 17 Oct 2012, 16:09 last edited by tekojo 3 Dec 2015, 13:23
I am not a big fan/user of qmake so... Would you try
LIBS += -framework CoreFoundation
? -
wrote on 17 Oct 2012, 16:25 last edited by
That one works but I get the same error as in the first post.
-
wrote on 17 Oct 2012, 16:37 last edited by
What version of Mac OS X are you running? Did you remove the minimum compatibility of 10.5?
-
wrote on 17 Oct 2012, 16:40 last edited by
I am on 10.7.4 and don't know how to remove the 10.5 requirement. QtCreator adds it automatically.
-
wrote on 17 Oct 2012, 17:01 last edited by
Could you please paste back the exact error message you have now?
-
wrote on 18 Oct 2012, 00:54 last edited by tekojo 3 Dec 2015, 13:25
I didn't notice that it changed. It is now:
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o BigRedButton.app/Contents/MacOS/BigRedButton main.o hidapi-mac.o dream_cheeky.o dream_cheeky_big_red_button.o -framework CoreFoundation Undefined symbols for architecture x86_64: "_IOHIDDeviceClose", referenced from: make: Leaving directory `/Users/ali/Documents/big_red_button/BigRedButton' _hid_close in hidapi-mac.o "_IOHIDDeviceGetProperty", referenced from: _get_int_property in hidapi-mac.o _get_string_property in hidapi-mac.o _get_string_property_utf8 in hidapi-mac.o "_IOHIDDeviceGetReport", referenced from: _hid_get_feature_report in hidapi-mac.o "_IOHIDDeviceOpen", referenced from: _hid_open_path in hidapi-mac.o "_IOHIDDeviceRegisterInputReportCallback", referenced from: _hid_open_path in hidapi-mac.o _hid_close in hidapi-mac.o "_IOHIDDeviceScheduleWithRunLoop", referenced from: _read_thread in hidapi-mac.o _hid_close in hidapi-mac.o "_IOHIDDeviceSetReport", referenced from: _set_report in hidapi-mac.o "_IOHIDDeviceUnscheduleFromRunLoop", referenced from: _hid_close in hidapi-mac.o "_IOHIDManagerClose", referenced from: _hid_exit in hidapi-mac.o "_IOHIDManagerCopyDevices", referenced from: _hid_enumerate in hidapi-mac.o _hid_open_path in hidapi-mac.o "_IOHIDManagerCreate", referenced from: _init_hid_manager in hidapi-mac.o "_IOHIDManagerRegisterDeviceRemovalCallback", referenced from: _hid_open_path in hidapi-mac.o _hid_close in hidapi-mac.o "_IOHIDManagerScheduleWithRunLoop", referenced from: _init_hid_manager in hidapi-mac.o "_IOHIDManagerSetDeviceMatching", referenced from: _init_hid_manager in hidapi-mac.o ld: symbol(s) not found for architecture x86_64@
-
wrote on 18 Oct 2012, 07:23 last edited by tekojo 3 Dec 2015, 13:23
Alright, so just to give you a hint on how to solve those problems in the future...
Your missing symbols begin with IOHID. In Mac OS X all classes beginning with IO belong to the "I/O Kit":http://developer.apple.com/library/mac/#documentation/devicedrivers/conceptual/IOKitFundamentals/Introduction/Introduction.html.
Therefore, you can deduce that you are missing a link to the I/O Kit libraries or "framework".
Simply add this to your .pro file:LIBS += -framework IOKit
-
wrote on 18 Oct 2012, 07:24 last edited by
Did that ten seconds ago and it finally compiles. Thanks for the help :)
1/12