4

I have a plugin for stellarium that builds fine on Ubuntu but throws an error when I try to build it on Mac OSX. I tried to change the CMakeLists.txt files to make it compatible on OSX but I repeatedly get the same errors. The messages I receive are:

[ 18%] Linking CXX shared module libOpenSkyPlanetarium.so
ld: warning: directory not found for option '-L/src'
Undefined symbols for architecture x86_64:
  "StelButton::StelButton(QGraphicsItem*, QPixmap const&, QPixmap const&, QPixmap const&, QString const&, bool)", referenced from:
      OpenSkyPlanetarium::init() in OpenSkyPlanetarium.cpp.o
  "StelDialog::qt_metacall(QMetaObject::Call, int, void**)", referenced from:
      OSPMainDialog::qt_metacall(QMetaObject::Call, int, void**) in moc_compilation.cpp.o
  "StelDialog::qt_metacast(char const*)", referenced from:
      OSPMainDialog::qt_metacast(char const*) in moc_compilation.cpp.o
  "StelDialog::staticMetaObject", referenced from:
      OSPMainDialog::staticMetaObject in moc_compilation.cpp.o
  "StelDialog::StelDialog(QString, QObject*)", referenced from:
      OSPMainDialog::OSPMainDialog() in OSPMainDialog.cpp.o
  "StelDialog::~StelDialog()", referenced from:
      OSPMainDialog::OSPMainDialog() in OSPMainDialog.cpp.o
      OSPMainDialog::~OSPMainDialog() in OSPMainDialog.cpp.o
  "StelModule::qt_metacall(QMetaObject::Call, int, void**)", referenced from:
      OpenSkyPlanetarium::qt_metacall(QMetaObject::Call, int, void**) in moc_compilation.cpp.o
  "StelModule::qt_metacast(char const*)", referenced from:
      OpenSkyPlanetarium::qt_metacast(char const*) in moc_compilation.cpp.o
  "StelModule::staticMetaObject", referenced from:
      OpenSkyPlanetarium::staticMetaObject in moc_compilation.cpp.o
  "StelModule::addAction(QString const&, QString const&, QString const&, QObject*, char const*, QString const&, QString const&)", referenced from:
      OpenSkyPlanetarium::init() in OpenSkyPlanetarium.cpp.o
  "StelModule::StelModule()", referenced from:
      OpenSkyPlanetarium::OpenSkyPlanetarium() in OpenSkyPlanetarium.cpp.o
  "QSerialPort::setPortName(QString const&)", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "QSerialPort::waitForReadyRead(int)", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "QSerialPort::waitForBytesWritten(int)", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "QSerialPort::open(QFlags<QIODevice::OpenModeFlag>)", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "QSerialPort::close()", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "QSerialPort::QSerialPort(QObject*)", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "QSerialPort::~QSerialPort()", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "StelFileMgr::getUserDir()", referenced from:
      OSPMainDialog::OSPMainDialog() in OSPMainDialog.cpp.o
  "StelFileMgr::mkDir(QString const&)", referenced from:
      OSPMainDialog::OSPMainDialog() in OSPMainDialog.cpp.o
  "StelFileMgr::exists(QString const&)", referenced from:
      OSPMainDialog::OSPMainDialog() in OSPMainDialog.cpp.o
  "BottomStelBar::addButton(StelButton*, QString const&, QString const&)", referenced from:
      OpenSkyPlanetarium::init() in OpenSkyPlanetarium.cpp.o
  "StelModuleMgr::getModule(QString const&, bool)", referenced from:
      OpenSkyPlanetarium::getCallOrder(StelModule::StelModuleActionName) const in OpenSkyPlanetarium.cpp.o
      OSPMainDialog::setReference() in OSPMainDialog.cpp.o
      OSPMainDialog::goTo() in OSPMainDialog.cpp.o
      OSPMainDialog::compileScript() in OSPMainDialog.cpp.o
      OSPMainDialog::gt() in OSPMainDialog.cpp.o
  "QSerialPortInfo::availablePorts()", referenced from:
      OSPMainDialog::selectDevice() in OSPMainDialog.cpp.o
  "QSerialPortInfo::QSerialPortInfo(QSerialPortInfo const&)", referenced from:
      QList<QSerialPortInfo>::node_copy(QList<QSerialPortInfo>::Node*, QList<QSerialPortInfo>::Node*, QList<QSerialPortInfo>::Node*) in OSPMainDialog.cpp.o
  "QSerialPortInfo::~QSerialPortInfo()", referenced from:
      QList<QSerialPortInfo>::node_copy(QList<QSerialPortInfo>::Node*, QList<QSerialPortInfo>::Node*, QList<QSerialPortInfo>::Node*) in OSPMainDialog.cpp.o
      QList<QSerialPortInfo>::node_destruct(QList<QSerialPortInfo>::Node*, QList<QSerialPortInfo>::Node*) in OSPMainDialog.cpp.o
  "StelApp::singleton", referenced from:
      StelApp::getInstance() in OpenSkyPlanetarium.cpp.o
      StelApp::getInstance() in OSPMainDialog.cpp.o
  "StelUtils::rectToSphe(double*, double*, Vector3<double> const&)", referenced from:
      OSPMainDialog::setReference() in OSPMainDialog.cpp.o
      OSPMainDialog::goTo() in OSPMainDialog.cpp.o
      OSPMainDialog::compileScript() in OSPMainDialog.cpp.o
      OSPMainDialog::gt() in OSPMainDialog.cpp.o
  "StelUtils::hmsToRad(unsigned int, unsigned int, double)", referenced from:
      OSPMainDialog::initDevice() in OSPMainDialog.cpp.o
      OSPMainDialog::setReference() in OSPMainDialog.cpp.o
      OSPMainDialog::goTo() in OSPMainDialog.cpp.o
      OSPMainDialog::move(QString, QString) in OSPMainDialog.cpp.o
  "StelModule::getModuleVersion() const", referenced from:
      vtable for OpenSkyPlanetarium in moc_compilation.cpp.o
  "StelObject::getEquinoxEquatorialPos(StelCore const*) const", referenced from:
      OSPMainDialog::setReference() in OSPMainDialog.cpp.o
      OSPMainDialog::goTo() in OSPMainDialog.cpp.o
      OSPMainDialog::compileScript() in OSPMainDialog.cpp.o
      OSPMainDialog::gt() in OSPMainDialog.cpp.o
  "QSerialPort::error() const", referenced from:
      SerialCom::run() in SerialCom.cpp.o
  "StelObjectMgr::searchByNameI18n(QString const&) const", referenced from:
      OSPMainDialog::compileScript() in OSPMainDialog.cpp.o
  "QSerialPortInfo::portName() const", referenced from:
      OSPMainDialog::selectDevice() in OSPMainDialog.cpp.o
  "StelGui::getButtonBar() const", referenced from:
      OpenSkyPlanetarium::init() in OpenSkyPlanetarium.cpp.o
  "typeinfo for StelDialog", referenced from:
      typeinfo for OSPMainDialog in moc_compilation.cpp.o
  "typeinfo for StelModule", referenced from:
      typeinfo for OpenSkyPlanetarium in moc_compilation.cpp.o
  "typeinfo for StelGuiBase", referenced from:
      OpenSkyPlanetarium::init() in OpenSkyPlanetarium.cpp.o
  "typeinfo for StelGui", referenced from:
      OpenSkyPlanetarium::init() in OpenSkyPlanetarium.cpp.o
  "vtable for StelModule", referenced from:
      StelModule::~StelModule() in OpenSkyPlanetarium.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for BarFrame", referenced from:
      BarFrame::BarFrame(QWidget*) in OSPMainDialog.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
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]: *** [src/libOpenSkyPlanetarium.so] Error 1
make[1]: *** [src/CMakeFiles/OpenSkyPlanetarium-static.dir/all] Error 2
make: *** [all] Error 2

