環(huán)境準備
pip
安裝 docutils
時報錯
(.venv) ?? /root/downloads/openssl ? git:(master) pip install docutils
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/docutils/
需要安裝 OpenSSL
之后重新編譯 Python
, 以安裝 Python 3.10
為例杨帽,它對 OpenSSL
版本有要求鸿捧,默認版本太低, 需要重新編譯 OpenSSL
铺然。其編譯時依賴 perl
modules。
Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer
(.venv) ? /root/downloads/openssl ? git:(master) yum install perl-core
(.venv) ? /root/downloads/openssl ? git:(master) ./Configure
(.venv) ? /root/downloads/openssl ? git:(master) make -j 8
(.venv) ? /root/downloads/openssl ? git:(master) make install
OpenSSL
相關(guān)的文件和動態(tài)鏈接庫默認存放在 /usr/local/bin
/usr/local/lib64/
/usr/local/share/doc/openssl
/usr/local/ssl
/usr/local/include/openssl
等目錄且轨。
(.venv) ?? /root/downloads/openssl ? git:(master)ln -s /usr/local/lib64/libssl.so.3 /usr/lib64/libssl.so.3
(.venv) ?? /root/downloads/openssl ? git:(master)ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3
重新編譯安裝 Python 3.10
./configure --with-openssl=/usr/local --with-openssl-rpath=auto --enable-optimizations
make
make install
如果出現(xiàn)如下編譯錯誤:
/root/downloads/Python-3.10.0/Modules/_ctypes/_ctypes.c:107:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
安裝 libffi
libffi-devel
(.venv) ?? /root/downloads/Python-3.10.0 ? sudo yum -y install libffi libffi-devel
在 Python 安裝包下執(zhí)行 make
時還是會報 Could not build the ssl module!
浮声,查看 configure
文件和 setup.py
發(fā)現(xiàn)端倪,原來 configure
文件里在設(shè)置 OPENSSL_LDFLAGS
參數(shù)時默認是在你指定的目錄下的 lib
文件中 查找旋奢,即 OPENSSL_LDFLAGS="-L$ssldir/lib"
泳挥,而手動編譯的 OpenSSL
動態(tài)鏈接庫安裝在 /usr/local/lib64
下面,因此需要修改 configure
文件至朗。然后重新編譯即可屉符。
OPENSSL_LDFLAGS="-L$ssldir/lib64"
編譯 rdma-core
上面的環(huán)境準備就是為了修復(fù)如下錯誤
(.venv) ?? /root/go/src/github.com/linux-rdma/rdma-core ? git:(master) ./build.sh
-- Could NOT find pandoc (missing: PANDOC_EXECUTABLE PANDOC_VERSION_STRING)
-- Could NOT find rst2man (missing: RST2MAN_VERSION_STRING)
-- Missing Optional Items:
-- Compiler attribute symver NOT supported, can not use LTO
-- Valgrind memcheck.h NOT enabled
-- Valgrind drd.h NOT enabled
-- pandoc NOT found and NO prebuilt man pages. 'install' disabled
-- rst2man NOT found and NO prebuilt man pages. 'install' disabled
-- cython NOT found (disabling pyverbs)
-- Configuring done
-- Generating done
-- Build files have been written to: /root/go/src/github.com/linux-rdma/rdma-core/build
[ 1%] Creating man page vendstat.8
Traceback (most recent call last):
File "/bin/rst2man", line 21, in <module>
from docutils.core import publish_cmdline, default_description
ModuleNotFoundError: No module named 'docutils'
make[2]: *** [infiniband-diags/man/vendstat.8] Error 100
make[1]: *** [infiniband-diags/man/CMakeFiles/man-vendstat.8.dir/all] Error 2
make: *** [all] Error 2
編譯
?? /root/go/src/github.com/linux-rdma/rdma-core ? git:(master) ./build.sh
?? /root/go/src/github.com/linux-rdma/rdma-core ? git:(master) yum install dnf
? /root/go/src/github.com/linux-rdma/rdma-core ? git:(master) dnf install 'dnf-command(builddep)'
?? /root/go/src/github.com/linux-rdma/rdma-core ? git:(master) dnf builddep redhat/rdma-core.spec
?? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) make install
如果 make install
報錯
CMake Error at libibumad/man/cmake_install.cmake:100 (FILE):
file INSTALL cannot find
"/root/go/src/github.com/linux-rdma/rdma-core/buildlib/pandoc-prebuilt/41bbb0bed7a781be59e8c0dcd8b7278af2ce6882".
Call Stack (most recent call first):
cmake_install.cmake:43 (INCLUDE)
? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) yum install epel-release
?? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) yum install cmake3 ninja-build pandoc
發(fā)現(xiàn) make install
還是報錯。換成 ninja
編譯后成功。
export EXTRA_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DENABLE_WERROR=1"
mkdir -p build && cd build
cmake -G Ninja CFLAGS="-O0 -g" -DCMAKE_INSTALL_PREFIX=/usr ..
ninja
ninja install
Ninja 延伸
Ninja
相對于 Makefile
這套工具更注重于編譯速度筑煮。
- 可以生成編譯依賴關(guān)系圖辛蚊,可以使用
dot
來生成圖片粤蝎。
?? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) ninja -t graph all
ninja
依賴于build.ninja
文件真仲,根據(jù)CmakeLists.txt
運行cmake -G Ninja
來生成這個配置文件。通過執(zhí)行
ninja -t list
可以查看ninja
中集成了哪些工具初澎。
?? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) ninja -t list