共享对象库和MPI [英] Shared Object Library and MPI
问题描述
我正在一个使用MPI创建并行进程的项目中,每个进程都使用dlopen()加载作为共享对象库构建的模块.我正在编写的模块之一使用第三方库(HDF).当我运行程序时,dlopen会引发错误: dlopen失败:/home/jwomble/QTProjects/SurrogateModule/libsurrogate.so:未定义符号:H5T_NATIVE_INT32_g
I am working on a project that uses MPI to create parallel processes, each process uses dlopen() to load a module that's been build as a shared object library. One of the modules that I'm writing uses a 3rd party library (HDF). When I run the program, dlopen throws an error: dlopen failed: /home/jwomble/QTProjects/SurrogateModule/libsurrogate.so: undefined symbol: H5T_NATIVE_INT32_g
未定义的符号在HDF库中.如何从HDF库加载符号?
The undefined symbol is in the HDF library. How do I load the symbols from the HDF library?
当前,我的make文件如下所示:
Currently, my make file looks like this:
CC = mpicc
INCDIR = -I /home/jwomble/QTProjects/STARExecutive/src/star_comm \
-I /home/jwomble/QTProjects/STARExecutive/src/executive \
-I /home/jwomble/QTProjects/Star \
-I ./phdf/include
CFLAGS = -Wall -rdynamic -g -fPIC $(INCDIR)
all: libsurrogate.so
libsurrogate.so: SurrogateModule.o
$(CC) -shared --export-dynamic -o $@ $<
SurrogateModule.o: SurrogateModule.c
$(CC) $(CFLAGS) -lhdf5 -c $<
谢谢!
推荐答案
您实际上并没有针对hdf5进行链接.与-c
一起使用时,-l
标志无效.
You are not actually linking against hdf5. The -l
Flag is useless when used together with -c
.
将-lhdf5
移至libsurrogate.so的链接应该可以解决此问题.
Moving -lhdf5
upt to the linking of libsurrogate.so should fix the problem.
这篇关于共享对象库和MPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!