Bootstrap

(一)afsim第三方库编译

注意:防止奇怪的问题,源码编译的路径最好不要有中文,请先检查各文件夹名

AFSIM版本

Version: 2.9

Plugin API Version: 11

软件环境

操作系统: Kylin V10 SP1

项目构建工具: cmake-3.26.0-linux-aarch64

编译器: gcc version 9.3.0

硬件环境

CPU: Phytium,D2000/8 E8C

GPU: 景嘉威JM9100

安装C++开发环境

安装cmake3.26.0

下载cmake-3.26.0-linux-aarch64.tar.gz(链接: https://pan.baidu.com/s/1-4L5yh_dQMHs1HIFdlWTpQ?pwd=b2te 提取码: b2te)解压到/usr目录下

设置环境变量(全局)

sudo vim ~/.bashrc

在末尾添加

export PATH=/usr/cmake-3.26.0-linux-aarch64/bin:"$PATH"

按ESC键结束编辑,然后按:wq保存退出文本

安装c++编译环境

sudo apt-get update

sudo apt-get install gcc g++

sudo apt install build-essential

sudo apt-get install m4 libtool autoconf automake tcl

安装opengl

sudo apt-get install libglu1-mesa-dev freeglut3-dev

安装python3并设置为默认

sudo apt-get update && sudo apt-get install python3

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

创建编译环境变量(全局)

sudo vim ~/.bashrc

在末尾添加

export AFSIM_HOME=/home/cc/afsim

export AFSIM_3RDPARTY_PATH=$AFSIM_HOME/swdev/dependencies/3rd_party

export LD_LIBRARY_PATH=$AFSIM_3RDPARTY_PATH/tiff-4.3.0-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/tinyxml2-7.1.0-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/sqlite-3.32.3-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/sdl-2.0.16-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/openssl-3.1.1-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/curl-7.79.1-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/proj-8.1.1-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/geos-3.5.1-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/gtest-1.8.0-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/libpng-1.6.37-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/libjpeg-turbo-2.1.2-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/gdal-3.3.2-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/ffmpeg-4.2.4-x64-lnx/lib:$AFSIM_3RDPARTY_PATH/osg-3.6.3-x64-lnx/lib64:$AFSIM_3RDPARTY_PATH/osgEarth-2.10.1-x64-lnx/lib64:$AFSIM_3RDPARTY_PATH/3rd_party/qt-5.12.11-x64-lnx/lib:

按ESC键结束编辑,然后按:wq保存退出文本

第三方库源码下载


链接: https://pan.baidu.com/s/1WEijYrqMV-vmT6St7e6pLA?pwd=fjys 提取码: fjys

编译三方库

zlib-1.2.11

cd zlib-1.2.11

sudo ./configure --enable-shared --prefix=$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx

sudo make -j8 && sudo make install

libpng-1.6.37

cd libpng-1.6.37

mkdir build && cd build

cmake .. -DZLIB_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx/include -DZLIB_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx/lib/libz.so.1.2.11 -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/libpng-1.6.37-x64-lnx -DCMAKE_BUILD_TYPE=Release

sudo make -j8 && sudo make install

libjpeg-turbo-2.1.2

cd libjpeg-turbo-2.1.2

mkdir build && cd build

cmake .. -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/libjpeg-turbo-2.1.2-x64-lnx -DCMAKE_BUILD_TYPE=Release

sudo make -j8 && sudo make install

tiff-4.3.0 build

cd tiff-4.3.0

sudo ./configure --with-pic --enable-shared --prefix=$AFSIM_3RDPARTY_PATH/tiff-4.3.0-x64-lnx

sudo make -j8 && sudo make install

sqlite-3.32.3

cd sqlite-3.32.3

在目录下的sqlite3.c文件中添加一个宏:#define SQLITE_ENABLE_COLUMN_METADATA 1 (用于解决undefined symbol: sqlite3_column_table_name)

sudo CPPFLAGS="-I$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx/include" ./configure --with-pic --enable-shared --prefix=$AFSIM_3RDPARTY_PATH/sqlite-3.32.3-x64-lnx

sudo make -j8 && sudo make install

SDL-2.0.16

cd SDL-release-2.0.16

sudo ./configure --with-pic --enable-shared --prefix=$AFSIM_3RDPARTY_PATH/sdl-2.0.16-x64-lnx

sudo make -j8 && sudo make install

tinyxml2-7.1.0

cd tinyxml2-7.1.0

mkdir build && cd build

cmake .. -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/tinyxml2-7.1.0-x64-lnx -DCMAKE_BUILD_TYPE=Release

sudo make -j8 && sudo make install

googletest-release-1.8.0

cd googletest-release-1.8.0

mkdir build && cd build

cmake .. -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/gtest-1.8.0-x64-lnx -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=true

sudo make -j8 && sudo make install

openssl-3.1.1

cd openssl-3.1.1

sudo ./Configure -fPIC -shared --prefix=$AFSIM_3RDPARTY_PATH/openssl-3.1.1-x64-lnx

sudo make -j8 && sudo make install

curl-7.79.1

cd curl-7.79.1

mkdir build && cd build

cmake .. -DOPENSSL_CRYPTO_LIBRARY=$AFSIM_3RDPARTY_PATH/openssl-3.1.1-x64-lnx/lib/libcrypto.so.3 -DOPENSSL_SSL_LIBRARY=$AFSIM_3RDPARTY_PATH/openssl-3.1.1-x64-lnx/lib/libssl.so.3 -DOPENSSL_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/openssl-3.1.1-x64-lnx/include -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/curl-7.79.1-x64-lnx -DCMAKE_BUILD_TYPE=Release

sudo make -j8 && sudo make install

PROJ-8.1.1

(1)采用clion进行编译:

cmake选项:

-DSQLITE3_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/include -DSQLITE3_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/lib/libsqlite3.so.0.8.6 -DEXE_SQLITE3=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/bin/sqlite3 -DTIFF_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/include -DTIFF_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/lib/libtiff.so.5.7.0 -DCURL_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib/libcurl.so -DCURL_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/include -DSSL_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/openssl-3.1.1-x64-lnx/lib/libssl.so -DSSL_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/openssl-3.1.1-x64-lnx/include -DCMAKE_INSTALL_PREFIX=/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=YES -DUSE_EXTERNAL_GTEST=OFF

(2)需要修改源码中的cmake文件,添加rpath:

src/CMakeLists.txt开始处添加:

function(add_rpath TARGET_NAME)
  if(NOT WIN32)
    set(TEMP_RPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/openssl-3.1.1-x64-lnx/lib)
    set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,${TEMP_RPATH}")
  endif ()
endfunction()

在每个编译异常的add_executable后添加add_rpath

(3)安装

geos-3.5.1

cd geos-3.5.1

mkdir build && cd build

cmake .. -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/geos-3.5.1-x64-lnx -DCMAKE_BUILD_TYPE=Release

sudo make -j8 && sudo make install

编不通:

geos_ts_c.cpp会有报错注释掉 #include "../geos_svn_revision.h" 即可

GEOS_SVN_REVISION改为GEOS_VERSION

ffmpeg-4.2.4

cd ffmpeg-4.2.4

sudo ./configure --enable-shared --prefix=$AFSIM_3RDPARTY_PATH/ffmpeg-4.2.4-x64-lnx --disable-x86asm

sudo make -j8 && sudo make install

gdal-3.3.2

cd gdal-3.3.2/gdal

sudo ./configure --prefix=$AFSIM_3RDPARTY_PATH/gdal-3.3.2-x64-lnx --with-pic --enable-shared --with-proj=$AFSIM_3RDPARTY_PATH/proj-8.1.1-x64-lnx --with-geos=$AFSIM_3RDPARTY_PATH/geos-3.5.1-x64-lnx/bin/geos-config --with-sqlite3=$AFSIM_3RDPARTY_PATH/sqlite-3.32.3-x64-lnx --with-libtiff=$AFSIM_3RDPARTY_PATH/tiff-4.3.0-x64-lnx --with-curl=$AFSIM_3RDPARTY_PATH/curl-7.79.1-x64-lnx/bin/curl-config --with-libz=$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx --with-png=$AFSIM_3RDPARTY_PATH/libpng-1.6.37-x64-lnx

sudo make -j8 && sudo make install

configure及编译时出现的问题

(1)PROJ 6 symbols not found

修改configure文件如下,注释提示错误的代码,添加部分代码

PROJ_FOUND=yes
PROJ_INCLUDE="/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx/include"
$as_echo "PROJ_INCLUDE:$PROJ_INCLUDE"
EXTRA_INCLUDES="-I/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx/include $EXTRA_INCLUDES"
LIBS="-L/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx/lib -lproj  $LIBS"
$as_echo "LIBS:$LIBS"

(2)geos找不到的问题,修改configure文件:

HAVE_GEOS="yes"

HAVE_GEOS_RESULT="yes"

GEOS_LIBS="-lgeos -lgeos_c ${LIBS}"

GEOS_CFLAGS = "-I/home/hua/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx/include -I/home/hua/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx/include/geos"

EXTRA_INCLUDES="-I/home/hua/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx/include $EXTRA_INCLUDES"

EXTRA_INCLUDES="-I/home/hua/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx/include/geos $EXTRA_INCLUDES"

(3)geos链接找不到文件

修改/home/hua/afsim_3rdparty_build/gdal-3.3.2/gdal/GDALmake.opt(注意这个文件是由./configure生成的,要取消保护,在每次./configure后要重新修改)

-L/home/hua/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx/lib -lgeos -lgeos_c

如果出现找不到internalproj,把相应的命令从上面删除

(4)找不到符号

修改/home/hua/afsim_3rdparty_build/gdal-3.3.2/gdal/libtool

/home/cc/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/openssl-3.1.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/libpng-1.6.37-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/libpng-1.6.37-x64-lnx/lib

参考:

linux下编译GDAL3.x(集成Proj和Geos等) - 乌合之众 - 博客园

https://zhuanlan.zhihu.com/p/559612163

OpenSceneGraph-3.6.3

cd OpenSceneGraph-OpenSceneGraph-3.6.3

mkdir build && cd build

cmake .. -DSQLITE3_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/sqlite-3.32.3-x64-lnx/include -DSQLITE3_LIBRARY=$AFSIM_3RDPARTY_PATH/sqlite-3.32.3-x64-lnx/lib/libsqlite3.so.0.8.6 -DEXE_SQLITE3=$AFSIM_3RDPARTY_PATH/sqlite-3.32.3-x64-lnx/bin/sqlite3 -DTIFF_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/tiff-4.3.0-x64-lnx/include -DTIFF_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/tiff-4.3.0-x64-lnx/lib/libtiff.so.5.7.0 -DCURL_DIR=$AFSIM_3RDPARTY_PATH/curl-7.79.1-x64-lnx -DCURL_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/curl-7.79.1-x64-lnx/lib/libcurl.so -DCURL_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/curl-7.79.1-x64-lnx/include -DJPEG_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/libjpeg-turbo-2.1.2-x64-lnx/include -DJPEG_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/libjpeg-turbo-2.1.2-x64-lnx/lib/libturbojpeg.so.0.2.0 -DGDAL_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/gdal-3.3.2-x64-lnx/include -DGDAL_LIBRARY=$AFSIM_3RDPARTY_PATH/gdal-3.3.2-x64-lnx/lib/libgdal.so.29.0.2 -DSDL2_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/sdl-2.0.16-x64-lnx/include -DSDL2_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/sdl-2.0.16-x64-lnx/lib/libSDL2-2.0.so.0.16.0 -DSDL2MAIN_LIBRARY=$AFSIM_3RDPARTY_PATH/sdl-2.0.16-x64-lnx/lib/libSDL2main.la -DPNG_PNG_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/libpng-1.6.37-x64-lnx/include -DPNG_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/libpng-1.6.37-x64-lnx/lib/libpng16.so.16.37.0 -DZLIB_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx/include -DZLIB_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/zlib-1.2.11-x64-lnx/lib/libz.so.1.2.11 -DFFMPEG_ROOT=$AFSIM_3RDPARTY_PATH/ffmpeg-4.2.4-x64-lnx -DCMAKE_INSTALL_PREFIX=$AFSIM_3RDPARTY_PATH/osg-3.6.3-x64-lnx -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=YES

sudo make -j8 && sudo make install

如果采用clion编译,cmake选项如下:

-DSQLITE3_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/include -DSQLITE3_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/lib/libsqlite3.so.0.8.6 -DEXE_SQLITE3=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/bin/sqlite3 -DTIFF_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/include -DTIFF_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/lib/libtiff.so.5.7.0 -DCURL_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx -DCURL_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib/libcurl.so -DCURL_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/include -DJPEG_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/libjpeg-turbo-2.1.2-x64-lnx/include -DJPEG_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/libjpeg-turbo-2.1.2-x64-lnx/lib/libturbojpeg.so.0.2.0 -DGDAL_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/gdal-3.3.2-x64-lnx/include -DGDAL_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/gdal-3.3.2-x64-lnx/lib/libgdal.so.29.0.2 -DSDL2_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/sdl-2.0.16-x64-lnx/include -DSDL2_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/sdl-2.0.16-x64-lnx/lib/libSDL2-2.0.so.0.16.0 -DSDL2MAIN_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/sdl-2.0.16-x64-lnx/lib/libSDL2main.la -DPNG_PNG_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/libpng-1.6.37-x64-lnx/include -DPNG_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/libpng-1.6.37-x64-lnx/lib/libpng16.so.16.37.0 -DZLIB_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/zlib-1.2.11-x64-lnx/include -DZLIB_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/zlib-1.2.11-x64-lnx/lib/libz.so.1.2.11 -DFFMPEG_ROOT=/home/cc/afsim/swdev/dependencies/3rd_party/ffmpeg-4.2.4-x64-lnx -DCMAKE_INSTALL_PREFIX=/home/cc/afsim/swdev/dependencies/3rd_party/osg-3.6.3-x64-lnx -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=YES

注意

osg编译安装完之后,bin目录下的osgviewer应该可以打开.earth文件。终端命令如下:

./osgviewer '/home/cc/afsim/build-debug/resources/maps/bluemarble_db/bmng.earth'

如果不能启动,或者启动后显示白球,请根据提示做修改。

(1)

提示:libturbojpeg.so.0: cannot open shared object file: No such file or directory

解决方案:这是环境变量中没有指定好jpeg库路径,修改~/.bashrc:

参考:libfsuartservo.so: cannot open shared object file: No such file or directory_libavfilter.so.6: cannot open shared object file: -CSDN博客

(2)

提示:

VERTEX glCompileShader "main(vertex)" FAILED

VERTEX Shader "main(vertex)" infolog:

0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, and 3.00 ES

解决方案:

参考:error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.00 ES, and 3.00-CSDN博客

opengl版本问题 - 狂奔~ - 博客园

osgEarth-2.10.1 (参照附录先改一下代码,添加arm64宏定义)

1、参照附录先改一下代码,添加arm64宏定义;

2、用clion进行编译

cmake选项:

-DGEOS_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/geos-3.5.1-x64-lnx -DSQLITE3_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/include -DSQLITE3_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/lib/libsqlite3.so.0.8.6 -DEXE_SQLITE3=/home/cc/afsim/swdev/dependencies/3rd_party/sqlite-3.32.3-x64-lnx/bin/sqlite3 -DTIFF_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/include -DTIFF_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/tiff-4.3.0-x64-lnx/lib/libtiff.so.5.7.0 -DCURL_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx -DCURL_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib/libcurl.so -DCURL_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/include -DJPEG_INCLUDE_DIR=$AFSIM_3RDPARTY_PATH/libjpeg-turbo-2.1.2-x64-lnx/include -DJPEG_LIBRARY_RELEASE=$AFSIM_3RDPARTY_PATH/libjpeg-turbo-2.1.2-x64-lnx/lib/libturbojpeg.so.0.2.0 -DPROJ_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx -DPROJ_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx/include -DPROJ_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/proj-8.1.1-x64-lnx/lib/libproj.so.22.1.1 -DGDAL_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/gdal-3.3.2-x64-lnx -DGDAL_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/gdal-3.3.2-x64-lnx/include -DGDAL_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/gdal-3.3.2-x64-lnx/lib/libgdal.so.29.0.2 -DSDL2_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/sdl-2.0.16-x64-lnx/include -DSDL2_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/sdl-2.0.16-x64-lnx/lib/libSDL2-2.0.so.0.16.0 -DSDL2MAIN_LIBRARY=/home/cc/afsim/swdev/dependencies/3rd_party/sdl-2.0.16-x64-lnx/lib/libSDL2main.la -DPNG_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/libpng-1.6.37-x64-lnx/include -DPNG_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/libpng-1.6.37-x64-lnx/lib/libpng16.so.16.37.0 -DZLIB_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/zlib-1.2.11-x64-lnx/include -DZLIB_LIBRARY_RELEASE=/home/cc/afsim/swdev/dependencies/3rd_party/zlib-1.2.11-x64-lnx/lib/libz.so.1.2.11 -DFFMPEG_ROOT=/home/cc/afsim/swdev/dependencies/3rd_party/ffmpeg-4.2.4-x64-lnx -DOSG_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/osg-3.6.3-x64-lnx -DOSG_INCLUDE_DIR=/home/cc/afsim/swdev/dependencies/3rd_party/osg-3.6.3-x64-lnx/include -DBUILD_OSGEARTH_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/home/cc/afsim/swdev/dependencies/3rd_party/osgEarth-2.10.1-x64-lnx -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=YES -DOSGEARTH_ENABLE_FASTXDT=OFF

3、添加rpath

CMakeModules/OsgEarthMacroUtils.cmake顶部添加函数:

function(add_rpath TARGET_NAME)
    if(NOT WIN32)
        set(TEMP_RPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/curl-7.79.1-x64-lnx/lib:/home/cc/afsim/swdev/dependencies/3rd_party/openssl-3.1.1-x64-lnx/lib)
        set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "-Wl,-rpath,${TEMP_RPATH}")
    endif ()
endfunction()

查找ADD_EXECUTABLE,后面添加add_rpath

4、安装

qt-5.12.11

参见:qt编译

附录

在银河麒麟下适配的修改记录

修改三方库记录

修改原因:osgEarth代码未支持arm64平台

修改方案:添加文件,更换头文件

更改位置:src/osgEarthDrivers/fastdxt/intrinsic.cpp文件

拷贝文件在同文件夹下: sse2neon.h文件(github搜sse2neon,地址:https://github.com/DLTcollab/sse2neon

原来代码:

#include <emmintrin.h> // sse2

现在代码:

#ifdef __aarch64__

#include "sse2neon.h"

#else

#include <emmintrin.h> // sse2

#endif

;