×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

DEBUG(F) undefined symbol, linking problems?

  • Posts: 271
  • Thank you received: 72
Hi.

So i'm updating my custom roof / power relay driver, and thought i would swap from IDLog to DEBUGF(INDI::Logger::SESSION.. and now i get a undefined symbol in runtime.
Driver indi_usbrelay2_roof: : symbol lookup error: undefined symbol: _ZN4INDI6Logger5printEPKcjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS2_z
When i run
c++filt _ZN4INDI6Logger5printEPKcjRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS2_z
i get
INDI::Logger::print(char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, char const*, ...)

I have tried googeling for similar errors, i think its the "std::__cxx11::basic_string<char,std::char_traits<char>" that's a clue to the issue? Some solutions i found was adding -D_GLIBCXX_USE_CXX11_ABI=0 to CMAKE_CXX_FLAGS. This gives me
undefined reference to `INDI::Logger::print(char const*, unsigned int, std::string const&, int, char const*, ...)
on compile time, so the issue lies elsewhere

Am i missing some import / library linking here?
I am compiling with
include_directories( ${INDI_INCLUDE_DIR})
include_directories( ${NOVA_INCLUDE_DIR})
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_SOURCE_DIR}/usbrelay2_roof)
 
################ USB RELAY2 ##############################
set(usbrelay2_SRCS
        ${CMAKE_SOURCE_DIR}/usbrelay2_roof/usbrelay2_roof.cpp
        ${CMAKE_SOURCE_DIR}/usbrelay2_roof/usb_interface.cpp
   )
 
add_executable(indi_usbrelay2_roof ${usbrelay2_SRCS})
target_link_libraries(indi_usbrelay2_roof ${INDI_DRIVER_LIBRARIES} ${USB_RELAY_DEVICE_LIBRARIES})
install(TARGETS indi_usbrelay2_roof RUNTIME DESTINATION bin )
install(FILES ${CMAKE_SOURCE_DIR}/usbrelay2_roof/99-usbrelay2.rules DESTINATION ${UDEVRULES_INSTALL_DIR})
install( FILES ${CMAKE_SOURCE_DIR}/usbrelay2_roof/indi_usbrelay2_roof.xml DESTINATION ${DATA_INSTALL_DIR})

Have also tried
target_link_libraries(indi_usbrelay2_roof ${INDI_LIBRARIES} ${INDI_DRIVER_LIBRARIES} ${USB_RELAY_DEVICE_LIBRARIES})
In cmake_modules i have FindINDI.cmake

In .cpp file that uses DEBUG(F) i have #include <libindi/indilogger.h>
In .h file #include <libindi/indidome.h> and class USBRelay2 : public INDI::Dome {

Would appreciate any help.
Proud owner of Observatory 17b - A remote Linux observatory.
Website: Observatory 17b
Build thread @ SGL: Starting summers observatory project
7 years 11 months ago #8017

Please Log in or Create an account to join the conversation.

Are you building libindi or using libindi-dev from the package? If you have two, then make sure you are building against the latest libindi. Remove the build directory and rebuild again.

Also, is your code hosted somewhere?
7 years 11 months ago #8020

Please Log in or Create an account to join the conversation.

  • Posts: 271
  • Thank you received: 72
I do have kstars-bleeding installed, but i also have the libindi source. Before compiling i did a svn up and rm -rf ./* in the build directory and built everything from scratch.

The source is on github.com/magnue/indi_usbrelay2_roof/
The github only has v0.2, i'm currently working on v0.3 with support for up to 10 power channels, support for both 1,2 and 8 channel boards, and utilizing the "normally closed", "normally open" states of the relay. This makes the open, close of roof only need 3 channels.

The github version has the same buildfiles.

New layout for Open / Close

Proud owner of Observatory 17b - A remote Linux observatory.
Website: Observatory 17b
Build thread @ SGL: Starting summers observatory project
7 years 11 months ago #8022
Attachments:

Please Log in or Create an account to join the conversation.

Try adding the follow to CMakeLists.txt just after the include stuff:
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
7 years 11 months ago #8024

Please Log in or Create an account to join the conversation.

  • Posts: 271
  • Thank you received: 72
Solved!

I just upgraded to ubuntu 16.04. I then tried to do svn up and empty libindi/build and then rebuild.

I then got a message from CMake that library libgsl0-dev was missing. Tried sudo apt-get install libgsl0-dev and got a message that it depends on libgsl2.
sudo apt-get install libgsl2 libgsl0-dev
. This somehow decided to remove all libindi stuff and kstars-bleeding. Then i rebuild libindi and start indiserver indi_usbrelay2_roof, and no undefined symbols. Then i added repository
sudo apt-add-repository ppa:mutlaqja/ppa
reinstalled kstars
sudo apt-get install kstars-bleeding kstars-bleeding-dbg indi-dbg
, and everything works as intended.

Did not change anything in code. Btw, i did have
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
in my CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
PROJECT(indi_usbrelay2_roof CXX)
 
cmake_policy(SET CMP0003 NEW)
set(CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
 
##################  Paths  ###################################
 
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
set(UDEVRULES_INSTALL_DIR "/lib/udev/rules.d" CACHE STRING "Base directory for udev rules")
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/indi/")
 
 
IF(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
ENDIF(APPLE)
 
##################  Includes  ################################
 
include (MacroLogFeature)
include (MacroBoolTo01)
 
FIND_PACKAGE(INDI REQUIRED)
#FIND_PACKAGE(INDIDriver REQUIRED)
FIND_PACKAGE(Nova REQUIRED)
FIND_PACKAGE(USBRelayDevice REQUIRED)
 
macro_bool_to_01(INDI_DRIVER_LIBRARIES HAVE_INDIDRIVER_LIB)
macro_bool_to_01(NOVA_FOUND HAVE_NOVA_H)
macro_log_feature(NOVA_FOUND "libnova" "A general purpose, double precision, Celestial Mechanics, Astrometry and Astrodynamics library" "http://libnova.sourceforge.net" FALSE "0.12.1" "Provides INDI with astrodynamics library.")
macro_bool_to_01(USB_RELAY_DEVICE_FOUND HAVE_USB_RELAY_DEVICE_H)
 
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
 
include_directories( ${INDI_INCLUDE_DIR})
include_directories( ${NOVA_INCLUDE_DIR})
include_directories( ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${CMAKE_SOURCE_DIR}/usbrelay2_roof)
 
################ USB RELAY2 ##############################
 
set(usbrelay2_SRCS
        ${CMAKE_SOURCE_DIR}/usbrelay2_roof/usbrelay2_roof.cpp
        ${CMAKE_SOURCE_DIR}/usbrelay2_roof/usb_interface.cpp
   )
 
add_executable(indi_usbrelay2_roof ${usbrelay2_SRCS})
target_link_libraries(indi_usbrelay2_roof ${INDI_DRIVER_LIBRARIES} ${USB_RELAY_DEVICE_LIBRARIES})
install(TARGETS indi_usbrelay2_roof RUNTIME DESTINATION bin )
install(FILES ${CMAKE_SOURCE_DIR}/usbrelay2_roof/99-usbrelay2.rules DESTINATION ${UDEVRULES_INSTALL_DIR})
install( FILES ${CMAKE_SOURCE_DIR}/usbrelay2_roof/indi_usbrelay2_roof.xml DESTINATION ${DATA_INSTALL_DIR})
 
###########################################################

I have just seen that libgsl-dev was installed, not libgsl0-dev
:~/Projects/libindi/build$ sudo apt-get install libgsl2 libgsl0-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libgsl-dev' instead of 'libgsl0-dev'
The following packages were automatically installed and are no longer required:
  dcraw dkms fliusb-dkms fxload kded5 kinit kio kstars-bleeding-data libapogee3 libboost-regex1.55.0 libfishcamp libfli1 libftdi1 libgps21 libindi-data libkf5bookmarks-data
  libkf5bookmarks5 libkf5gpgmepp5 libkf5kiofilewidgets5 libkf5kiontlm5 libkf5newstuff-data libkf5newstuff5 libkf5plotting5 libkf5solid5 libkf5solid5-data libkf5wallet-bin
  libkf5wallet-data libkf5wallet5 libkidletime4 libknewstuff2-4 libkprintutils4 libkwalletbackend5-5 libqhy libqsi7 libsbigudrv2 libwcs4 python-kde4 python-numpy python-pyfits
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  gsl-ref-psdoc | gsl-doc-pdf | gsl-doc-info | gsl-ref-html
The following packages will be REMOVED:
  astrometry.net indi-aagcloudwatcher indi-apogee indi-asicam indi-bin indi-dbg indi-dsi indi-eqmod indi-ffmv indi-fishcamp indi-fli indi-full indi-gphoto indi-gpsd indi-maxdomeii
  indi-qhy indi-qsi indi-sbig indi-sx kstars-bleeding kstars-bleeding-dbg libgsl0ldbl libindi1
The following NEW packages will be installed:
  libgsl-dev libgsl2
0 upgraded, 2 newly installed, 23 to remove and 0 not upgraded.
Need to get 1 802 kB of archives.
After this operation, 154 MB disk space will be freed.
Do you want to continue? [Y/n] y
Proud owner of Observatory 17b - A remote Linux observatory.
Website: Observatory 17b
Build thread @ SGL: Starting summers observatory project
Last edit: 7 years 11 months ago by Magnus. Reason: Terminal output
7 years 11 months ago #8025

Please Log in or Create an account to join the conversation.

Time to create page: 0.186 seconds