I am trying to establish a serial connection between arduino and a computer running ubuntu 14.04.
I am using this library https://github.com/wjwwood/serial
There are several dependencies, which I hoped to avoid because I am very new to this and wanted to keep this as basic as possible. Apparently I was not the only one, and the project owner has replied with this https://github.com/wjwwood/serial/issues/52
I used that CMakeLists.txt on the example provided in serial/examples/serial_example.cc (cannot post direct link due to restrictions, but it is github)
These are the steps I took
- Place the CMakeList.txt from above into /serial/ library, replacing the original one
- Place serial_example.cc into /serial/src/ directory and rename it to "my_program.cpp"
- Open gnome-terminal and navigate to /serial/ folder
- In terminal execute "mkdir build" and enter that directory
- In terminal execute "cmake ../"
In terminal execute "make"
[ 66%] Built target serial Linking CXX executable my_program CMakeFiles/my_program.dir/src/my_program.cpp.o: In function
enumerate_ports()': my_program.cpp:(.text+0x32): undefined reference to
serial::list_ports()' collect2: error: ld returned 1 exit status make[2]: * [my_program] Error 1 make1: * [CMakeFiles/my_program.dir/all] Error 2 make: *** [all] Error 2
I have tried running make with sudo, but did not have success
This is the content of build directory after "cmake ../"
total 188
-rw-rw-r-- 1 dundua dundua 12080 maj 24 13:49 CMakeCache.txt
drwxrwxr-x 7 dundua dundua 4096 maj 24 13:51 CMakeFiles
-rw-rw-r-- 1 dundua dundua 1630 maj 24 13:49 cmake_install.cmake
-rw-rw-r-- 1 dundua dundua 162888 maj 24 13:49 libserial.a
-rw-rw-r-- 1 dundua dundua 6837 maj 24 13:49 Makefile
After some search, it appears that I am running into a similar issue that is described in github, as issue #78, and using Code::Blocks to manually link to a compiled libserial.so in another directory seems to work, but I would like to know how to accomplish this without Code::Blocks since I will need to merge my code with another cmake project