Compile Modules in the external Directory of the Source Code

Testing Environment:

  • LKD3588: Ubuntu 20.04

  • Kernel Version: 5.10.110

Compile rockit/mpi

  1. Location of the rockit source code:

SDK/external/rockit
  1. Copy the rockit folder to the /home/neardi directory on the development board.

  2. Replace the default CMakeLists file in rockit/mpi/CMakeLists.txt with the following content:

cmake_minimum_required( VERSION 2.8.8 )
project (rockit)
include_directories(sdk/include)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
set(ROCKIT_DEP_COMMON_LIBS
    ${CMAKE_CURRENT_LIST_DIR}/../lib/lib64/librockit.so
)
set(ROCKIT_FILE_LIBS
    ${ROCKIT_DEP_COMMON_LIBS}
    ${CMAKE_CURRENT_LIST_DIR}/sdk/lib64/libgraphic_lsf.so
    ${CMAKE_CURRENT_LIST_DIR}/sdk/lib64/librkgfx_avs.so
)
set(ROCKIT_DUMPSYS_FILE ${CMAKE_CURRENT_LIST_DIR}/example/bin/bin64/dumpsys)

add_subdirectory(sdk)
add_subdirectory(example)

Note: Add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") to avoid the following error:

/usr/bin/ld: ../common/librt_test_comm.a(test_mod_vpss.cpp.o): undefined reference to symbol 'pthread_create@@GLIBC_2.17'
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/libpthread.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
  1. Install the build environment on the development board:

sudo update
sudo apt install gcc g++ clang make-guile build-essential cmake
  1. Start the compilation:

neardi@LPA3588:~/rockit/mpi$ cmake .
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build WITH linker libs for Linux
-- Configuring done

-- Generating done
-- Build files have been written to: /home/neardi/rockit/mpi
neardi@LPA3588:~/sdk/rockit/mpi$ make -j8
Scanning dependencies of target rt_test_comm
[  3%] Building CXX object example/common/CMakeFiles/rt_test_comm.dir/test_comm_imgproc.cpp.o
[  5%] Building CXX object example/common/CMakeFiles/rt_test_comm.dir/test_comm_sys.cpp.o
[  7%] Building CXX object example/common/CMakeFiles/rt_test_comm.dir/test_comm_argparse.cpp.o
......
[ 94%] Built target rk_mpi_adec_test
[ 96%] Building CXX object example/mod/CMakeFiles/rk_mpi_rgn_test.dir/test_mpi_rgn.cpp.o
[ 98%] Linking CXX executable rk_mpi_tde_test
[100%] Linking CXX executable rk_mpi_rgn_test
[100%] Built target rk_mpi_tde_test
[100%] Built target rk_mpi_rgn_test
  1. The compiled files are located in the rockit/mpi/example directory.

  2. Testing:

root@LPA3588:/home/neardi/rockit/mpi/example/mod# ./rk_mpi_vi_test -t 1  -w 1920 -h 1080 -m 1 -n /dev/video22
vi               09:54:03-390 {main              :1381} test running enter!
vi               09:54:03-390 {main              :1487} test running enter ctx->aEntityName=/dev/video22!
cmd parse result:
output file open      : 0
yuv output file name  : /
enc0 output file path : //
enc1 output file path : //
loop count            : 100
enMode                : 1
dev                   : 0
pipe                  : 0
channel               : 1
width                 : 1920
height                : 1080
enCompressMode        : 0
enMemoryType          : 1
aEntityName           : /dev/video22
.....
vi               09:54:53-143 {test_vi_bind_venc_:999} chn:0, loopCount:97 enc->seq:97 wd:69 pts=1758285506 delay=63061us

vi               09:54:53-200 {test_vi_bind_venc_:999} chn:0, loopCount:98 enc->seq:98 wd:69 pts=1758345853 delay=58999us

RTScheduler      09:54:53-264 {pause             :332} calling pause
vi               09:54:53-264 {test_vi_bind_venc_:999} chn:0, loopCount:99 enc->seq:99 wd:69 pts=1758406155 delay=63416us

RTScheduler      09:54:53-275 {stop              :371} calling stop
RTDeviceV4L2     09:54:53-275 {invoke            :975} unsupport command interrupt
RTScheduler      09:54:53-319 {checkScheduleDone :221} quit scheduler, error/limit is found!
RTScheduler      09:54:53-320 {quit              :393} Signaling scheduler termination
RTDeviceV4L2     09:54:53-320 {invoke            :975} unsupport command interrupt
vi               09:54:53-370 {test_vi_bind_venc_:1024} RK_MPI_VI_DisableChn 0
RTScheduler      09:54:53-370 {pause             :332} calling pause
vi               09:54:53-370 {test_vi_bind_venc_:1031} destroy enc chn:0
RTScheduler      09:54:53-370 {stop              :371} calling stop
RTScheduler      09:54:53-370 {checkScheduleDone :221} quit scheduler, error/limit is found!
RTScheduler      09:54:53-370 {quit              :393} Signaling scheduler termination
vi               09:54:53-392 {test_vi_bind_venc_:1040} RK_MPI_VI_DisableDev 0
vi               09:54:53-392 {main              :1526} test running exit:0
RKSockServer     09:54:53-466 {start             :163} accept failed
rk-debug call distortionByGpuDeinit mInitSucee=1,threadId=547729088944
rk-debug GpuManage.refcnt=2
rk-debug call distortionByGpuDeinit mInitSucee=1,threadId=547608326576
rk-debug GpuManage.refcnt=1
rk-debug call destroyEGL 
RTAllocatorStore 09:54:53-509 {commFinalize      :200} release common allocator[0x55afa66e30]

If the test indicates that libraries are missing, manually copy the compiled .so files to the /usr/lib64 directory.

8、Rockit User Manual

The documentation provided with the SDK can be found: Linux->Multimedia->Rockchip_User_Guide_Linux_Rockit_CN.pdf. It can also be downloaded from Cloud Disk.