Robotics StackExchange | Archived questions

linking to libserial, "undefined reference to `LibSerial::..." , Melodic, Error.

Hi, I installed libserial from source. Now I got "undefined reference to `LibSerial..." Errors. I searched for the problem but the mentioned "solution" mentioned in this post link text doesnt work. Where to link to the headers and where to see where they actually are on my system? Thanks

Asked by Dragonslayer on 2019-09-12 16:02:12 UTC

Comments

I found a solution (on the worst designed site on the web). Happy to share link text

I leave the question open and unanswered as this solution seems suboptimal (direct linking to headers), and it would be great if someone in the know could provide a good link or answer-post on this important and very frustrating issue, describing a professional solution, best practice, etc.

Asked by Dragonslayer on 2019-09-13 17:30:11 UTC

Answers

I have faced similar issues recently.Try removing libserial using apt, then install the current library using the instructions

Remove with apt using

sudo apt remove libserial-dev

Now install libserial using the following steps (with sudo permissions)

        mkdir serial_dir
        cd serial_dir/ && git clone https://github.com/crayzeewulf/libserial.git
        cd serial_dir && cd libserial && ./compile.sh
        cd serial_dir && cd libserial && cd build && make install 

Now you should be able to find libserial under /usr/local/include

In the CMakelist.txt

target_link_libraries(executableName
  ${catkin_LIBRARIES} serial
)

In package.xml

  <depend>libserial-dev</depend>

Now,try building the package and it should work..!!

Asked by rajmohan747 on 2022-10-05 14:14:36 UTC

Comments