Error building Calculix with preCICE

Hello all,

I’ve been trying to build CalculiX with the preCICE adapter but I get this error at the end. My guess is maybe something is wrong in the Make file but I don’t know enough to be able to find the issue. If someone would be able to help me, that would be really appreciated.

Thanks,

Makefile:107: pipe: Too many open files
mpifort -fopenmp -Wall -O3 -o bin/ccx_preCICE bin/ccx_2.20.o bin/ccx_2.20.a -lspooles  -lstdc++ -lyaml-cpp -larpack -llapack -lblas -lpthread -lm -lc
/usr/bin/ld: bin/ccx_2.20.a(dyna_precice.o): in function `dyna_precice':
dyna_precice.c:(.text+0x68e0): undefined reference to `precicec_isTimeWindowComplete'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `PreciceInterface_ConfigureTetraFaces.part.0':
PreciceInterface.c:(.text+0xb5): undefined reference to `precicec_setMeshTriangleWithEdges'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_Advance':
PreciceInterface.c:(.text+0x299): undefined reference to `precicec_advance'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_IsCouplingOngoing':
PreciceInterface.c:(.text+0x2bb): undefined reference to `precicec_isCouplingOngoing'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_IsReadCheckpointRequired':
PreciceInterface.c:(.text+0x2e0): undefined reference to `precicec_isActionRequired'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_IsWriteCheckpointRequired':
PreciceInterface.c:(.text+0x300): undefined reference to `precicec_isActionRequired'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_ReadCouplingData':
PreciceInterface.c:(.text+0x630): undefined reference to `precicec_isReadDataAvailable'
/usr/bin/ld: PreciceInterface.c:(.text+0x758): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0x7b0): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0x868): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0x920): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0x975): undefined reference to `precicec_readBlockVectorData'
/usr/bin/ld: PreciceInterface.c:(.text+0x9bd): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0xa05): undefined reference to `precicec_readBlockVectorData'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_WriteCouplingData':
PreciceInterface.c:(.text+0xad5): undefined reference to `precicec_isWriteDataRequired'
/usr/bin/ld: PreciceInterface.c:(.text+0xbdb): undefined reference to `precicec_writeBlockVectorData'
/usr/bin/ld: PreciceInterface.c:(.text+0xc42): undefined reference to `precicec_isActionRequired'
/usr/bin/ld: PreciceInterface.c:(.text+0xc8c): undefined reference to `precicec_writeBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0xcfc): undefined reference to `precicec_writeBlockVectorData'
/usr/bin/ld: PreciceInterface.c:(.text+0xe34): undefined reference to `precicec_writeBlockVectorData'
/usr/bin/ld: PreciceInterface.c:(.text+0xed1): undefined reference to `precicec_writeBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0xf64): undefined reference to `precicec_writeBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0x1069): undefined reference to `precicec_writeBlockScalarData'
/usr/bin/ld: PreciceInterface.c:(.text+0x10ad): undefined reference to `precicec_writeBlockVectorData'
/usr/bin/ld: PreciceInterface.c:(.text+0x10fc): undefined reference to `precicec_writeBlockVectorData'
/usr/bin/ld: PreciceInterface.c:(.text+0x1109): undefined reference to `precicec_isActionRequired'
/usr/bin/ld: PreciceInterface.c:(.text+0x1120): undefined reference to `precicec_markActionFulfilled'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_InitializeData':
PreciceInterface.c:(.text+0x115b): undefined reference to `precicec_initialize_data'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `sendFaceCentersVertices':
PreciceInterface.c:(.text+0x1249): undefined reference to `precicec_setMeshVertices'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `PreciceInterface_ConfigureFaceCentersMesh':
PreciceInterface.c:(.text+0x1424): undefined reference to `precicec_getMeshID'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `PreciceInterface_ConfigureNodesMesh':
PreciceInterface.c:(.text+0x1630): undefined reference to `precicec_getMeshID'
/usr/bin/ld: PreciceInterface.c:(.text+0x1692): undefined reference to `precicec_setMeshVertices'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `PreciceInterface_ConfigureCouplingData':
PreciceInterface.c:(.text+0x18e3): undefined reference to `precicec_getDataID'
/usr/bin/ld: PreciceInterface.c:(.text+0x1a31): undefined reference to `precicec_getDataID'
/usr/bin/ld: PreciceInterface.c:(.text+0x1ac9): undefined reference to `precicec_getDataID'
/usr/bin/ld: PreciceInterface.c:(.text+0x1b20): undefined reference to `precicec_getDataID'
/usr/bin/ld: PreciceInterface.c:(.text+0x1b86): undefined reference to `precicec_getDataID'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o):PreciceInterface.c:(.text+0x1c16): more undefined references to `precicec_getDataID' follow
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `PreciceInterface_Create':
PreciceInterface.c:(.text+0x2125): undefined reference to `precicec_getDimensions'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_Setup':
PreciceInterface.c:(.text+0x2327): undefined reference to `precicec_createSolverInterface'
/usr/bin/ld: PreciceInterface.c:(.text+0x2441): undefined reference to `precicec_getDimensions'
/usr/bin/ld: PreciceInterface.c:(.text+0x254c): undefined reference to `precicec_initialize'
/usr/bin/ld: PreciceInterface.c:(.text+0x257b): undefined reference to `precicec_initialize_data'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_FulfilledReadCheckpoint':
PreciceInterface.c:(.text+0x31c): undefined reference to `precicec_markActionFulfilled'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_FulfilledWriteCheckpoint':
PreciceInterface.c:(.text+0x32c): undefined reference to `precicec_markActionFulfilled'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `sendFaceCentersVertices':
PreciceInterface.c:(.text+0x11a0): undefined reference to `precicec_setMeshVertices'
/usr/bin/ld: bin/ccx_2.20.a(PreciceInterface.o): in function `Precice_FreeData':
PreciceInterface.c:(.text+0x2853): undefined reference to `precicec_finalize'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `createMapping':
2D3DCoupling.cpp:(.text+0x459): undefined reference to `precicec_setMeshVertices'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `consistentScalarRead':
2D3DCoupling.cpp:(.text+0x628): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `consistentVectorRead':
2D3DCoupling.cpp:(.text+0x6bc): undefined reference to `precicec_readBlockVectorData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `conservativeScalarRead':
2D3DCoupling.cpp:(.text+0x7b4): undefined reference to `precicec_readBlockScalarData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `conservativeVectorRead':
2D3DCoupling.cpp:(.text+0x881): undefined reference to `precicec_readBlockVectorData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `consistentScalarWrite':
2D3DCoupling.cpp:(.text+0xaf9): undefined reference to `precicec_writeBlockScalarData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `consistentVectorWrite':
2D3DCoupling.cpp:(.text+0xd46): undefined reference to `precicec_writeBlockVectorData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `conservativeScalarWrite':
2D3DCoupling.cpp:(.text+0xe2a): undefined reference to `precicec_writeBlockScalarData'
/usr/bin/ld: bin/ccx_2.20.a(2D3DCoupling.o): in function `consservativeVectorWrite(Mapping2D3D*, int)':
2D3DCoupling.cpp:(.text+0xfa3): undefined reference to `precicec_writeBlockVectorData'
collect2: error: ld returned 1 exit status
make: *** [Makefile:107: bin/ccx_preCICE] Error 1

