[Rock-dev] modbus library
fahrlich
fahrlich at marum.de
Mon Apr 27 16:17:16 CEST 2015
Hi
i wrote a modbus driver that depends on linux-modbus library .
The driver is called base_modbus and i added a FindModbus.cmake file
to the project
and following lines to the CMakeList.txt in the src folder:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/")
rock_find_cmake(modbus)
include_directories(${modbus})
So far , this works fine .
Then i wrote another driver, called irdh_bender, that inherits from
base_modbus.
I did the same stuff as described above: put the findModbus.cmake
script into the the project folder and
adapted the CMakeLists.txt
This works fine, too
Then i wrote a task, to run the irdh_bender lib. Again, i put the
findmodbus.cmake file into project folder.
Into CmakeLists.txt i added:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
message(STATUS " cmake module path : ${CMAKE_MODULE_PATH}")
FIND_PACKAGE(Modbus REQUIRED)
list(APPEND EXTRA_LIBS modbus)
include_directories(${MODBUS_INCLUDE_DIR})
message(STATUS "cmake module path : ${MODBUS_INCLUDE_DIR}")
But if i run amake i get following linking error
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_new_tcp_pi'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_read_input_registers'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_flush'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_close'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_set_debug'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_free'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_connect'
/home/fahrlich/code/rock/install/lib/libbase_modbus.so: Nicht
definierter Verweis auf `modbus_strerror'
But in rock/install/log/drivers/orogen/irdh_bender-configure.log ui can
see that the lib was found :
cmake module path :
/home/fahrlich/code/rock/drivers/orogen/irdh_bender/.orogen/config;/home/fahrlich/code/rock/drivers/orogen/irdh_bender
-- Found libmodbus: /usr/lib/x86_64-linux-gnu/libmodbus.so
-- Found modbus include Dir: /usr/include/modbus
How can i fix this ?
thanks
Frauke
More information about the Rock-dev
mailing list