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

问题描述 投票:1回答:1

我试图使用Cygwin来构建MPI程序。我有下面的错误。我是Cygwin的新用户,我正在努力学习它。对不起,如果我听不懂。

我正在尝试使用Xbraid软件包并遵循用户手册的说明,但出现此错误。

有人可以帮忙吗?

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文件是:

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.*
linux cygwin linker-errors mpich
1个回答
1
投票

似乎您正在尝试使用C编译器来编译C ++程序(或使用C ++库的程序)。如果不花很多精力,那是行不通的,因为C编译器不知道在哪里可以找到C ++标准库和其他库来处理诸如异常处理之类的事情。

您尚未发布Makefile,但是如果您使用变量CC来编译和链接代码,请尝试切换为使用CXX,它是C ++编译器。

© www.soinside.com 2019 - 2024. All rights reserved.