Compiling calculix-adapter for ccx_2.20 on macOS: dyna_precice undeclared error

Hello preCICE community,

I’m trying to compile the calculix-adapter for ccx_2.20 on my macOS system, and I’m consistently hitting an undeclared function 'dyna_precice' error. I’ve followed the documentation and troubleshooting steps but haven’t been able to resolve it.
Here’s a summary of my setup and the problem:


My Setup

  • Operating System: macOS (Apple Silicon, using Homebrew)
  • CalculiX Version: ccx_2.20 (downloaded ccx_2.20.src.tar.bz2 from www.dhondt.de)
  • preCICE Adapter: Latest v2.20.0 release (downloaded calculix-adapter-2.20.0.tar.gz from GitHub releases)
  • preCICE Library: v3.2.0
  • Dependencies:
    • SPOOLES: SPOOLES.2.2 (compiled from source, spooles.a located at ~/src/SPOOLES.2.2/spooles.a)
    • ARPACK/LAPACK/BLAS: Installed via Homebrew (/opt/homebrew/lib), correctly linked as libarpack.dylib, libblastrampoline.dylib.
    • yaml-cpp: Installed via Homebrew (/opt/homebrew/lib).
  • Compiler: Homebrew’s Clang (/opt/homebrew/opt/llvm/bin/clang)

The Problem

When I run make in the adapter’s directory, I get the following error:

