Closed Zevolusion closed 2 years ago
@Zevolusion : could you share a bit more info about what arguments you've passed into cmake?
librt is located using the cmake find_library function. you'll need to make sure the librt .so object is available in your cross compilation environment.
libRT is only required for a few of the demos (listed below). So It may not be necessary depending on your use case.
My complier is mips-gcc472-glibc216-32bit-r2.3.3. And I try another branch which is v4_beta_deprecated, it occurs same error:
@Zevolusion : For cmake to be able to find the librt library, it needs to know where to look. You can approach this in a couple different ways:
build and use a cmake toolchain file with all of the relevant paths defined... Something like this:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSROOT /path/to/rootfs)
set(CMAKE_STAGING_PREFIX /path/to/install/directory)
set(CMAKE_C_COMPILER /path/to/gcc)
set(CMAKE_CXX_COMPILER /path/to/g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
and then pass -DCMAKE_TOOLCHAIN_FILE=/path/to/mips-toolchain.cmake into the cmake configuration command. OR
define the LIB and INCLUDE environment variables so that cmake can locate librt. For your toolchain, it's likely something like this:
export LIB=/path/to/toolchain/mips-linux-gnu/libc/usr/lib
export INCLUDE=/path/to/toolchain/mips-linux-gnu/libc/usr/include
It works, Thanks! @paulbartell
Glad to help.
I try to cross-compiling on a T31 Board. But it occured error, seems like rt library could not compile. How can I fix this?