編譯 rdma-core

環(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 這套工具更注重于編譯速度筑煮。

  1. 可以生成編譯依賴關(guān)系圖辛蚊,可以使用 dot 來生成圖片粤蝎。
?? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) ninja -t graph all
  1. ninja 依賴于 build.ninja 文件真仲,根據(jù) CmakeLists.txt 運行cmake -G Ninja 來生成這個配置文件。

  2. 通過執(zhí)行 ninja -t list 可以查看 ninja 中集成了哪些工具初澎。

?? /root/go/src/github.com/linux-rdma/rdma-core/build ? git:(master) ninja -t list

參考鏈接

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末秸应,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子碑宴,更是在濱河造成了極大的恐慌软啼,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,470評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件延柠,死亡現(xiàn)場離奇詭異祸挪,居然都是意外死亡,警方通過查閱死者的電腦和手機贞间,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,393評論 3 392
  • 文/潘曉璐 我一進店門贿条,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人增热,你說我怎么就攤上這事整以。” “怎么了峻仇?”我有些...
    開封第一講書人閱讀 162,577評論 0 353
  • 文/不壞的土叔 我叫張陵公黑,是天一觀的道長。 經(jīng)常有香客問我摄咆,道長凡蚜,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,176評論 1 292
  • 正文 為了忘掉前任吭从,我火速辦了婚禮朝蜘,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘影锈。我一直安慰自己芹务,他們只是感情好,可當我...
    茶點故事閱讀 67,189評論 6 388
  • 文/花漫 我一把揭開白布鸭廷。 她就那樣靜靜地躺著枣抱,像睡著了一般。 火紅的嫁衣襯著肌膚如雪辆床。 梳的紋絲不亂的頭發(fā)上佳晶,一...
    開封第一講書人閱讀 51,155評論 1 299
  • 那天,我揣著相機與錄音讼载,去河邊找鬼轿秧。 笑死中跌,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的菇篡。 我是一名探鬼主播漩符,決...
    沈念sama閱讀 40,041評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼驱还!你這毒婦竟也來了嗜暴?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 38,903評論 0 274
  • 序言:老撾萬榮一對情侶失蹤议蟆,失蹤者是張志新(化名)和其女友劉穎闷沥,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,319評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,539評論 2 332
  • 正文 我和宋清朗相戀三年墅茉,在試婚紗的時候發(fā)現(xiàn)自己被綠了拜隧。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,703評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情览祖,我是刑警寧澤,帶...
    沈念sama閱讀 35,417評論 5 343
  • 正文 年R本政府宣布炊琉,位于F島的核電站展蒂,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏苔咪。R本人自食惡果不足惜锰悼,卻給世界環(huán)境...
    茶點故事閱讀 41,013評論 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望团赏。 院中可真熱鬧箕般,春花似錦、人聲如沸舔清。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,664評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽体谒。三九已至杯聚,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間抒痒,已是汗流浹背幌绍。 一陣腳步聲響...
    開封第一講書人閱讀 32,818評論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人傀广。 一個月前我還...
    沈念sama閱讀 47,711評論 2 368
  • 正文 我出身青樓颁独,卻偏偏與公主長得像,于是被迫代替她去往敵國和親伪冰。 傳聞我的和親對象是個殘疾皇子誓酒,可洞房花燭夜當晚...
    茶點故事閱讀 44,601評論 2 353

推薦閱讀更多精彩內(nèi)容