首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Cygwin上使用MPI编译器链接错误的ơr?

在Cygwin上使用MPI编译器链接错误的ơr?
EN

Stack Overflow用户
提问于 2019-09-28 22:17:01
回答 1查看 289关注 0票数 1

我试着用Cygwin构建一个MPI程序。下面有个错误。我是Cygwin的新用户,我正在努力学习它。抱歉,如果我不明白的话。

我试图使用Xbraid包,并遵循用户手册的说明,但我得到了这个错误。

有人能帮忙吗?

代码语言:javascript
复制
Building ex-01-pp ...
mpiCC -g -Wall -I../braid ex-01-pp.cpp -o ex-01-pp ../braid/libbraid.a -lm
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.data+0x0): undefined reference to `__gxx_personality_seh0'
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.xdata+0xc): undefined reference to `__gxx_personality_seh0'
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.xdata+0xc): relocation truncated to fit: rva32 against undefined symbol `__gxx_personality_seh0'
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.xdata+0x2c): undefined reference to `__gxx_personality_seh0'
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.xdata+0x2c): relocation truncated to fit: rva32 against undefined symbol `__gxx_personality_seh0'
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.xdata+0x84): undefined reference to `__gxx_personality_seh0'
...
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.rdata$_ZTI11BraidVector[_ZTI11BraidVector]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccgmW1LF.o:ex-01-pp.cpp:(.rdata$_ZTI8BraidApp[_ZTI8BraidApp]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/libcygwin.a(_cygwin_crt0_common.o):/usr/src/debug/cygwin-3.0.7-1/winsup/cygwin/lib/_cygwin_crt0_common.cc:78: undefined reference to `operator new(unsigned long)'
collect2: σφάλμα: η ld επέστρεψε κατάσταση εξόδου 1
make[1]: *** [Makefile:94: ex-01-pp] Error 1
make[1]: Leaving directory '/cygdrive/c/users/spyros/Desktop/xbraid-master/examples'
make: *** [Makefile:37: examples] Error 2

make文件是:

代码语言:javascript
复制
BRAID_DIR=../braid
include ../makefile.inc


##################################################################
# Build exmaples 
##################################################################

HYPRE_DIR = ../../hypre/src/hypre
HYPRE_FLAGS = -I$(HYPRE_DIR)/include
HYPRE_LIB = -L$(HYPRE_DIR)/lib -lHYPRE
HYPRE_LIB_FILE = $(HYPRE_DIR)/lib/libHYPRE.a

MFEM_DIR = ../../mfem
MFEM_CONFIG_MK = $(MFEM_DIR)/config/config.mk
MFEM_LIB_FILE = mfem_is_not_built
-include $(MFEM_CONFIG_MK)

BRAID_FLAGS = -I$(BRAID_DIR)
BRAID_LIB_FILE = $(BRAID_DIR)/libbraid.a

C_NOHYPRE = ex-01 ex-01-adjoint ex-01-optimization ex-01-refinement ex-01-expanded ex-01-expanded-bdf2 ex-02 ex-04 ex-04-serial
CPP_NOHYPRE = ex-01-pp 
F_NOHYPRE = ex-01-expanded-f
C_EXAMPLES = ex-03 ex-03-serial
# Note: .cpp examples will be linked with mfem
#CXX_EXAMPLES = ex-04

.PHONY: all clean cleanout

.SUFFIXES:
.SUFFIXES: .c .cpp

# put this rule first so it becomes the default
all: $(C_NOHYPRE) $(CPP_NOHYPRE) $(C_EXAMPLES) $(CXX_EXAMPLES)

# Rule for building ex-01
ex-01: ex-01.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-01-adjoint
ex-01-adjoint: ex-01-adjoint.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-01-optimization
ex-01-optimization: ex-01-optimization.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)


# Rule for building ex-01-refinement
ex-01-refinement: ex-01-refinement.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-01-expanded
ex-01-expanded: ex-01-expanded.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-01-pp
ex-01-pp: ex-01-pp.cpp $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICXX) $(CXXFLAGS) $(BRAID_FLAGS) $(@).cpp -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-01-expanded-f
ex-01-expanded-f: ex-01-expanded-f.f90 $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPIF90) $(FORTFLAGS) -Wno-unused-dummy-argument -Wno-uninitialized $(@).f90 -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-01-expanded-bdf2
ex-01-expanded-bdf2: ex-01-expanded-bdf2.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-02
ex-02: ex-02.c $(BRAID_LIB_FILE) ex-02-lib.c
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-02-serial
ex-02-serial: ex-02-serial.c $(BRAID_LIB_FILE) ex-02-lib.c
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-03
ex-03: ex-03.c $(BRAID_LIB_FILE) $(HYPRE_LIB_FILE) ex-03-lib.c
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(HYPRE_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(HYPRE_LIB) $(LFLAGS)


# Rule for building ex-03-serial
ex-03-serial: ex-03-serial.c $(BRAID_LIB_FILE) $(HYPRE_LIB_FILE) ex-03-lib.c
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(HYPRE_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(HYPRE_LIB) $(LFLAGS)

# Rule for building ex-04
ex-04: ex-04.c $(BRAID_LIB_FILE) ex-04-lib.c
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for building ex-04-serial
ex-04-serial: ex-04-serial.c $(BRAID_LIB_FILE) ex-04-lib.c
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(@).c -o $@ $(BRAID_LIB_FILE) $(LFLAGS)

# Rule for compiling .c files
%: %.c $(BRAID_LIB_FILE)
    @echo "Building" $@ "..."
    $(MPICC) $(CFLAGS) $(BRAID_FLAGS) $(HYPRE_FLAGS) $(@).c -o $@\
 $(BRAID_LIB_FILE) $(HYPRE_LIB) $(LFLAGS)

# Rule for compiling .cpp files; links with mfem
%: %.cpp $(BRAID_LIB_FILE) $(MFEM_LIB_FILE) $(MFEM_CONFIG_MK)
    @echo "Building" $@ "..."
    $(MPICXX) $(CXXFLAGS) $(BRAID_FLAGS) $(MFEM_FLAGS) \
    $< -o $@ $(MFEM_LIBS) $(BRAID_LIB_FILE) $(LFLAGS)

# Generate an error message if the MFEM library is not built and exit
$(MFEM_LIB_FILE):
    $(error The MFEM library is not built)

# Generate an error message if the Hypre library is not built and exit
$(HYPRE_LIB_FILE):
    $(error The Hypre library is not built, unable to build ex-03)

clean: cleanout
    rm -f *.o $(C_NOHYPRE) $(CPP_NOHYPRE) $(F_NOHYPRE) $(C_EXAMPLES) $(CXX_EXAMPLES) $(F_EXAMPLES) *ror_norm* *_err_* *_mesh* *_sol_*
    rm -rf *.dSYM

cleanout:
    rm -f ex*.out.*
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-28 22:26:51

看起来,您正在尝试使用C编译器来编译C++程序(或使用C++库的程序)。如果不付出很大的努力,这是行不通的,因为C编译器不知道在哪里可以找到C++标准库和其他库,比如异常处理。

您还没有发布Makefile,但是如果您使用变量CC编译和链接代码,请尝试切换到使用CXX,后者是C++编译器。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58150719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档