I followed these steps after copying my plugin into stellarium's plugins folder:

  1. mkdir -p builds/unix
  2. cd builds/unix
  3. cmake ../..
  4. make

I checked these posts but the solutions didn't work:

  1. "Undefined symbols for architecture x86_64:"

  2. Qt Creator: Undefined symbols for architecture x86_64

These are the CMakeLists.txt files

INCLUDE_DIRECTORIES(.)

LINK_DIRECTORIES(${BUILD_DIR}/src)

SET(OpenSkyPlanetarium_SRCS
     OpenSkyPlanetarium.hpp
     OpenSkyPlanetarium.cpp
     LaserDev.hpp
     LaserDev.cpp
     Calibrate.hpp
     Calibrate.cpp
     SerialCom.hpp
     SerialCom.cpp
     gui/OSPMainDialog.hpp
     gui/OSPMainDialog.cpp
)

SET(OpenSkyPlanetarium_UIS
     gui/OSPMainDialog.ui
)

SET(OpenSkyPlanetarium_RES
     ../OpenSkyPlanetarium.qrc
)
QT5_ADD_RESOURCES(OpenSkyPlanetarium_RES_CXX ${OpenSkyPlanetarium_RES})

# Wrapping UI
QT5_WRAP_UI(OpenSkyPlanetarium_UIS_H ${OpenSkyPlanetarium_UIS})


