免责声明:我是构建/make/packages/cmake 的菜鸟。
我的目标:xtensor-blas
在 C++ 中使用库
我的环境: Win10 x64,CLion2021
我的问题:无法编译最简单的示例。关于项目依赖关系的某事。
我试过:
1)使用我可以谷歌搜索的每个教程手动下载和编译openBLAST - 总是停在不同的问题上。要么我没有“nmake”,要么由于某种原因构建失败,或者我得到“未定义的引用”等 - 我已经不知所措了几天。一步一步的演练将不胜感激。
2)我得到的最接近的是使用 anaconda conda install -c conda-forge openblas
,然后将“包含”目录从xtl
,复制粘贴到我的项目中xtensor
。xtensor-blas
cmake_minimum_required(VERSION 3.19)
project(tstxtensor3)
set(CMAKE_CXX_STANDARD 20)
add_executable(tstxtensor3 main.cpp)
include_directories(.)
add_definitions(-DHAVE_CBLAS=1)
set(OpenBLAS_DIR c:/Users/pruglo/anaconda3/envs/evn/Library/share/cmake/OpenBLAS/)
find_package(OpenBLAS REQUIRED)
if (OpenBLAS_FOUND)
include_directories(${OpenBLAS_INCLUDE_DIRS})
target_link_libraries(tstxtensor3 c:/Users/pruglo/anaconda3/envs/evn/Library/lib/openblas.lib ${OpenBLAS_LIBRARY})
else ()
message("OpenBLAS NOT FOUND!")
endif ()
Cmake 加载成功,并且OpenBLAS_FOUND
是true
. 但是当我编译我的 cpp 时,我得到error while loading shared libraries: openblas.dll: cannot open shared object file: No such file or directory Process finished with exit code 127
Note: OpenBLAS_INCLUDE_DIRS
expands to c:/Users/pruglo/anaconda3/envs/evn/Library/include/openblas
and OpenBLAS_LIBRARY
expands toc:/Users/pruglo/anaconda3/envs/evn/Library/bin/openblas.dll
额外问题:
- 我需要 LAPACK 或其他东西
xtensor-blas
吗? - 我可以便携式构建我的项目,这样我就不需要为我开发的每台电脑安装所有东西吗?