igraph C 语言 在 Windows 上的安装 (MINGW64)
NOTES: When using MSYS2, start the “MSYS2 MinGW 64-bit” terminal, and not the “MSYS2 MSYS” one.
参考:
https://igraph.org/c/doc/igraph-Installation.html#igraph-Installation-msys2
使用下面的命令更新软件包:
$ pacman --disable-download-timeout -Syuu $PACKAGES
$PACKAGES 取下面的包名.
必须要求:
mingw-w64-x86_64-toolchain
必须安装 mingw64 的 cmake (不能使用windows上的【如果有】)
mingw-w64-x86_64-cmake
把功能配置拉满,强烈建议:
mingw-w64-x86_64-gmp mingw-w64-x86_64-libxml2
追求极致性能,强烈建议:
mingw-w64-x86_64-openblas mingw-w64-x86_64-arpack mingw-w64-x86_64-glpk
仅开发版使用:
diffutils git bison flex
以上安装完毕,检查:
$ cmake --versioncmake version 3.31.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).$ which cmake/mingw64/bin/cmake
编译 igraph 动态库
下载后解压:
https://github.com/igraph/igraph/releases/download/0.10.15/igraph-0.10.15.tar.gz
$ cd igraph-0.10.15/
$ mkdir build
$ cd build
# cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
实际使用下面的设置(-G “MSYS Makefiles” 指示生成 Makefile):
$ cmake .. -G "MSYS Makefiles" \-DCMAKE_INSTALL_PREFIX=/usr/local/igraph \-DCMAKE_BUILD_TYPE=Release \-DIGRAPH_USE_INTERNAL_BLAS=OFF \-DIGRAPH_USE_INTERNAL_LAPACK=OFF \-DIGRAPH_USE_INTERNAL_ARPACK=OFF \-DIGRAPH_USE_INTERNAL_GLPK=OFF \-DIGRAPH_USE_INTERNAL_GMP=OFF \-DIGRAPH_USE_INTERNAL_PLFIT=ON \-DBLA_VENDOR=OpenBLAS \-DIGRAPH_GRAPHML_SUPPORT=ON \-DIGRAPH_ENABLE_LTO=ON \-DBUILD_SHARED_LIBS=ON
-- Version number: 0.10.15
-- Found BLAS: C:/DEVPACK/msys64/mingw64/lib/libopenblas.dll.a
-- Found GLPK: C:/DEVPACK/msys64/mingw64/lib/libglpk.dll.a (found suitable version "5.0", minimum required is "4.57")
-- Looking for cheev_
-- Looking for cheev_ - found
-- Found LAPACK: C:/DEVPACK/msys64/mingw64/lib/libopenblas.dll.a;C:/DEVPACK/msys64/mingw64/lib/libopenblas.dll.a
-- Found ARPACK: C:/DEVPACK/msys64/mingw64/lib/libarpack.dll.a
-- Found GMP: C:/DEVPACK/msys64/mingw64/lib/libgmp.dll.a
-- Found LibXml2: C:/DEVPACK/msys64/mingw64/lib/libxml2.dll.a (found version "2.12.9")
--
-- -----[ Build configuration ]----
-- Version: 0.10.15
-- CMake build type: Release
-- Library type: shared
-- igraph_integer_t size: 64 bits
--
-- ----------[ Features ]----------
-- GLPK for optimization: yes
-- Reading GraphML files: yes
-- Thread-local storage: yes
-- Link-time optimization: yes
--
-- --------[ Dependencies ]--------
-- ARPACK: yes
-- BISON: yes
-- BLAS: yes
-- FLEX: yes
-- GLPK: yes
-- GMP: yes
-- LAPACK: yes
-- LibXml2: yes
-- OpenMP: yes
-- PLFIT: vendored
--
-- -----------[ Testing ]----------
-- Diff tool: diff
-- Sanitizers: none
-- Code coverage: no
-- Verify 'finally' stack: no
--
-- --------[ Documentation ]-------
-- HTML: no
-- PDF: no
-- INFO: no
--
-- igraph configured successfully.
--
-- Configuring done (12.4s)
-- Generating done (16.3s)
-- Build files have been written to: C:/WORKSPACE/VULKAN_DEV/mapaware.top/deps-win32/igraph-0.10.15/build
最后开始编译正式优化完全功能版的动态库并安装到指定位置(-DCMAKE_INSTALL_PREFIX=/usr/local/igraph):
$ make
$ make install