I'm getting the following error when I try to compile vrpn 7.33 on a Mac. It says that libusb was compiled for a different architecture than vrpn is being compiled:
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
But when I recompile libusb changing the architecture to x86_64 I start getting the following error:
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
Notice how now the linker is searching for the original i386 architecture.
Why does vrpn complain in both cases?
vrpn is being compiled for multiple architectures at the same time. That is why a compiling libusb for a single architecture doesn't work.
The solution is to compile libusbfor the two architecutres at the same time using the following sequence of commands:
./configure
make CFLAGS="-arch x86_64 -arch i386" LDFLAGS="-arch x86_64 -arch i386"
sudo make install
If you want more information about compiling Universal binaries in Mac OS X check this link:
Compiling Your Code in OS X (Compiling for Multiple CPU Architectures)
Related
I have a problem about a make to install a software called ‘URANIE’, which is a scientific computing platform. By the way, I am on macOS Catalina 10.15.4.
When I did the make, here is what the terminal said :
*[ 64%] Linking CXX shared library libUranieModeler.so
ld: warning: -L path '/usr/lib/libxml2.dylib' is not a directory
Undefined symbols for architecture x86_64:
"___kmpc_for_static_fini", referenced from:
_.omp_outlined. in TkNN.cxx.o
_.omp_outlined..36 in TkNN.cxx.o
_.omp_outlined..49 in TkNN.cxx.o
"___kmpc_for_static_init_4", referenced from:
_.omp_outlined. in TkNN.cxx.o
_.omp_outlined..36 in TkNN.cxx.o
_.omp_outlined..49 in TkNN.cxx.o
"___kmpc_fork_call", referenced from:
URANIE::Modeler::TkNN::estimate_cpu(char const*) in TkNN.cxx.o
URANIE::Modeler::TkNN::LSort(int, double*, int*, int) in TkNN.cxx.o
"___kmpc_global_thread_num", referenced from:
_.omp_outlined. in TkNN.cxx.o
_.omp_outlined..36 in TkNN.cxx.o
_.omp_outlined..49 in TkNN.cxx.o
"_omp_set_num_threads", referenced from:
URANIE::Modeler::TkNN::estimate_cpu(char const*) in TkNN.cxx.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]: *** [meTIER/modeler/souRCE/libUranieModeler.4.3.0.so] Error 1
make[1]: *** [meTIER/modeler/souRCE/CMakeFiles/UranieModeler.dir/all] Error 2
make: *** [all] Error 2*
My computer skills are limited so I don't really understand this error. I already did some research about it, but did not find any solution to my issue. I only understood that these symbols that aren’t found have a connection with OpenMP, if I am not mistaken. I installed open-mpi with brew and libopenmpt too. I also checked if open-mpi was well linked and it's the case, but I don't know if this information can help.
If someone can help me about this problem or can give me some advice to understand this error, I would appreciate it a lot.
If you need further information don't hesitate to reach me,, thanks in advance.
I'm trying to link xerces as a static library, but I have some problems...
Undefined symbols for architecture x86_64:
"_CFRelease", referenced from:
xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
"_CFStringCreateMutableWithExternalCharactersNoCopy", referenced from:
xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
"_CFStringLowercase", referenced from:
xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
"_CFStringUppercase", referenced from:
xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
"_CreateTextEncoding", referenced from:
xercesc_3_1::MacOSUnicodeConverter::discoverLCPEncoding() in libxerces-c.a(MacOSUnicodeConverter.o)
xercesc_3_1::MacOSUnicodeConverter::makeNewXMLTranscoder(unsigned short const*, xercesc_3_1::XMLTransService::Codes&, unsigned long, unsigned int, xercesc_3_1::MemoryManager*) in libxerces-c.a(MacOSUnicodeConverter.o)
...
I've tried to run configure with different options, but all attempts were useless.
Has anyone had the same problem?
I ran into this issue when building xalan. I fixed it by passing -framework CoreServices -framework CoreFoundation -lcurl to the linker.
Line 76 of xalan's Makefile.incl:
XERCES_LIB = -L$(XERCESCROOT)/lib -lxerces-c -framework CoreServices -framework CoreFoundation -lcurl
I have this error in XCode:
Undefined symbols for architecture x86_64:
"Parser::Parser(char const*)", referenced from:
___cxx_global_var_init in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Very common reason is using a static library that is compiled for 32 bit only.
I have mad my own CMakeLists.txt file to build OpenNI samples. I successfully build NiSimpleViewer. But when try with NiUserTracker I get this error:
35 warnings generated.
Linking CXX executable main
ld: warning: path '/usr/lib/libOpenNI.dylib' following -L not a directory
Undefined symbols for architecture x86_64:
"DrawDepthMap(xn::DepthMetaData const&, xn::SceneMetaData const&)", referenced from:
glutDisplay() in main.cpp.o
"MyPoseInProgress(xn::PoseDetectionCapability&, char const*, unsigned int, XnPoseDetectionStatus, void*)", referenced from:
_main in main.cpp.o
"MyCalibrationInProgress(xn::SkeletonCapability&, unsigned int, XnCalibrationStatus, void*)", referenced from:
_main in main.cpp.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]: *** [main] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
This is the CMakeLists I use. Plese tell me what's wrong with it?
http://pastebin.com/SMYjjU35
The contents of folder outside build/ are
CMakeLists.txt Libs build opengles.cpp
GL SceneDrawer.cpp glh opengles.h
GLES SceneDrawer.h main.cpp
I guess, it's because of this line:
link_directories(${OPENNI_LIBRARY})
The link_directories() command sets path where libraries should be searched for, so you need something like ${OPENNI_LIBRARY_DIRS} there.
I'm working on MacOSX 10.7.2 and Xcode 4.2.1. I installed libpng using port and I was trying to load a PNG image in my application, but I get linker errors:
Undefined symbols for architecture x86_64:
"_png_create_read_struct", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_create_info_struct", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_destroy_read_struct", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_set_longjmp_fn", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_init_io", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_set_sig_bytes", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_read_png", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_get_IHDR", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_get_rowbytes", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
"_png_get_rows", referenced from:
loadPngImage(char*, int&, int&, bool&, unsigned char**) in test.o
ld: symbol(s) not found for architecture x86_64
I included png.h in my project using
#include "/usr/X11/include/png.h"
I know libpng is based on zlib, thus I have included -lz in "Other linker flags" but nothing changed.
Any suggestions on how to make it work?
I solved with a manual installation of libpng:
download the source from official web site
in Terminal, go in the downloaded folder and launch
cp ./scripts/makefile.darwin makefile
make
sudo make install
make clean
if it doesn't work (as in my case) open makefile with TextEdit (or equivalent) and change line
ARCH="-arch i386 -arch x86_64"
in
ARCH=-arch x86_64
(assuming, of course, your system is 64 bit).
It may not be enough. Xcode was still unable to find the library. I solved using
cd /usr/local/lib
sudo ln -s libpng15.dylib ./libpng15.15.dylib
That did the trick. Now it works fine.