logiops icon indicating copy to clipboard operation
logiops copied to clipboard

Linkage error for libconfig in Ubuntu 16.04

Open tianhuat opened this issue 3 years ago • 1 comments

I am using Ubuntu 16.04 and I encounter the following error during the linking stage of make, how should I address it?

...
[ 90%] Building CXX object src/logid/CMakeFiles/logid.dir/backend/dj/Report.cpp.o
[ 91%] Building CXX object src/logid/CMakeFiles/logid.dir/util/workqueue.cpp.o
[ 93%] Building CXX object src/logid/CMakeFiles/logid.dir/util/worker_thread.cpp.o
[ 95%] Building CXX object src/logid/CMakeFiles/logid.dir/util/task.cpp.o
[ 96%] Building CXX object src/logid/CMakeFiles/logid.dir/util/thread.cpp.o
[ 98%] Building CXX object src/logid/CMakeFiles/logid.dir/util/ExceptionHandler.cpp.o
[100%] Linking CXX executable ../../logid
CMakeFiles/logid.dir/actions/Action.cpp.o: In function `logid::actions::Action::makeAction(logid::Device*, libconfig::Setting&)':
Action.cpp:(.text+0x1cc): undefined reference to `libconfig::Setting::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
CMakeFiles/logid.dir/actions/KeypressAction.cpp.o: In function `logid::actions::KeypressAction::Config::Config(logid::Device*, libconfig::Setting&)':
KeypressAction.cpp:(.text+0x3a6): undefined reference to `libconfig::Setting::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
KeypressAction.cpp:(.text+0x3fa): undefined reference to `libconfig::Setting::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
CMakeFiles/logid.dir/actions/GestureAction.cpp.o: In function `logid::actions::GestureAction::Config::Config(logid::Device*, libconfig::Setting&)':
GestureAction.cpp:(.text+0x1199): undefined reference to `libconfig::Setting::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
GestureAction.cpp:(.text+0x12e3): undefined reference to `libconfig::Setting::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const'
CMakeFiles/logid.dir/actions/ChangeHostAction.cpp.o:ChangeHostAction.cpp:(.text+0x4f2): more undefined references to `libconfig::Setting::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >() const' follow
collect2: error: ld returned 1 exit status
src/logid/CMakeFiles/logid.dir/build.make:1025: recipe for target 'logid' failed
make[2]: *** [logid] Error 1
CMakeFiles/Makefile2:97: recipe for target 'src/logid/CMakeFiles/logid.dir/all' failed
make[1]: *** [src/logid/CMakeFiles/logid.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

Some side information:

  1. I have done all the libraries installation. cmake libevdev-dev libudev-dev libconfig++-dev buildessential
  2. Here's the output of cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.7.4") 
LogiOps Version Number: v0.2.2-59-g6bb4700
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libevdev'
--   Found libevdev, version 1.4.6
-- Checking for module 'systemd'
--   Found systemd, version 229
-- Checking for module 'libconfig'
--   Found libconfig, version 1.5
-- Checking for module 'libudev'
--   Found libudev, version 229
-- systemd units will be installed at /lib/systemd/system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/Desktop/logiops/build

tianhuat avatar Jun 05 '21 23:06 tianhuat

I had the same error before (Ubuntu 20.04 - Logiops v0.2.3), and fixed it by updating GCC / G++ from 5.x to 9.x. Now it installs without problem. Maybe the same works for you - try updating GCC / G++ from 7.5 to something newer.

matthijssjansen avatar Jul 01 '21 13:07 matthijssjansen