当我尝试vrpn 7.33
在 Mac 上编译时出现以下错误。它说这libusb
是为不同的架构编译的,而不是vrpn
正在编译的:
Linking CXX executable client_and_server
ld: warning: ignoring file /usr/local/lib/libusb-1.0.dylib, file was built for i386 which is not the architecture being linked (x86_64): /usr/local/lib/libusb-1.0.dylib
Undefined symbols for architecture x86_64:
"_libusb_claim_interface", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_close", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_exit", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_init", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_open_device_with_vid_pid", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.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]: *** [server_src/client_and_server] Error 1
make[1]: *** [server_src/CMakeFiles/client_and_server.dir/all] Error 2
make: *** [all] Error 2
但是,当我重新编译libusb
将架构更改为时,x86_64
我开始收到以下错误:
Linking CXX executable client_and_server
ld: warning: ignoring file /usr/local/lib/libusb-1.0.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libusb-1.0.dylib
Undefined symbols for architecture i386:
"_libusb_claim_interface", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_close", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_exit", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::~vrpn_Tracker_USB() in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_init", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
"_libusb_open_device_with_vid_pid", referenced from:
vrpn_Tracker_USB::vrpn_Tracker_USB(char const*, vrpn_Connection*, unsigned short, unsigned short, long) in libvrpnserver.a(vrpn_Tracker.C.o)
vrpn_Tracker_USB::mainloop() in libvrpnserver.a(vrpn_Tracker.C.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [server_src/client_and_server] Error 1
make[1]: *** [server_src/CMakeFiles/client_and_server.dir/all] Error 2
make: *** [all] Error 2
注意链接器现在是如何搜索原始i386
架构的。
为什么vrpn
在这两种情况下都抱怨?