and my Make file

# See the adapter documentation for getting the adapter dependencies:
# https://precice.org/adapter-calculix-get-calculix.html
# Set the following variables before building:
# Path to original CalculiX source (e.g. $(HOME)/ccx_2.xx/src )
CCX_VERSION			= 2.20
CCX             = $(HOME)/CalculiX/ccx_$(CCX_VERSION)/src

### Change these if you built SPOOLES, ARPACK, or yaml-cpp from source ###
# SPOOLES include flags (e.g. -I$(HOME)/SPOOLES.2.2 )
SPOOLES_INCLUDE   = -I/usr/include/spooles/
# SPOOLES library flags (e.g. $(HOME)/SPOOLES.2.2/spooles.a)
SPOOLES_LIBS      = -lspooles
#
# ARPACK include flags (e.g. -I$(HOME)/ARPACK)
ARPACK_INCLUDE    =
# ARPACK library flags (e.g. $(HOME)/ARPACK/libarpack_INTEL.a)
ARPACK_LIBS       = -larpack -llapack -lblas
#
# yaml-cpp include flags (e.g. -I$(HOME)/yaml-cpp/include)
YAML_INCLUDE      = -I/usr/include/
# yaml-cpp library flags (e.g. -L$(HOME)/yaml-cpp/build -lyaml-cpp)
YAML_LIBS         = -lyaml-cpp

