0

When run make, I got the following error:

john@john-Inspiron-7720:~/sdrportal/SDRPortal/build$ make
[  8%] Built target genc
[ 82%] Built target sdrportalShared
[ 86%] Linking CXX executable uhdd
/usr/bin/ld: CMakeFiles/uhdd.dir/uhd_daemon.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
//usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
src/CMakeFiles/uhdd.dir/build.make:98: recipe for target 'src/uhdd' failed
make[2]: *** [src/uhdd] Error 1
CMakeFiles/Makefile2:109: recipe for target 'src/CMakeFiles/uhdd.dir/all' failed
make[1]: *** [src/CMakeFiles/uhdd.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

So I have been trying to figure out this problem for a while, I have tried manually linking boost libraries, yet the same error occurs.

I have also noticed it could be a compiler issue.

Also, if anyone has worked with gnuradio/SDRs, specifically the Ben Kempke libraries (https://github.com/bpkempke) you may have an easier time helping me figure this out.

(Apologies if post is confusing or the solution is trivial, software is not really my forte, I was just assigned to a research project involving software defined radios and I need to figure out how to make these Kempke libraries work, or if someone could direct me to a method of developing my own CCSDS encoding, decoding, and correlating blocks for gnu radio.

I have also tried these solutions: How do you add Boost libraries in CMakeLists.txt?

Using Spandan's method: make can't complete successfully because the 'target' is not an executable being 'built' by this 'project'.

I also wanted to try this solution: https://github.com/raulmur/ORB_SLAM2/issues/535 , but I have not found a CMakeLists.txt or Makefile that includes the arguments for set(LIBS...) argument in the compiler within this package.

CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)
project(SDRPortal)

#Version 0.1
set(SDRPortal_VERSION_MAJOR 0)
set(SDRPortal_VERSION_MINOR 1)

#Set the paths to find the correct header files
include_directories(
    ${CMAKE_SOURCE_DIR}/lib
)

#And the library which provides dynamic linking (will be different for NaCl though...)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

#Find the threading library 'package'
find_package(Threads)
find_package(UHD)
find_package(LibHackRF)
find_package(LibRTLSDR)
find_package(Portaudio)

#Add in debugging symbols for now... TODO: Get rid of debugging symbols
set(CMAKE_CXX_FLAGS "-g -Wall -std=c++0x")

add_subdirectory(lib)
add_subdirectory(src)

set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

Invoking cmake:

john@john-Inspiron-7720:~/sdrportal/SDRPortal/build$ cmake ../
-- Configuring done
-- Generating done
-- Build files have been written to: /home/john/sdrportal/SDRPortal/build

I simply just need to make and install this package. It will generate usable blocks in gnuradio companion.

Following Spandan's method I get way more errors and warning even when invoking cmake ../ :

john@john-Inspiron-7720:~/sdrportal/SDRPortal/build$ cmake ../
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:32 (find_package)


-- Could NOT find Boost
CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:34 (find_package)


CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:34 (find_package)


CMake Warning at /usr/share/cmake-3.10/Modules/FindBoost.cmake:567 (message):
  Imported targets and dependency information not available for Boost version
  (all versions older than 1.33)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:907 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.10/Modules/FindBoost.cmake:1558 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:35 (find_package)


CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:35 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/john/sdrportal/SDRPortal/build/CMakeFiles/CMakeOutput.log".
See also "/home/john/sdrportal/SDRPortal/build/CMakeFiles/CMakeError.log".

portalDataSocket.h

#ifndef PORTAL_DATA_H
#define PORTAL_DATA_H

#include "hierarchicalDataflowBlock.h"
#include "genericSocketInterface.h"
#include "streamConverter.h"
#include "generic.h"

class genericSDRInterface;

class portalDataSocket : public hierarchicalDataflowBlock{
public:
    portalDataSocket(socketType in_socket_type, int socket_num);
    ~portalDataSocket();

    int getPortNum();
    void setUID(int in_uid);
    int getUID();

    streamType getStreamType(){return stream_type;};
    void setStreamType(streamType in_stream_type){stream_type = in_stream_type;};

    //Methods inherited from hierarchicalDataflowBlock
    virtual void dataFromUpperLevel(void *data, int num_bytes, int local_up_channel=0);
    virtual void dataFromLowerLevel(void *data, int num_bytes, int local_down_channel=0);
private:
    int uid;
    genericSocketInterface *socket_int;
    streamType stream_type;
};

#endif

portalCommandSocket.cc

#include <iostream>
#include <vector>
#include <sstream>
#include <stdio.h>
#include "portalDataSocket.h"
#include "portalCommandSocket.h"
#include "streamConverter.h"

portalCommandSocket::portalCommandSocket(socketType in_socket_type, int socket_num, genericSDRInterface *in_sdr_int){
    sdr_int = in_sdr_int;
    cmd_socket_type = in_socket_type;
    profile_loaded = false;

    //Create the socket that we'll be listening on...
    socket_int = new genericSocketInterface(in_socket_type, socket_num);

    //Link upper and lower 
    this->addLowerLevel(socket_int);
    socket_int->addUpperLevel(this);
}

portalCommandSocket::~portalCommandSocket(){
    delete socket_int;
}

void portalCommandSocket::dataFromUpperLevel(void *data, int num_bytes, int local_up_channel){
    //Data coming in from the SDR -- should only be handled by portalDataSocket...

}

void portalCommandSocket::dataFromLowerLevel(void *data, int num_messages, int local_down_channel){
    //Data coming in from the socket

    //First, we need to make sure data is casted correctly (data is a pointer to a vector of messages)
    messageType *in_messages = static_cast<messageType *>(data);
    std::cout << "GOT HERE" << std::endl;

    //Insert historic messages into a string stream so as to easily extract lines
    //TODO: There probably needs to be one stringstream for each channel, otherwise parsing will get confused...
    static std::stringstream command_stream;
    for(int ii=0; ii < num_messages; ii++){
        std::string in_data_string(in_messages[ii].buffer,in_messages[ii].num_bytes);
        command_stream << in_data_string;
    }

    //Now parse out incoming commands
    std::string current_command;
    if(!getline(command_stream, current_command).fail()){
        std::stringstream arg_stream(current_command);
        std::string command, arg1, arg2;

        //Process the command, first argument, and second argument
        arg_stream >> command;
        arg_stream >> arg1;
        arg_stream >> arg2;

        //cout << command << " " << arg1 << " " << arg2 << std::endl;

        //Now do whatever we need to do based on the received command
        //TODO: Put in some error checking here
        char response[20];
        messageType response_message;
        response_message.socket_channel = in_messages[0].socket_channel;
        response_message.buffer = response;
        try{
            if(command == "NEWCHANNEL"){
                //Figure out what type of socket we want to make here...
                socketType new_channel_type = SOCKET_TCP;
                if(arg1 == "WS_TEXT")
                    new_channel_type = SOCKET_WS_TEXT;
                else if(arg1 == "WS_BINARY")
                    new_channel_type = SOCKET_WS_BINARY;

                //The client wants to add a data channel connection...
                // Better create one! (and pass the random port back to the client so that he can connect to it...)
                portalDataSocket *data_socket = new portalDataSocket(new_channel_type, 0);

                cur_channel = sdr_int->addChannel(data_socket);
                data_socket->addUpperLevel(sdr_int);
                response_message.num_bytes = sprintf(response_message.buffer,"%d: %d\r\n", cur_channel, data_socket->getPortNum());
                dataToLowerLevel(&response_message, 1);
            } else if(command == "CHANNEL"){
                if(isInteger(arg1)){
                    int candidate_channel = strtol(arg1.c_str(), NULL, 0);
                    if(sdr_int->getNumAllocatedChannels() > candidate_channel)
                        cur_channel = candidate_channel;
                    else
                        throw badArgumentException(badArgumentException::OUT_OF_BOUNDS, 1, arg1);
                } else
                    throw badArgumentException(badArgumentException::MALFORMED, 1, arg1);
            } else if(command == "RXCHANNEL"){
                if(isInteger(arg1)){
                    sdr_int->bindRXChannel(strtol(arg1.c_str(), NULL, 0), cur_channel);
                    response_message.num_bytes = sprintf(response_message.buffer,"%d\r\n",cur_channel);
                    dataToLowerLevel(&response_message, 1);
                } else
                    throw badArgumentException(badArgumentException::MALFORMED, 1, arg1);
            } else if(command == "TXCHANNEL"){
                if(isInteger(arg1)){
                    sdr_int->bindTXChannel(strtol(arg1.c_str(), NULL, 0), cur_channel);
                    response_message.num_bytes = sprintf(response_message.buffer,"%d\r\n",cur_channel);
                    dataToLowerLevel(&response_message, 1);
                } else
                    throw badArgumentException(badArgumentException::MALFORMED, 1, arg1);
            } else if(command == "DATATYPE"){
                streamType new_type = stringToStreamType(arg1);
                if(new_type != STREAM_UNKNOWN){
                    sdr_int->setStreamDataType(new_type, cur_channel);
                    response_message.num_bytes = sprintf(response_message.buffer,"%s\r\n",arg1.c_str());
                    dataToLowerLevel(&response_message, 1);
                } else
                    throw badArgumentException(badArgumentException::MALFORMED, 1, arg1);
            } else if(command == "SDR_DISCONNECT"){
                //This command disconnects the SDR from SDRPortal for use elsewhere
                sdr_int->disconnect();
            } else if(command == "SDR_CONNECT"){
                //This command re-connects a previously-disconnected SDR to SDRPortal
                sdr_int->connect();
            } else if(command == "TX_LOGFILE"){
                //TODO: Implement this...
            } else if(command == "RX_LOGFILE"){
                //TODO: Implement this...
            } else if(command == "LOAD_PROFILE"){
                //TODO: Profiles need to be instantiated on a connection-by-connection basis...
                if(isValidProfile(arg1)){
                    //Unload the current profile if there is one
                    if(profile_loaded)
                        delete cur_profile;

                    //Now load up a new profile with the specified name
                    cur_profile = new portalProfile(arg1);
                    profile_loaded = true;
                }
            } else if(command == "UNLOAD_PROFILE"){
                //Unload the current profile if there is one
                if(profile_loaded)
                    delete cur_profile;
                profile_loaded = false;
            } else if(profile_loaded && cur_profile->acceptsCommand(command)){
                //Send profile-specific command off to the currently-loaded profile
                std::string response = cur_profile->sendCommand(current_command);
                response_message.num_bytes = response.length();
                memcpy(response_message.buffer, &response[0], response_message.num_bytes);
                dataToLowerLevel(&response_message, 1);
            } else {
                sdr_int->setSDRParameter(cur_channel, command, arg1);
            }
        } catch(badArgumentException const& e){
            std::stringstream response;
            response << "?" << e.what() << std::endl;
            dataToLowerLevel((void*)(response.str().c_str()),response.gcount());
        } catch(invalidCommandException const& e){
            std::stringstream response;
            response << "?" << e.what() << std::endl;
            dataToLowerLevel((void*)(response.str().c_str()),response.gcount());
        }

        //Query-based commands
        response_message.num_bytes = 0;
        rxtxChanInfo cur_chan_info = sdr_int->getChanInfo(cur_channel);
        if(command.substr(0,6) == "RXFREQ")
            response_message.num_bytes = sprintf(response_message.buffer,"%f\r\n",sdr_int->getRXFreq(cur_chan_info).getDouble());
        else if(command.substr(0,6) == "TXFREQ")
            response_message.num_bytes = sprintf(response_message.buffer,"%f\r\n",sdr_int->getTXFreq(cur_chan_info).getDouble());
        else if(command.substr(0,6) == "RXGAIN")
            response_message.num_bytes = sprintf(response_message.buffer,"%f\r\n",sdr_int->getRXGain(cur_chan_info).getDouble());
        else if(command.substr(0,6) == "TXGAIN")
            response_message.num_bytes = sprintf(response_message.buffer,"%f\r\n",sdr_int->getTXGain(cur_chan_info).getDouble());
        else if(command.substr(0,6) == "RXRATE")
            response_message.num_bytes = sprintf(response_message.buffer,"%d\r\n",(int)(sdr_int->getRXRate(cur_chan_info).getDouble()+0.5));
        else if(command.substr(0,6) == "TXRATE")
            response_message.num_bytes = sprintf(response_message.buffer,"%d\r\n",(int)(sdr_int->getTXRate(cur_chan_info).getDouble()+0.5));

        //Send off the response
        if(response_message.num_bytes > 0)
            dataToLowerLevel(&response_message,1);
    }

}
jbmcdoug
  • 1
  • 1
  • Please include the error message also in the body of your post, it's easier to read and work with. – Rikudou_Sennin May 07 '19 at 17:30
  • Thanks for the suggestion, the edit has been made. For some reason the terminal dialogue is registered as code (maybe that's normal) and was preventing me from posting it as plain text. – jbmcdoug May 07 '19 at 18:03
  • The part of `CMakeLists.txt` lacks for code which finds Boost, which creates executable and which links it with libraries - all **important parts are missed**! Without these parts it is difficult to say what is wrong. You tells, that you have tried other approaches, but you neither specify the code you use nor the **exact** error message you got - again, it is difficult to say what you are doing wrong. In [Spandans's answer](https://stackoverflow.com/a/48498679/3440745) note on the text between the code snippets: it could be the key to your error. – Tsyvarev May 07 '19 at 20:06
  • When I implement Spandan's method I get multiple new errors when invoking cmake: – jbmcdoug May 07 '19 at 20:47
  • The error message of Spandan's idea is now in the body of my original post. – jbmcdoug May 07 '19 at 20:54
  • Still there is no important parts of code... As for error message, it is just about not finding the Boost. And the warnings are about Boost being too new or too old for given CMake version. You may find many questions on Stack Overflow about these warning and error. – Tsyvarev May 07 '19 at 22:02
  • Where would I find the code that finds Boost? is it normally included in the CMakeLists.txt is would it be a separate file in the package I am trying to make and install? If so, would it have the same directory hierarchy (be in the same directory) or maybe in the build directory? Maybe if I found it that would make things more clear. – jbmcdoug May 07 '19 at 22:28
  • Do you ever have Boost installed? I mean not only libraries (you have at least the one of them, `/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1`), but a **development** package too (on Ubuntu 18 it is [libboost-dev](https://packages.ubuntu.com/bionic/libboost-dev)). The error clearly states, that Boost is not found on your system. While finding Boost libraries could be tricky sometimes, finding Boost headers shouldn't be hard.. assuming you have them. – Tsyvarev May 07 '19 at 23:19
  • I have never installed the boost libraries directly, perhaps I can give that a try. I do have a directory named libboost-dev, but it only contains a copyright txt file and changelog.gz I would assume that there needs to be more. Other than that, there are multiple libboost folders with -dev in the name, but they only contain the same files. There is a libboost1.65-dev that contains two other files, one being a readme.txt and the other a folder of examples. – jbmcdoug May 08 '19 at 01:36
  • So, I got rid of the edits to the CMakeList that Spandan suggested and used synaptic to get libboost1.65-all-dev and libboost1.65-docs. Trying to install boost from the command line yielded no results, as I apparently must've inadvertently installed boost that way and no new packages or files were installed or updated. However, I now get this error: /home/john/sdrportal/SDRPortal/src/portalCommandSocket.cc:22:10: fatal error: portalDataSocket.h: No such file or directory #include "portalDataSocket.h" – jbmcdoug May 08 '19 at 01:56
  • The portalDataSocket.h doesn't even appear to be included in the source from Kempke's repo: https://github.com/bpkempke/SDRPortal/tree/master/src. Is this another package I need to get? I will look anyway, just in case. EDIT: there is a portalDataSocket.h, just not in the same directory. Will post that code. – jbmcdoug May 08 '19 at 02:09

0 Answers0