最近在编译linux客户端的时候,出现了瓶颈,不同的CPU + 操作系统 + 内核版本等,造成了客户端维护越来越繁琐,为了提高维护效率,降低维护成本,因此决定采用静态编译。因为是年前的了,所以好多编译时遇到的报错没有截图(所以仅简单做参考记录)
好啦,有了问题,解决就是了,最开始考虑的是交叉编译,openssl和curl静态编译通过后,在qt编译上一直提示qmake不对,无耐之下,只好采用下下策,在对应cpu架构的机器上编译,我是在三种cpu上编译的(龙芯3A2000-mips64el、鲲鹏920-aarch64、因特尔-x86_64),操作系统呢,找的中标麒麟的,因为发现属他的glibc版本低~
./configure --prefix=/home/myself/dbus-1 --enable-static --disable-tests make make install
./configure -static -release -opensource -confirm-license -prefix /home/myself/qt-5.9.9 -dbus-linked -I/home/myself/dbus-1/include/dbus-1.0 -I/home/myself/dbus-1/lib/dbus-1.0/include -L/home/myself/dbus-1/lib -no-openssl -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-harfbuzz -sql-sqlite -fontconfig -system-freetype -qt-xcb -skip qtwebengine -nomake tools -nomake examples -nomake tests gmake -j8 gmake install
./configure -static -release -opensource -confirm-license -prefix /home/myself/qt-5.12.9 -dbus-linked -I/home/myself/dbus-1/include/dbus-1.0 -I/home/myself/dbus-1/lib/dbus-1.0/include -L/home/myself/dbus-1/lib -no-webp -no-openssl -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-harfbuzz -sql-sqlite -fontconfig -system-freetype -qt-xcb -skip qtwebengine -nomake tools -nomake examples -nomake tests gmake -j8 gmake install
./config --prefix=/home/myself/openssl-1.1.1l -fPIC no-shared make make install
./configure CFLAGS=-fPIC --disable-ldap --disable-ldaps --disable-shared --disable-threaded-resolver --disable-rt --with-ssl=/home/myself/openssl-1.1.1l/ --prefix=/home/myself/curl-7.70.0 make make install
其实还涉及到挂载内核驱动,这个只能预编译,在安装的时候根据(cpu架构+操作系统+内核版本),在安装路径中动态查找并挂载了。