# Get the CFLAGS and LIBS from pkg-config (preCICE version >= 1.4.0).
# If pkg-config cannot find the libprecice.pc meta-file, you may need to set the
# path where this is stored into PKG_CONFIG_PATH when building the adapter.
PKGCONF_CFLAGS  = $(shell pkg-config --cflags libprecice)
PKGCONF_LIBS    = $(shell pkg-config --libs libprecice)

# Specify where to store the generated .o files
OBJDIR = bin

# Includes and libs
INCLUDES = \
	-I./ \
	-I./adapter \
	-I$(CCX) \
	$(SPOOLES_INCLUDE) \
	$(PKGCONF_CFLAGS) \
	$(ARPACK_INCLUDE) \
	$(YAML_INCLUDE)

LIBS = \
	$(SPOOLES_LIBS) \
	$(PKGCONF_LIBS) \
	-lstdc++ \
	$(YAML_LIBS) \
	$(ARPACK_LIBS) \
	-lpthread -lm -lc

# Compilers and flags
#CFLAGS = -g -Wall -std=c++11 -O0 -fopenmp $(INCLUDES) -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE
#FFLAGS = -g -Wall -O0 -fopenmp $(INCLUDES)

CFLAGS = -Wall -O3 -fopenmp $(INCLUDES) -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE -DUSE_MT

# OS-specific options
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
	CC = /usr/local/bin/gcc
else
	CC = mpicc
endif

FFLAGS = -Wall -O3 -fopenmp -fallow-argument-mismatch $(INCLUDES) ${ADDITIONAL_FFLAGS}
# Note for GCC 10 or newer: add -fallow-argument-mismatch in the above flags
FC = mpifort
# FC = mpif90
# FC = gfortran

# Include a list of all the source files
include $(CCX)/Makefile.inc
SCCXMAIN = ccx_$(CCX_VERSION).c

# Append additional sources
SCCXC += nonlingeo_precice.c dyna_precice.c CCXHelpers.c PreciceInterface.c
SCCXF += getflux.f getkdeltatemp.f



# Source files in this folder and in the adapter directory
$(OBJDIR)/%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : %.f
	$(FC) $(FFLAGS) -c $< -o $@
$(OBJDIR)/%.o : adapter/%.c
	$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : adapter/%.cpp
	g++ -std=c++11 $(YAML_INCLUDE) -c $< -o $@ $(LIBS)
	#$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(LIBS)

# Source files in the $(CCX) folder
$(OBJDIR)/%.o : $(CCX)/%.c
	$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o : $(CCX)/%.f
	$(FC) $(FFLAGS) -c $< -o $@

# Generate list of object files from the source files, prepend $(OBJDIR)
OCCXF = $(SCCXF:%.f=$(OBJDIR)/%.o)
OCCXC = $(SCCXC:%.c=$(OBJDIR)/%.o)
OCCXMAIN = $(SCCXMAIN:%.c=$(OBJDIR)/%.o)
OCCXC += $(OBJDIR)/ConfigReader.o $(OBJDIR)/2D3DCoupling.o $(OBJDIR)/OutputBuffer.o



$(OBJDIR)/ccx_preCICE: $(OBJDIR) $(OCCXMAIN) $(OBJDIR)/ccx_$(CCX_VERSION).a
	$(FC) -fopenmp -Wall -O3 -o $@ $(OCCXMAIN) $(OBJDIR)/ccx_$(CCX_VERSION).a $(LIBS)

$(OBJDIR)/ccx_$(CCX_VERSION).a: $(OCCXF) $(OCCXC)
	ar vr $@ $?

$(OBJDIR):
	mkdir -p $(OBJDIR)

clean:
	rm -f $(OBJDIR)/*.o $(OBJDIR)/ccx_$(CCX_VERSION).a $(OBJDIR)/ccx_preCICE

How did you install preCICE?

This page may help: Building from source - Finding | preCICE - The Coupling Library

In particular, if you have built preCICE from source and use it directly from the build directory, check that pkg-config --libs libprecice gives something like:

-L/path/to/precice/build -lprecice

But this should not happen if you use system packages.