Is this right?
tangm421 opened this issue · 2 comments
tangm421 commented
I usually compile it like this in arm-linux platform. Although it can be done in this way, but it also seemed stupid. Is there any other perfect and simple way?
- Step 1: compile jthread
- change workspace to compile directory of jthread.
# tar -jxvf jthread-1.3.1.tar.bz2
# mkdir jthread_tmp
# cd jthread_tmp
- Add this following lines to front of the file
../CMakeLists.txt
.
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER arm-none-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-linux-gnueabi-g++)
set(CMAKE_INSTALL_PREFIX /root/28181)
- And then.
# cmake../
- After that, add this following lines to front of the file
./cmake/JThreadConfig.cmake
, let the jrtp link static library of jthread.
set(JTHREAD_LIBRARIES "/root/28181/lib/libjthread.a" "-lpthread")
# make install
- Step 2: compile jrtp
- change workspace to compile directory of jrtp.
# mkdir jrtplib_tmp
# cd jrtplib_tmp
- Add this following lines to front of the file
../CMakeLists.txt
.
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER arm-none-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-linux-gnueabi-g++)
set(CMAKE_INSTALL_PREFIX /root/28181)
include(${CMAKE_INSTALL_PREFIX}/lib/cmake/JThread/JThreadConfig.cmake)
- Then follow this commands, jrtp will automatically detect the correct JThread.
# cmake ../
# make install
j0r1 commented
I'm not sure if what you're doing is the 'correct' way, I guess in the end the only thing that matters is whether or not it works.
To compile something for the raspberry pi, I did the following. First, I created a toolchain file called toolchain.cmake
:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(tools /path/to/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64)
set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-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)
Then, first for jthread and then for jrtplib, I ran
ccmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=/path/to/rpiroot/ \
-DCMAKE_FIND_ROOT_PATH=/path/to/rpiroot/
Perhaps something similar works for you as well?
tangm421 commented
Yeah, i can't agree more that the only thing that matters is whether or not it works. In fact, it works good on my way, thanks.