2
votes

Trying to compile a program on mac using Qt 5.4 clang 64bit. The program includes using Opal Kelly .dylib files and header files to talk to an FPGA connected through USB. The program compiles fine on windows with windows versions of the .dylib (.dll) and the windows header file, however on mac I get the following error trying to compile:

:-1: error: symbol(s) not found for architecture x86_64

The compiler output is:

Undefined symbols for architecture x86_64:
  "_okFrontPanelDLL_LoadLib", referenced from:
      MainWindow::AllocateMemory() in ProcessingFunctions.o
  "_okFrontPanelManager_Destruct", referenced from:
      OpalKelly::FrontPanelManager::~FrontPanelManager() in main.o
      OpalKelly::FrontPanelManager::~FrontPanelManager() in fpga.o
      OpalKelly::FrontPanelManager::~FrontPanelManager() in graphing.o
      OpalKelly::FrontPanelManager::~FrontPanelManager() in FPGAScanner.o
      OpalKelly::FrontPanelManager::~FrontPanelManager() in ProcessingFunctions.o
      OpalKelly::FrontPanelManager::~FrontPanelManager() in mainwindow.o
      OpalKelly::FrontPanelManager::~FrontPanelManager() in moc_mainwindow.o
      ...
  "_okFrontPanel_ConfigureFPGA", referenced from:
      OpalKellyLegacy::okCFrontPanel::ConfigureFPGA(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mainwindow.o
  "_okFrontPanel_Construct", referenced from:
      OpalKellyLegacy::okCFrontPanel::okCFrontPanel() in ProcessingFunctions.o
  "_okFrontPanel_Destruct", referenced from:
      OpalKellyLegacy::okCFrontPanel::~okCFrontPanel() in mainwindow.o
  "_okFrontPanel_GetDeviceCount", referenced from:
      OpalKellyLegacy::okCFrontPanel::GetDeviceCount() in ProcessingFunctions.o
  "_okFrontPanel_GetDeviceID", referenced from:
      OpalKellyLegacy::okCFrontPanel::GetDeviceID() in ProcessingFunctions.o
  "_okFrontPanel_GetSerialNumber", referenced from:
      OpalKellyLegacy::okCFrontPanel::GetSerialNumber() in ProcessingFunctions.o
  "_okFrontPanel_GetWireOutValue", referenced from:
      OpalKellyLegacy::okCFrontPanel::GetWireOutValue(int) in FPGAScanner.o
  "_okFrontPanel_IsFrontPanelEnabled", referenced from:
      OpalKellyLegacy::okCFrontPanel::IsFrontPanelEnabled() in ProcessingFunctions.o
  "_okFrontPanel_LoadDefaultPLLConfiguration", referenced from:
      OpalKellyLegacy::okCFrontPanel::LoadDefaultPLLConfiguration() in mainwindow.o
  "_okFrontPanel_OpenBySerial", referenced from:
      OpalKellyLegacy::okCFrontPanel::OpenBySerial(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in ProcessingFunctions.o
  "_okFrontPanel_ReadFromPipeOut", referenced from:
      OpalKellyLegacy::okCFrontPanel::ReadFromPipeOut(int, long, unsigned char*) in FPGAScanner.o
  "_okFrontPanel_SetWireInValue", referenced from:
      OpalKellyLegacy::okCFrontPanel::SetWireInValue(int, unsigned int, unsigned int) in fpga.o
      OpalKellyLegacy::okCFrontPanel::SetWireInValue(int, unsigned int, unsigned int) in FPGAScanner.o
  "_okFrontPanel_UpdateWireIns", referenced from:
      OpalKellyLegacy::okCFrontPanel::UpdateWireIns() in fpga.o
      OpalKellyLegacy::okCFrontPanel::UpdateWireIns() in FPGAScanner.o
  "_okFrontPanel_UpdateWireOuts", referenced from:
      OpalKellyLegacy::okCFrontPanel::UpdateWireOuts() in FPGAScanner.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: *** [AFE-MP-512.app/Contents/MacOS/AFE-MP-512] Error 1
13:38:18: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project AFE (kit: Clone of Desktop Qt 5.4.0 clang 32bit)
When executing step "Make"
13:38:18: Elapsed time: 00:31.

I know this kind of error can occur when there is a SLOT or function in the header file while is not being used, however I don't know how to go about finding what is causing the issue.

The Opal Kelly header file is located here.

Any help would be much appreciated, let me know if you need more info!

3
Could your issue be related to this? stackoverflow.com/questions/18973042/…TheDarkKnight

3 Answers

3
votes

It means that there are following problems:

  1. You are linking 32-bit dylib when you should link 64-bit
  2. Linker is unable to find the library
  3. Or the required symbol is not present in the library.

You can look into compiler and linker option to make sure that library is being linked. Use nm or string to ensure that the functions are present in the library.

3
votes

The program includes using Opal Kelly .dylib files and header files to talk to an FPGA connected through USB.... Undefined symbol for std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >...

The __1 indicates you are using the LLVM C++ runtime (libc++). Somewhere, you are probably mixing and matching with the GNU C++ runtime (libstdc++). The GNU C++ runtime (libstdc++) lacks the __1 in its symbols.

You should go through the project and all pre-built libraries, and ensure they are using one or the other. For each, you should use CXXFLAGS of either (1) -stdlib=libc++ (LLVM), or (2) -stdlib=libstdc++ (GNU).

Be aware that IDEs like Xcode may use a different -stdlib=... setting than a library like Opal Kelly. In this case, have Xcode match the Opal Kelly library, or rebuild the Opal Kelly library to match Xcode.


If interested, the __1 is an inline namespace used for versioning. See What are inline namespaces for? and Where does the __1 symbol come from when using LLVM's libc++?.

0
votes

iphonesimulator:

CONFIG(iphonesimulator, iphoneos | iphonesimulator)
QMAKE_APPLE_SIMULATOR_ARCHS = x86_64 #i386 for 32bit

iphoneos:

CONFIG(iphoneos, iphoneos | iphonesimulator)