# What for catkin needs to link to librt (realtime extension)?

(Setting aside my knowledge about build system is limited,)

There's a macro in catkin: catkin/cmake/tools/rt.cmake, inside of which it tries to find librt I think. Does catkin need realtime extension for:

• building catkin itself?

OR

• building whatever packages that require rt?

or both?

I'm wondering, because while trying to build catkin workspace from source (following this doc) on non-Ubuntu platform (QNX), I get this error:

# cd catkinws && mkdir build && cd build && cmake ../src
:
-- Found gtest sources under '/home/rosuer/catkin_ws/src/gtest': gtests will be built
CMake Error at catkin/cmake/assert.cmake:17 (message):

Assertion failed: check for file existence, but filename
(RT_LIBRARY-NOTFOUND) unset.  Message: RT Library

Call Stack (most recent call first):
catkin/cmake/tools/rt.cmake:42 (assert_file_exists)
catkin/cmake/all.cmake:134 (include)
CMakeLists.txt:12 (include)

-- Configuring incomplete, errors occurred!


While remaining not so sure, I modified a line of rt.cmake as follows that bypass the error above on QNX. And no build-time error occurs on Ubuntu (Quantal) too (I don't know if there's any runtime misbehavior):

x if(NOT (APPLE OR WIN32 OR MINGW OR ANDROID))
o if(NOT (APPLE OR WIN32 OR MINGW OR ANDROID OR UNIX))


Although I'm not sure if UNIX symbol is recognized by cmake on Ubuntu/Linux, succeeding this even on Ubuntu made me wonder why linking to rt is needed in catkin level.

Thank you!

edit retag close merge delete

Sort by » oldest newest most voted

While I don't know for sure, I'm pretty confident that catkin itself does not need librt, as it is just a set of cmake files topped with a handful of scripts.

Besides, using UNIX here seems inadequate, as it will disable linking against librt for Linux too. The toolchain file for QNX (if you are using one) most likely defines the QNX macro that you can use instead of UNIX in the rt.cmake file.

Hope this helps.

more

I agree that using UNIX symbol like I cited might be a bad idea (although whether it influences linux is not clear to me). And I don't explicitly use toolchain file for QNX but will look for it if there's anything.

( 2013-07-10 06:16:49 -0500 )edit

I randomly run into this issue every once in a while (every few months). Cleaning and cleanly rebuilding the package that throws the error generally appears to solve the problem. It would still be interesting to know if there is some sort of faulty CMake usage or so that can cause the issue.

more

I just tried catkin build instead of catkin_make that I used previously without problems and I get the same issue. It seems to change the way the application is to be linked or compiled.

more