/opt/homebrew/opt/llvm/bin/clang ... -c ccx_2.20.c -o bin/ccx_2.20.o
ccx_2.20.c:1487:9: error: call to undeclared function 'dyna_precice'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1487 |           dyna_precice(&co, &nk, &kon, &ipkon, &lakon, &ne, &nodeboun, &ndirboun, &xboun, &nboun,
     |           ^
1 error generated.
make: *** [bin/ccx_2.20.o] Error 1

Steps I’ve Already Taken

  1. Confirmed Makefile paths: I’ve carefully set CCX, SPOOLES_LIBS, ARPACK_LIBS, YAML_LIBS to my system’s correct paths.
  2. Re-downloaded adapter: I’ve deleted and re-downloaded the latest v2.20.1 release of the calculix-adapter from GitHub to ensure no corruption.
  3. Checked adapter source files: After unpacking the v2.20.1 adapter, I confirmed that adapter/ directory does NOT contain dyna_precice.c or nonlingeo_precice.c. It only has CCXHelpers.c, PreciceInterface.c, and other C++ files.
  4. Modified adapter Makefile (SCCXC): Since dyna_precice.c and nonlingeo_precice.c are missing, I’ve manually edited the adapter’s Makefile to remove them from the SCCXC variable:
  • Original: SCCXC += nonlingeo_precice.c dyna_precice.c CCXHelpers.c PreciceInterface.c
  • Modified: SCCXC += CCXHelpers.c PreciceInterface.c
  1. Cleaned and rebuilt: Always run make clean before make .

What I Need Help With

Despite all these steps, the error persists. It appears that my ccx_2.20.c source file still calls dyna_precice, but the adapter (even the latest stable release) no longer provides this function.

  • Is there a specific patched version of ccx_2.20 that the v2.20.1 adapter expects?
  • Am I missing a patching step for the ccx_2.20 source that’s not explicitly in the Makefile?
  • Has anyone else encountered this dyna_precice error when compiling the latest adapter with ccx_2.20 on macOS, and if so, how did you resolve it?

Any guidance or insight from the community would be greatly appreciated! Thank you for your time.

Hi,

You should create a ‘dyna_precice.h’ header file with:

#ifndef DYNA_PRECICE_H
#define DYNA_PRECICE_H

void dyna_precice(double **cop, ITG *nk, ITG **konp, ITG **ipkonp, char **lakonp, ITG *ne,
                  ITG **nodebounp, ITG **ndirbounp, double **xbounp, ITG *nboun,
                  ITG **ipompcp, ITG **nodempcp, double **coefmpcp, char **labmpcp,
                  ITG *nmpc, ITG *nodeforc, ITG *ndirforc, double *xforc,
                  ITG *nforc, ITG *nelemload, char *sideload, double *xload,
                  ITG *nload,
                  ITG **nactdofp, ITG *neq, ITG *nzl, ITG *icol, ITG *irow,
                  ITG *nmethod, ITG **ikmpcp, ITG **ilmpcp, ITG **ikbounp,
                  ITG **ilbounp, double *elcon, ITG *nelcon, double *rhcon,
                  ITG *nrhcon, double *cocon, ITG *ncocon,
                  double *alcon, ITG *nalcon, double *alzero,
                  ITG **ielmatp, ITG **ielorienp, ITG *norien, double *orab,
                  ITG *ntmat_, double **t0p,
                  double **t1p, ITG *ithermal, double *prestr, ITG *iprestr,
                  double **voldp, ITG *iperturb, double **stip, ITG *nzs,
                  double *timepar, double *xmodal,
                  double **veoldp, char *amname, double *amta,
                  ITG *namta, ITG *nam, ITG *iamforc, ITG *iamload,
                  ITG **iamt1p, ITG *jout,
                  ITG *kode, char *filab, double **emep, double *xforcold,
                  double *xloadold,
                  double **t1oldp, ITG **iambounp, double **xbounoldp, ITG *iexpl,
                  double *plicon, ITG *nplicon, double *plkcon, ITG *nplkcon,
                  double **xstatep, ITG *npmat_, char *matname, ITG *mi,
                  ITG *ncmat_, ITG *nstate_, double **enerp, char *jobnamec,
                  double *ttime, char *set, ITG *nset, ITG *istartset,
                  ITG *iendset, ITG **ialsetp, ITG *nprint, char *prlab,
                  char *prset, ITG *nener, double *trab,
                  ITG **inotrp, ITG *ntrans, double **fmpcp, ITG *ipobody, ITG *ibody,
                  double *xbody, ITG *nbody, double *xbodyold, ITG *istep,
                  ITG *isolver, ITG *jq, char *output, ITG *mcs, ITG *nkon,
                  ITG *mpcend, ITG *ics, double *cs, ITG *ntie, char *tieset,
                  ITG *idrct, ITG *jmax,
                  double *ctrl, ITG *itpamp, double *tietol, ITG *nalset,
                  ITG *ikforc, ITG *ilforc, double *thicke, ITG *nslavs, ITG *nmat,
                  char *typeboun, ITG *ielprop, double *prop, char *orname,
                  double *t0g, double *t1g,
                  char *preciceParticipantName, char *configFilename);

#endif

Then include this header file at the beginning of ‘ccx_2.20.c’

Regards
Guillaume

1 Like

Thanks for your reply!

I’m still stuck trying to compile the calculix-adapter for ccx_2.20 on macOS, and I keep getting an “undeclared function 'dyna_precice'” error.

I’ve already integrated the dyna_precice.h header you provided into ccx_2.20.c (even tried directly pasting the declaration to be sure), but the error persists.

Upon checking the v2.20.0 release of the adapter, I noticed that the adapter/ directory does not contain the dyna_precice.c or nonlingeo_precice.c source files.

Given this, I have a question:

  • Is the v2.20.0 adapter designed such that the calls to dyna_precice (and potentially nonlingeo_precice) in ccx_2.20.c are actually expected to be removed or patched out from the CalculiX source itself?
  • Or, are the actual implementation (.c) files for dyna_precice and nonlingeo_precice supposed to be part of the v2.20.0 adapter release, and perhaps they are missing?

Since the .c files are absent, even with the header, the linker can’t find the function’s definition. Any clarification would be greatly appreciated!

I reread your first post: In my case dyna_precice.c is not under adapter/ but in the root of the archive:

wget https://github.com/precice/calculix-adapter/archive/refs/heads/master.tar.gz
tar -xzf master.tar.gz
cd calculix-adapter-master

‘ls’ gives me that

CalculiX.h  Makefile            README.md  bin/        dyna_precice.c  getflux.f               getkdeltatemp.f      packaging/            tools/
LICENSE     Makefile_i8_PaStiX  adapter/   ccx_2.20.c  dyna_precice.h  getgausspointscoords.f  nonlingeo_precice.c  pastix_pre_build.sh*

I don’t have to modify the SCCXC variable.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.