Shared Object Library and MPI

自古美人都是妖i 提交于 2020-01-06 05:38:26

问题


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

The undefined symbol is in the HDF library. How do I load the symbols from the HDF library?

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 $<

Thanks!


回答1:


You are not actually linking against hdf5. The -l Flag is useless when used together with -c.

Moving -lhdf5 upt to the linking of libsurrogate.so should fix the problem.



来源:https://stackoverflow.com/questions/10128366/shared-object-library-and-mpi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!