# Library Properties
ADD_LIBRARY(OpenSkyPlanetarium-static MODULE
${OpenSkyPlanetarium_SRCS} ${OpenSkyPlanetarium_RES_CXX}
${OpenSkyPlanetarium_UIS_H})
QT5_USE_MODULES(OpenSkyPlanetarium-static Core Gui Widgets Multimedia)
SET_TARGET_PROPERTIES(OpenSkyPlanetarium-static PROPERTIES OUTPUT_NAME
"OpenSkyPlanetarium" AUTOMOC TRUE COMPILE_FLAGS "-DQT_OSP")
TARGET_LINK_LIBRARIES(OpenSkyPlanetarium-static ${extLinkerOption})

File 2:

# This is the cmake config file for the OpenSkyPlanetarium
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
SET(OPENSKYPLANETARIUM_VERSION "0.1.0")
FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5OpenGL REQUIRED)

SET(STELLARIUM_SOURCE_DIR $ENV{STELROOT})

INCLUDE_DIRECTORIES(
    ${CMAKE_BINARY_DIR}
    ${CMAKE_SOURCE_DIR}/src
    ${CMAKE_SOURCE_DIR}/src/gui
    ${STELLARIUM_SOURCE_DIR}/src
    ${STELLARIUM_SOURCE_DIR}/src/core
    ${STELLARIUM_SOURCE_DIR}/src/core/modules
    ${STELLARIUM_SOURCE_DIR}/src/core/planetsephems
    ${STELLARIUM_SOURCE_DIR}/src/core/external
    ${STELLARIUM_SOURCE_DIR}/src/core/external/qtcompress
    ${STELLARIUM_SOURCE_DIR}/src/core/external/glues_stel/source/
    ${STELLARIUM_SOURCE_DIR}/src/core/external/glues_stel/source/libtess
    ${STELLARIUM_SOURCE_DIR}/src/gui
    ${STELLARIUM_SOURCE_DIR}/src/scripting
    ${INTL_INCLUDE_DIR}
    ${CMAKE_BINARY_DIR}/src
    ${ZLIB_INCLUDE_DIR}
)

ADD_SUBDIRECTORY( src )

SET(QT_LINK_PARAMETERS Qt5::Core Qt5::Gui Qt5::OpenGL)

SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.stellarium)

install(FILES DESTINATION modules/OpenSkyPlanetarium/)
m7913d
  • 10,244
  • 7
  • 28
  • 56
  • What do you think of this error : `ld: warning: directory not found for option '-L/src'` – nakiya May 30 '17 at 06:40
  • Can you post the CMake configuration messages. It seems some environment variable is missing for the build process. – AmeyaVS May 30 '17 at 07:12
  • The offending line is in the CMakeLists.txt: "LINK_DIRECTORIES(${BUILD_DIR}/src)" try printing the value of "BUILD_DIR". Something like "message("Build Dir is: " ${BUILD_DIR}) in you CMakeLists.txt – AmeyaVS May 30 '17 at 10:06
  • @AmeyaVS I tried printing it and it returns a NULL string. I tried the same for other built in plugins too but the same thing happened. – Saloni Mundra May 31 '17 at 08:46
  • Can you try this out in Ubuntu and see what are the differences. Run make command like this: make VERBOSE=1 which will show the complete compilation command line. Compare the logs from both MacOSX and Ubuntu – AmeyaVS May 31 '17 at 08:52

0 Answers0