我正在尝试编译一个使用等离子体库的Fortran程序。对于未定义的对`__plasma_MOD_plasma_init'的引用,编译失败。在plam.h(我假设plasma.mod是接口)中,plasma_init是用一个参数定义的,而在Fortran程序中是用两个参数调用的。当移除第二个参数时,我得到了错误:在(1)中缺少参数‘info’的实际参数。我还没搞清楚这件事,所以希望这里有人能理解。
我用的是血浆2.8.0和gcc 6.3.0 20170516。
这是制造文件。我尝试包括包含plasma.pc的pkgconfig,因为我认为函数的实现缺失了。
#LIB_ROOT = path to the lib
INCLUDE_PLASMA := $(LIB_ROOT)/plasma_2.8.0/include
LIB_PLASMA := $(LIB_ROOT)/plasma_2.8.0/lib/pkgconfig
example: example.f90
gfortran -o example example.f90 -I$(INCLUDE_PLASMA) -L$(LIB_PLASMA)下面是最小的Fortran代码:
program example
use plasma
implicit none
integer :: a = 1
integer :: info = 1
call plasma_init(a, info)
end program在等离子体.h中,plasma_init被定义为:
int PLASMA_Init(int cores);发布于 2019-07-24 08:49:12
通过正确链接到所需的库,我解决了问题,下面是新的makefile:
PLASMA_BUILD = [some directories]/plasma-installer_2.8.0/build
LIB_PLASMA := $(PLASMA_BUILD)/plasma_2.8.0/lib # contains libplasma.a, libcoreblas.a and libcoreblasqw.a
LIB_QUARK := $(PLASMA_BUILD)/plasma_2.8.0/quark # contains libquark.a
LIB_LAPACK := $(PLASMA_BUILD)/lapack-3.6.0 # contains liblapack.a and liblapacke.a
PLASMA_INTERFACE = $(PLASMA_BUILD)/plasma_2.8.0/control # contains plasma.mod
example: example.f90
gfortran -o example example.f90 -lpthread \
-L$(LIB_PLASMA) -lplasma -lcoreblas -lcoreblasqw \
-L$(LIB_QUARK) -lquark \
-L$(LIB_LAPACK) -llapacke -llapack \
-I$(PLASMA_INTERFACE)https://stackoverflow.com/questions/57165805
复制相似问题