马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
操作体系安装
体系镜像下载
安装镜像下载地点:https://archive.kernel.org/centos-vault/altarch/7.6.1810/isos/aarch64/
下载镜像文件:CentOS-7-aarch64-Everything-1810.iso
体系环境设置及调试
关闭防火墙
- systemctl disable firewalld
- systemctl stop firewalld
- systemctl status firewalld
- iptables -nvL #查看确认恢复初始,无任何网络拦截的配置
复制代码 设置远程
修改sshd,允许root登录,然后重启sshd服务。
打开桌面共享(桌面设置中操作)。
设置在线源
默认在线源已经不维护了,访问不了,以下接纳阿里源。
- cd /etc/
- cp -r yum.repos.d/ yum_repos_d
- cd /etc/yum.repos.d/
- wget http://mirrors.aliyun.com/repo/Centos-altarch-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
- rm -rf CentOS-fasttrack.repo
- yum clean all
- yum makecache
复制代码 假如环境无法联网则可使用该镜像对应的离线源:
https://archive.kernel.org/centos-vault/altarch/7.6.1810/os/aarch64/Packages/
编译openssl
下载源码
openssl-1.0.2g.tar.gz
https://github.com/ope
nssl/openssl/tree/OpenSSL_1_0_2g
编译动态库
- mkdir /root/BBin/openssl
- # centos
- ./config --prefix=/root/BBin/openssl -shared
- #麒麟server sp1
- ./config --prefix=/root/BBin/openssl --enable-shared
- make
- make install
复制代码 编译完成后结果在/root/BBin/openssl下。
编译clamav
下载源码
git堆栈下载0.103.6版本的clamav代码。
二次修改
下载的代码中,当clamscan在扫描的时间会打印一个提示,这种输出会影响我们对扫描结果的解析,所以源码中去除它:
- Loading virus signature database, please wait... Done
复制代码 修改代码后编译:
- # 修改前
- 958 cbdata.filename = "Loading virus signature database, please wait... ";
- 959 cl_engine_set_clcb_sigload(engine, sigloadcallback, &cbdata);
- 1011 mprintf(cbdata.filename);
- 1012 mprintf("done\n");
- # 修改后
- 958 cbdata.filename = "Loading virus signature database, please wait... ";
- 959 // cl_engine_set_clcb_sigload(engine, sigloadcallback, &cbdata);
- 1011 // mprintf(cbdata.filename);
- 1012 // mprintf("done\n");
复制代码 编译依赖解决
根据过程中的编译报错,本次需要增补依赖。
- yum install libtool-ltdl-devel
- # autogen.sh过程依赖
- yum install gcc-c++ # clamav编译使用
- yum install libxml2-devel.aarch64 # clamav编译使用
- yum install libcurl-devel.aarch64
- yum install pcre2-devel.aarch64
- yum install json-c-devel.aarch64
- yum install chrpath.aarch64 #编译后修改rpath使用
复制代码 编译安装指定目录
编译过程更多细节可参考官网:https://docs.clamav.net/manual/Installing/Installing-from-source-Unix-old.html#redhat–centos–fedora
本次操作:
- mkdir -p /root/BBin/clamav
- ./autogen.sh
- # CFLAGS="-Wall -Wextra -ggdb -O0" CXXFLAGS="-Wall -Wextra -ggdb -O0" #如果编译debug版本,则添加此部分在configure前边
- # 事后打包的时候再重置rpath,使用命令: chrpath -r \$ORIGIN/./:\$ORIGIN/../ ./clamscan
- ./configure --prefix=/root/BBin/clamav --with-pcre --with-openssl=/root/BBin/openssl
- make && make install
复制代码 报错解决记载1
- [root@centos-pkg clamav-0.103.6]# ./autogen.sh
- Generating autotools files in: /root/BCompile/clamav-0.103.6 ...
- Use of uninitialized value in split at /usr/bin/autoreconf line 493, <GEN3> line 9.
- libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'.
- xxxxxxxx
- libtoolize: copying file `m4/ltversion.m4'
- libtoolize: copying file `m4/lt~obsolete.m4'
- libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `libltdl'.
- libtoolize: `COPYING.LIB' not found in `/usr/share/libtool/libltdl'
- autoreconf: libtoolize failed with exit status: 1
- Error: Failed to generate autojunk!
- [root@centos-pkg clamav-0.103.6]#
复制代码 解决方式:
- yum install libtool-ltdl-devel
复制代码 clamav使用验证
- # 如下设置符号链接跟踪
- root@test-pc:/opt/output/ClamAV# ./clamscan --no-summary --follow-dir-symlinks=2 --follow-file-symlinks=2 -d VirusDataBase/ /opt/output/ClamAV/
- /opt/output/ClamAV/libssl.so.1.0.0: OK
- /opt/output/ClamAV/libclammspack.so.0.1.0: OK
- /opt/output/ClamAV/libcrypto.so.1.0.0: OK
- /opt/output/ClamAV/libclamav.so.9.0.5: OK
- /opt/output/ClamAV/libclamav.so.9.0.5: OK
- /opt/output/ClamAV/libpcre2-8.so.0.5.0: OK
- /opt/output/ClamAV/libclamunrar.so.9.0.5: OK
- /opt/output/ClamAV/libclamunrar_iface.so.9.0.5: OK
- /opt/output/ClamAV/libclamunrar_iface.so.9.0.5: OK
- /opt/output/ClamAV/libclammspack.so.0.1.0: OK
- /opt/output/ClamAV/libfreshclam.so.2.0.1: OK
- /opt/output/ClamAV/libclamav.so.9.0.5: OK
- /opt/output/ClamAV/libclamunrar.so.9.0.5: OK
- /opt/output/ClamAV/libssl.so.1.0.0: OK
- /opt/output/ClamAV/libclamunrar_iface.so.9.0.5: OK
- /opt/output/ClamAV/libclamunrar.so.9.0.5: OK
- /opt/output/ClamAV/clamscan: OK
- /opt/output/ClamAV/libfreshclam.so.2.0.1: OK
- /opt/output/ClamAV/libjson-c.so.2.0.1: OK
- /opt/output/ClamAV/libclammspack.so.0.1.0: OK
- /opt/output/ClamAV/libcrypto.so.1.0.0: OK
- /opt/output/ClamAV/libpcre2-8.so.0.5.0: OK
- /opt/output/ClamAV/libfreshclam.so.2.0.1: OK
- /opt/output/ClamAV/libjson-c.so.2.0.1: OK
- root@test-pc:/opt/output/ClamAV#
复制代码 编译qt arm版本
必须注意
(1)使用的qt源码,不能从别的机器拷贝,否则编译中由于源码中存在残留的Makefile,残留的.o文件会导致新机器上出题目。为了克制出题目最好使用干净的源码。
(2)克制从拷贝或解压后的源码,会导致部分文件丢失权限, 从而在编译中报错,出现莫名其妙的题目。
综上,在线实时下载比力好。
下载源码 qt5.6.3
- git clone git://code.qt.io/qt/qt5.git
- cd qt5
- git checkout v5.6.3
- git submodule update --init --recursive
复制代码 生成Makefile
注意:这里依赖前边编译的openssl,之前编译安装在/root/BBin/openssl/include目录。
- mkdir -p /root/BBin/qt5.6.3
- ./configure -opensource -confirm-license -largefile -dbus-linked -openssl-linked -I /root/BBin/openssl/include -L /root/BBin/openssl/lib -no-rpath -make libs -make tools -fontconfig -qt-freetype -debug-and-release -qt-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -dbus -openssl -qt-xcb -nomake tests -nomake examples -no-pch -prefix /root/BBin/qt5.6.3
复制代码 注意:这一步假如出错,检查是否支持c++11,其次qtbase/qmake下是否存在从前其他机器的临时编译.o文件未清除,假如未清除会导致再次编译出非常。
qmake是qt编译的第一步,也是其他包括项目clean的关键工具。一般不会错,除非是代码不干净,干净的代码不会出错的。
其次,这一步会检查依赖,假如存在依赖缺失会打印出。这里一般qt用不到所有,不需要全部编译,比如configure阶段提示egl缺失,那么编译安装后就没有/plugins/egldeviceintegrations/这个插件相关内容,所以偶然看到不同机器编译出的模块数量都不同等。这块根据,需要,保障最基本的存在即可,尝试着搞就行了。
假如存在需要的库没编译出则对应解决即可。如下在一个正常机器上的打印:
- [root@localhost qt5]# ./configure -opensource -confirm-license -largefile -dbus-linked -openssl-linked -I /root/myb/openssl/include -L /root/myb/openssl/lib -no-rpath -make libs -make tools -fontconfig -qt-freetype -debug-and-release -qt-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -dbus -openssl -qt-xcb -nomake tests -nomake examples -no-pch -no-neon -prefix /opt/qt5.6.3/
- ........
- Done running configuration tests.
- <srcbase> = /root/myb/qt5/qtbase
- <outbase> = /root/myb/qt5/qtbase
- Creating qmake...
- .Done.
- Running configuration tests (phase 2)...
- checking for C++11... yes.
- checking for C++14... no.
- .........
- checking for GStreamer 0.10... no.
- Done running configuration tests.
- Configure summary
- Build type: linux-g++ (arm64, CPU features: none detected)
- Platform notes:
- - Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
- Build options:
- Configuration .......... accessibility accessibility-atspi-bridge audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent dbus enable_new_dtags evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv icu inotify ipv6ifname large-config largefile libudev linuxfb medium-config minimal-config mremap openssl pcre png posix_fallocate qpa qpa reduce_exports release shared small-config threadsafe-cloexec xcb xcb-glx xcb-plugin xcb-qt xcb-xlib xkbcommon-qt xlib xrender zlib
- Build parts ............ libs tools
- Using LTCG ............. no
- .........
- Support enabled for:
- Accessibility .......... yes
- ALSA ................... no
- .........
- zlib ................... yes (bundled copy)
- Qt is now configured for building. Just run 'gmake'.
- .........
复制代码 测试g++是否支持C++11
g++ -std=c++11 -E - < /dev/null
假如无错误打印,则支持,如下案例。
- [root@centos-pkg ~]# g++ -std=c++11 -E - < /dev/null
- cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C [enabled by default]
- # 1 "<stdin>"
- # 1 "<built-in>"
- # 1 "<command-line>"
- # 1 "/usr/include/stdc-predef.h" 1 3 4
- # 1 "<command-line>" 2
- # 1 "<stdin>"
- [root@centos-pkg ~]#
复制代码 依赖安装
编译qt依赖的安装。
- yum install libX11-devel.aarch64
- yum install libXrender-devel.aarch64
- yum install libxkbcommon-x11-devel.aarch64
- yum install egl-utils.aarch64
- yum install mesa-libGL-devel.aarch64
- yum install mesa-libGLU-devel.aarch64
- yum install freeglut-devel.aarch64
- yum install libXext-devel libXfixes-devel libXi-devel libXrender-devel libxcb-devel libX11-devel libxkbcommon-x11-devel gstreamer* libgstreamer* zlib zlib-devel
- yum install bison build-essential gperf flex ruby libasound2-dev libbz2-dev libcap-dev libcups2-dev libdrm-dev libegl1-mesa-dev libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libgudev1-devel.aarch64 libXtst-devel.aarch64 gyp ninja-build libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev
- yum install libXi-devel.aarch64 libXinerama-devel.aarch64
- yum install cups-devel.aarch64
复制代码 编译安装
- make
- # 前边configure已经指定安装目录/root/BBin/qt5.6.3/
- make install
复制代码 报错解决记载
configure中qmake编译非常
configure过程中编译qmake非常。
- [root@centos-pkg qt5]# ./configure -c++std c++11 -opensource -confirm-license -largefile -dbus-linked -openssl-linked -I /root/BBin/openssl/include -L /root/myb/openssl/lib -no-rpath -make libs -make tools -fontconfig -qt-freetype -debug-and-release -qt-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -dbus -openssl -qt-xcb -nomake tests -nomake examples -no-pch -prefix /root/BBin/qt5.6.3
- + cd qtbase
- + /root/BCompile/qt5/qtbase/configure -top-level -c++std c++11 -opensource -confirm-license -largefile -dbus-linked -openssl-linked -I /root/BBin/openssl/include -L /root/myb/openssl/lib -no-rpath -make libs -make tools -fontconfig -qt-freetype -debug-and-release -qt-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -dbus -openssl -qt-xcb -nomake tests -nomake examples -no-pch -prefix /root/BBin/qt5.6.3
- This is the Qt Open Source Edition.
- You are licensed to use this software under the terms of
- the GNU Lesser General Public License (LGPL) version 2.1.
- You are also licensed to use this software under the terms of
- the GNU Lesser General Public License (LGPL) version 3.
- You have already accepted the terms of the Open Source license.
- WARNING: -debug-and-release is not supported outside of Mac OS X.
- Qt can be built in release mode with separate debug information, so
- -debug-and-release is not necessary anymore
- Running configuration tests (phase 1)...
- Done running configuration tests.
- <srcbase> = /root/BCompile/qt5/qtbase
- <outbase> = /root/BCompile/qt5/qtbase
- Creating qmake...
- .qsettings.o: In function `QList<QVariant>::node_destruct(QList<QVariant>::Node*, QList<QVariant>::Node*)':
- /root/myb/qt5/qtbase/qmake/../include/QtCore/../../src/corelib/tools/qlist.h:484: undefined reference to `operator delete(void*, unsigned long)'
- qsettings.o: In function `QList<QVariant>::node_copy(QList<QVariant>::Node*, QList<QVariant>::Node*, QList<QVariant>::Node*)':
- /root/myb/qt5/qtbase/qmake/../include/QtCore/../../src/corelib/tools/qlist.h:458: undefined reference to `operator delete(void*, unsigned long)'
- /root/myb/qt5/qtbase/qmake/../include/QtCore/../../src/corelib/tools/qlist.h:452: undefined reference to `operator delete(void*, unsigned long)'
- qsettings.o: In function `QList<QVariant>::node_destruct(QList<QVariant>::Node*, QList<QVariant>::Node*)':
- /root/myb/qt5/qtbase/qmake/../include/QtCore/../../src/corelib/tools/qlist.h:484: undefined reference to `operator delete(void*, unsigned long)'
- qsettings.o: In function `QList<QVariant>::node_construct(QList<QVariant>::Node*, QVariant const&)':
- /root/myb/qt5/qtbase/qmake/../include/QtCore/../../src/corelib/tools/qlist.h:425: undefined reference to `operator delete(void*, unsigned long)'
- qsettings.o:/root/myb/qt5/qtbase/qmake/../include/QtCore/../../src/corelib/tools/qlist.h:425: more undefined references to `operator delete(void*, unsigned long)' follow
复制代码 解决方式:
进入qtbase/qmake目录,删除从前缓存的.o文件,rm -rf *.o。之后重新编译。同时将qt源码中所有缓存的.o文件全部删除。
- find ./ -name *.o | xargs -i rm -rf {}
复制代码 configure中出现cannot read xxxxx.pri
缓存导致,qt源码是最新的则不会出现该题目,将qt源码中缓存的Makeifle全部删除。所有的Makefile都是临时生成,现存的都是从前缓存,缓存的在新机器会出题目(路径不对),必须删除重新创建。
- find ./ -name Makefile | xargs -i rm -rf {}
复制代码 make编译dec_neon.c编译报错
如下,在aarch64架构出现,百度说aarch64的gcc不支持,因为该架构默认启用,所以gcc不需要支持。去掉即可。
- gcc -c -pipe -O2 -fvisibility=hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -mfpu=neon -I. -I../../../3rdparty/libwebp -I../../../3rdparty/libwebp/src -I../../../3rdparty/libwebp/src/dec -I../../../3rdparty/libwebp/src/enc -I../../../3rdparty/libwebp/src/dsp -I../../../3rdparty/libwebp/src/mux -I../../../3rdparty/libwebp/src/utils -I../../../3rdparty/libwebp/src/webp -I/root/BCompile/qt5/qtbase/include -I/root/BCompile/qt5/qtbase/include/QtGui -I/root/BCompile/qt5/qtbase/include/QtCore -I.moc -I/root/BBin/openssl/include -I/root/BCompile/qt5/qtbase/mkspecs/linux-g++ ../../../3rdparty/libwebp/src/dsp/dec_neon.c -o .obj/dec_neon.o
- gcc: error: unrecognized command line option ‘-mfpu=neon’
- make[5]: *** [.obj/dec_neon.o] Error 1
- make[5]: Leaving directory `/root/BCompile/qt5/qtimageformats/src/plugins/imageformats/webp'
- make[4]: *** [sub-webp-make_first] Error 2
- make[4]: Leaving directory `/root/BCompile/qt5/qtimageformats/src/plugins/imageformats'
- make[3]: *** [sub-imageformats-make_first] Error 2
- make[3]: Leaving directory `/root/BCompile/qt5/qtimageformats/src/plugins'
- make[2]: *** [sub-plugins-make_first] Error 2
- make[2]: Leaving directory `/root/BCompile/qt5/qtimageformats/src'
- make[1]: *** [sub-src-make_first] Error 2
- make[1]: Leaving directory `/root/BCompile/qt5/qtimageformats'
- make: *** [module-qtimageformats-make_first] Error 2
复制代码 解决方式
修改/root/BCompile/qt5/qtimageformats/src/plugins/imageformats/webp/Makefile 文件,将此中出现的-mfpu=neon全部删除,如下,
- # 原始
- gcc -c $(CFLAGS) -mfpu=neon $(INCPATH) ../../../3rdparty/libwebp/src/dsp/dec_neon.c -o .obj/dec_neon.o
- # 修改后
- gcc -c $(CFLAGS) $(INCPATH) ../../../3rdparty/libwebp/src/dsp/dec_neon.c -o .obj/dec_neon.o
复制代码 make编译中gcc头文件导致报错
编译出现以下错误,这个是qt源码使用的gcc内部头文件和安装的gcc头文件接口类型不同等。
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c: In function ‘UpsampleRgbLinePair’:
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c:140:10: error: incompatible types when initializing type ‘int32x4_t’ using type ‘int32x2_t’
- yl = vmlaq_lane_s32(yl, bl, cf32, 0); \
- ^
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c:166:3: note: in expansion of macro ‘CONVERT8’
- CONVERT8(FMT, XSTEP, len, top_y, uv, top_dst, cur_x) \
- ^
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c:219:5: note: in expansion of macro ‘CONVERT2RGB_8’
- CONVERT2RGB_8(FMT, XSTEP, top_y, bottom_y, r_uv, \
- ^
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c:234:1: note: in expansion of macro ‘NEON_UPSAMPLE_FUNC’
- NEON_UPSAMPLE_FUNC(UpsampleRgbLinePair, Rgb, 3)
- ^
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c:141:10: error: incompatible types when initializing type ‘int32x4_t’ using type ‘int32x2_t’
- yh = vmlaq_lane_s32(yh, bh, cf32, 0); \
- ^
- ../../../3rdparty/libwebp/src/dsp/upsampling_neon.c:166:3: note: in expansion of macro ‘CONVERT8’
复制代码 解决方式
该题目通过升级gcc也可解决,但麻烦。这里通过分析出题目环境和正常环境对比,发现使用的gcc头文件 /usr/lib/gcc/aarch64-redhat-linux/4.8.2/include/arm_neon.h 文件存在声明差异导致。
以下是修改前后对比,如下仅修改9987行
- 9984 #define vmlaq_lane_s32(a, b, c, d) | #define vmlaq_lane_s32(a, b, c, d)
- 9985 __extension__ | __extension__
- 9986 ({ | ({
- 9987 /*int32x4_t myb modify*/int32x2_t c_ = (c); | int32x4_t c_ = (c);
复制代码 调试说明
基于rpath查验外部库和QT插件加载是否正常
可采取以下本领
- ldd查看依赖是否正常。
- 调试UI,开启插件调试开关:”export QT_DEBUG_PLUGINS=1“,手动运行可查看加载的插件信息。
- LD_DEBUG=libs ./your_program 可以调试普通库加载的ld查找路径调试详情。
复制代码 调试注意事项
体系的安全中心拦截。
qt环境编译总结
编译必须使用源码下载,拷贝的QT源码文件大概存在包括如:
(1)代码中含有中间编译结果;
(2)含有中间生成Makefile;
(3)复制过程导致代码格式非常(脚本换行符之类的体系差异非常);
(4)压缩解压过的文件存在执行权限丢失大概等。
编译必须编译所有,
只编译部分大概导致拿去用的时间发现步伐运行OK,但呈现出的效果不符合预期,如界面组件文件缺失,窗口显示怪异等。所以执行configure中的检查缺失项尽大概的补齐依赖的安装,否则这里依赖缺失大概会引起后续make的时间部分组件直接不编译。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |