# Compilation error ccx 2.21

**URL:** <https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825>\
**Category:** Getting started\
**Created:** [September 17, 2023, 7:58pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825 "2023-09-17T19:58:52Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![srg\_nktn](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@srg\_nktn](https://calculix.discourse.group/u/srg_nktn)\
**Post date:** [September 17, 2023, 7:58pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/1 "2023-09-17T19:58:52Z")

</div>

Hi. While compiling ccx 2.21 I get the following error:  
/usr/bin/ld: ../../../ARPACK/libarpack\_INTEL.a(drot.o): relocation R\_X86\_64\_32 against `.text’ can not be used when making a PIE object; recompile with -fPIE  
/usr/bin/ld: failed to set dynamic section sizes: bad value  
collect2: error: ld returned 1 exit status  
make: \*\*\* [Makefile:29: ccx\_2.21] Error 1  
Please tell me what to do? I tried all ARPACK from the official site and I get errors eveywhere.

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 17, 2023, 8:54pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/2 "2023-09-17T20:54:11Z")

</div>

If you OS has packages or build scripts for CalculiX, I suggest you try those.

It seems the original ARPACK library has not seen releases in some years. So the files you have might be stale or built with older conventions. There is a currently maintained fork, [arpack-ng](https://github.com/opencollab/arpack-ng). I built CalculiX on FreeBSD 13 with arpack-ng and it works fine.

The package system on my machine lists the following dependencies for its arpack-ng package:

```auto
arpack-ng-3.9.0_1:
        mpich-3.4.3_2
        lapack-3.11.0_1
        blas-3.11.0_1
        gcc12-12.2.0_6

```

---

<div class="post-metadata">

**Author:** ![prool](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/prool/32/12_2.png) [@prool](https://calculix.discourse.group/u/prool)\
**Post date:** [September 19, 2023, 11:41am UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/3 "2023-09-19T11:41:59Z")

</div>

> [@srg\_nktn](#):
>
> ARPACK

What is your operating system?

Where did you download the ARPACK package from?

Try ARPACK from this repo, please: [GitHub - calculix/ccx\_prool: Prool's modifications of CalculiX CrunchiX (ccx)](https://github.com/calculix/ccx_prool)

With best regards, Prool

---

<div class="post-metadata">

**Author:** ![srg\_nktn](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@srg\_nktn](https://calculix.discourse.group/u/srg_nktn)\
**Post date:** [September 19, 2023, 4:01pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/4 "2023-09-19T16:01:22Z")

</div>

I have Ubuntu 22.04.3. I download ARPACK from [http://www.dhondt.de/](http://www.dhondt.de/). Thank you I will try this repo.

---

<div class="post-metadata">

**Author:** ![prool](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/prool/32/12_2.png) [@prool](https://calculix.discourse.group/u/prool)\
**Post date:** [September 19, 2023, 6:21pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/5 "2023-09-19T18:21:36Z")

</div>

I don’t can reproduce this error.

Everything compiling without error.

Ubuntu 22.04.3, gcc 11.4.0, GNU fortran 11.4.0.

Try

> make clean  
> rm \*.a

before

> make lib

Because there are \*.o \*.a files in the ARPACK distribution

They can disturb.

It is unknown what OS/compilers version they were created in.

WBR,  
Prool

---

<div class="post-metadata">

**Author:** ![srg\_nktn](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@srg\_nktn](https://calculix.discourse.group/u/srg_nktn)\
**Post date:** [September 20, 2023, 6:33pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/6 "2023-09-20T18:33:03Z")

</div>

Thank you for reply.  
I downloaded ARPACK from your repository then I went into the ./home/…/ccx\_prol/ARPACK folder and ran ./fixhome.sh and make lib. I got the error again:

getv0.f:404:32:  
367 | call svout (logfil, 1, rnorm0, ndigit,  
| 2  
…  
404 | call svout (logfil, n, resid, ndigit,  
| 1  
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)  
make[1]: \*\*\* [Makefile:50: sgetv0.o] Error 1  
make[1]: Leaving directory ‘/home/…/ccx\_prool/ARPACK/SRC’  
ranlib /home/…/ccx\_prool/ARPACK/libarpack\_INTEL.a

After that I tried to run Makefile in the /home/…/ccx\_prool folder and I got error again:  
usr/bin/ld: ccx\_2.21.a(arpack.o): in function `arpack': arpack.c:(.text+0x1e21): undefined reference to `dsaupd\_’  
/usr/bin/ld: arpack.c:(.text+0x1fa7): undefined reference to `dsaupd_' /usr/bin/ld: arpack.c:(.text+0x5626): undefined reference to `dnaupd\_’  
/usr/bin/ld: arpack.c:(.text+0x585d): undefined reference to `dseupd_' /usr/bin/ld: arpack.c:(.text+0x5d21): undefined reference to `dneupd\_’  
/usr/bin/ld: arpack.c:(.text+0x607c): undefined reference to `dnaupd_' /usr/bin/ld: ccx_2.21.a(arpackbu.o): in function `arpackbu’:  
arpackbu.c:(.text+0x2408): undefined reference to `dsaupd_' /usr/bin/ld: arpackbu.c:(.text+0x24f9): undefined reference to `dsaupd\_’  
/usr/bin/ld: arpackbu.c:(.text+0x2f85): undefined reference to `dseupd_' /usr/bin/ld: ccx_2.21.a(arpackcs.o): in function `arpackcs’:  
arpackcs.c:(.text+0x26db): undefined reference to `dsaupd_' /usr/bin/ld: arpackcs.c:(.text+0x27e9): undefined reference to `dsaupd\_’  
/usr/bin/ld: arpackcs.c:(.text+0x2933): undefined reference to `dnaupd_' /usr/bin/ld: arpackcs.c:(.text+0x2b82): undefined reference to `dseupd\_’  
/usr/bin/ld: arpackcs.c:(.text+0x8ea3): undefined reference to `dneupd_' /usr/bin/ld: arpackcs.c:(.text+0x908d): undefined reference to `dnaupd\_’  
/usr/bin/ld: ccx\_2.21.a(randomfieldmain.o): in function `randomfieldmain': randomfieldmain.c:(.text+0xd19): undefined reference to `dsaupd\_’  
/usr/bin/ld: randomfieldmain.c:(.text+0xfc0): undefined reference to `dseupd\_’  
collect2: error: ld returned 1 exit status  
make[1]: \*\*\* [Makefile:29: ccx\_2.21] Error 1  
make[1]: Leaving directory ‘…/ccx\_prool/CalculiX/ccx\_2.21/src’  
make: \*\*\* [Makefile:7: all] Error 2.  
I have a clean Ubuntu 22.04.3, GCC 11.4.0, Fortran 11.4.0

---

<div class="post-metadata">

**Author:** ![prool](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/prool/32/12_2.png) [@prool](https://calculix.discourse.group/u/prool)\
**Post date:** [September 20, 2023, 7:55pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/7 "2023-09-20T19:55:00Z")

</div>

Fix for ARPACK for new gfortran (for example for Ubuntu 22)

add flag -fallow-argument-mismatch to FFLAGS in file ARmake.inc

and

make clean  
make lib

And go to ccx source directory and

rm \*.o \*.a  
make

…

PROFIT

WBR, Prool

---

<div class="post-metadata">

**Author:** ![tsvilans](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/tsvilans/32/761_2.png) [@tsvilans](https://calculix.discourse.group/u/tsvilans)\
**Post date:** [January 13, 2024, 4:30pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/8 "2024-01-13T16:30:49Z")

</div>

Hi all,

I’ve been trying to use the build script for Windows from `https://github.com/GeneralElectric/CalculiX/`

I’ve managed to get everything mostly setup, however when building CalculiX I get this error:

```auto
### Building CalculiX CCX (sequential version) ...
cc -Wall -O2 -I ../../../SPOOLES.2.2 -DARCH="Linux" -DSPOOLES -DARPACK -DMATRIXSTORAGE -DNETWORKOUT -c ccx_2.21.c
ccx_2.21.c:19:1: warning: data definition has no type or storage class
   19 | _set_output_format(_TWO_DIGIT_EXPONENT);
      | ^ ~~~~~~~~~~~~~~~~~
ccx_2.21.c:19:1: warning: type defaults to 'int' in declaration of '_set_output_format' [-Wimplicit-int]
ccx_2.21.c:19:1: warning: parameter names (without types) in function declaration
In file included from ccx_2.21.c:28:
C:/msys64/ucrt64/include/stdio.h:734:32: error: conflicting types for '_set_output_format'; have 'unsigned int(unsigned int)'
  734 | _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format);
      | ^ ~~~~~~~~~~~~~~~~~
ccx_2.21.c:19:1: note: previous declaration of '_set_output_format' with type 'int()'
   19 | _set_output_format(_TWO_DIGIT_EXPONENT);
      | ^ ~~~~~~~~~~~~~~~~~
make: *** [Makefile:9: ccx_2.21.o] Error 1

```

So the final binaries are not built…

Any clue about what might be the issue? Do I have to set the `-fallow-argument-mismatch` somewhere? If so, in which Makefile should it go?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![fgr](https://avatars.discourse-cdn.com/v4/letter/f/f4b2a3/32.png) [@fgr](https://calculix.discourse.group/u/fgr)\
**Post date:** [January 13, 2024, 6:19pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/9 "2024-01-13T18:19:43Z")

</div>

@tsvilans  
From what you have listed, then my best guess would be, that first time the compiler meet set\_output\_format(\_TWO\_DIGIT\_EXPONENT) it hasn’t been declared yet by a pre declaration why the compiler declare it as a default int, later stdio.h is included the set\_output\_format(\_TWO\_DIGIT\_EXPONENT) is tried to be redeclared as an unsigned int.

I don’t know if it can help, but a quick dirty fix could be just in top of ccx\_2.21.c to put in the following line

unsigned int set\_output\_format(\_TWO\_DIGIT\_EXPONENT);

it’s a little dirty but otherwise you will need to get order in when and how set\_output\_format(\_TWO\_DIGIT\_EXPONENT) is declared

---

<div class="post-metadata">

**Author:** ![tsvilans](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/tsvilans/32/761_2.png) [@tsvilans](https://calculix.discourse.group/u/tsvilans)\
**Post date:** [January 14, 2024, 11:05am UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/10 "2024-01-14T11:05:11Z")

</div>

> [@fgr](#):
>
> unsigned int set\_output\_format(\_TWO\_DIGIT\_EXPONENT);

Thanks! That seemed to get rid of _that_ error, but now the output has errors related to ARPACK:

```auto
arpack.c:1143:7: error: too many arguments to function 'results'
 1143 | results(co,nk,kon,ipkon,lakon,ne,v,stn,inum,
      | ^ ~~~~~~
CalculiX.h:2280:6: note: declared here
 2280 | void results(double *co,ITG *nk,ITG *kon,ITG *ipkon,char *lakon,
      | ^ ~~~~~~
arpack.c:1188:7: error: too many arguments to function 'frd'
 1188 | frd(co,nk,kon,ipkon,lakon,ne,v,stn,inum,nmethod,
      | ^~~
CalculiX.h:1001:6: note: declared here
 1001 | void frd(double *co,ITG *nk,ITG *kon,ITG *ipkon,char *lakon,ITG *ne0,
      | ^~~
arpack.c:1197:7: error: too many arguments to function 'frd'
 1197 | frd(co,nk,kon,ipkon,lakon,ne,v,stn,inum,nmethod,
      | ^~~
CalculiX.h:1001:6: note: declared here
 1001 | void frd(double *co,ITG *nk,ITG *kon,ITG *ipkon,char *lakon,ITG *ne0,
      | ^~~

<a bunch of warnings ...>

make: *** [Makefile_MT:9: arpack.o] Error 1

```

I am using the MSYS2 UCRT64 environment, if that helps…

---

<div class="post-metadata">

**Author:** ![fgr](https://avatars.discourse-cdn.com/v4/letter/f/f4b2a3/32.png) [@fgr](https://calculix.discourse.group/u/fgr)\
**Post date:** [January 14, 2024, 12:02pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/11 "2024-01-14T12:02:18Z")

</div>

@tsvilans , it seems you have mix of different versions of source code. I can only recommend you to grab the official source code form here  
[http://www.dhondt.de/ccx\_2.21.src.tar.bz2](http://www.dhondt.de/ccx_2.21.src.tar.bz2)  
I believe it still should be completely error free, you will just need to accept all compiler warnings.

If you don’t have much experience with both Fortran and C, then I will recommend you the grab the windows compiled package from here  
[http://www.dhondt.de/calculix\_2.21\_4win.zip](http://www.dhondt.de/calculix_2.21_4win.zip)

---

<div class="post-metadata">

**Author:** ![rafal.brzegowy](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@rafal.brzegowy](https://calculix.discourse.group/u/rafal.brzegowy)\
**Post date:** [January 14, 2024, 12:27pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/12 "2024-01-14T12:27:33Z")

</div>

If you use MSYS2/mingw, take a look at the PKGBUILD file to see how ccx is compiled there: [MINGW-packages/mingw-w64-calculix-ccx/PKGBUILD at 4edf04ee0d34b3d84a7c1d2657cb94d02a582ee9 · msys2/MINGW-packages · GitHub](https://github.com/msys2/MINGW-packages/blob/4edf04ee0d34b3d84a7c1d2657cb94d02a582ee9/mingw-w64-calculix-ccx/PKGBUILD#L51)

and Makefile\_mingw from patch: [MINGW-packages/mingw-w64-calculix-ccx/ccx\_mingw.patch at 4edf04ee0d34b3d84a7c1d2657cb94d02a582ee9 · msys2/MINGW-packages · GitHub](https://github.com/msys2/MINGW-packages/blob/4edf04ee0d34b3d84a7c1d2657cb94d02a582ee9/mingw-w64-calculix-ccx/ccx_mingw.patch#L37)

---

<div class="post-metadata">

**Author:** ![tsvilans](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/tsvilans/32/761_2.png) [@tsvilans](https://calculix.discourse.group/u/tsvilans)\
**Post date:** [January 14, 2024, 12:46pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/13 "2024-01-14T12:46:07Z")

</div>

Thank you both! I’ll investigate further.

I’ve been using the compiled Windows package successfully, however I would like to learn to compile it myself, so that I can define a custom material to define material orientations per-integration point, for example, among other things. It certainly is a learning curve but I have to start somewhere 🙂

For context, we are working on defining a mechanical wood model, based on properties and material orientations derived from CT scans. So it is becoming more and more desirable to have some more control over our material definitions!

---

<div class="post-metadata">

**Author:** ![NorbertH](https://avatars.discourse-cdn.com/v4/letter/n/74df32/32.png) [@NorbertH](https://calculix.discourse.group/u/NorbertH)\
**Post date:** [January 14, 2024, 9:36pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/14 "2024-01-14T21:36:23Z")

</div>

> [@tsvilans](#):
>
> For context, we are working on defining a mechanical wood model, based on properties and material orientations derived from CT scans

before spending a lot of time with coding, first take a look at medtool. this should already have all of the features you would need to preprocess ct scans and do a material mapping.  
[http://www.dr-pahr.at/html/04.html#fea-material-mapping](http://www.dr-pahr.at/html/04.html#fea-material-mapping)

---

<div class="post-metadata">

**Author:** ![vicmw](https://avatars.discourse-cdn.com/v4/letter/v/6de8d8/32.png) [@vicmw](https://calculix.discourse.group/u/vicmw)\
**Post date:** [January 15, 2024, 12:43am UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/15 "2024-01-15T00:43:23Z")

</div>

@tsvilans I guess the mix of different versions of source code is because the GE CCX includes some modified source files (in patches directory) which it overwrites the originals with. You have to manually apply the changes in those modified ones to the correct version files from what you’re compiling.

I just remove the \_TWO\_DIGIT\_EXPONENT stuff. It doesn’t seem to be needed anymore anyway. It’s to work around a bug in old MS CRT libraries.

---

<div class="post-metadata">

**Author:** ![tsvilans](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/tsvilans/32/761_2.png) [@tsvilans](https://calculix.discourse.group/u/tsvilans)\
**Post date:** [January 15, 2024, 6:59am UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/16 "2024-01-15T06:59:52Z")

</div>

Thanks! Will take a look at that, looks very interesting.

---

<div class="post-metadata">

**Author:** ![tsvilans](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/tsvilans/32/761_2.png) [@tsvilans](https://calculix.discourse.group/u/tsvilans)\
**Post date:** [January 15, 2024, 7:06am UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/17 "2024-01-15T07:06:27Z")

</div>

Got it, I’ll scour the patches for the old versions to find out what else needs to be changed.

I got a little bit further, but then realized that the build script uses these links:

```auto
            download arpack96.tar.gz http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz > $LOG_FILE 2>&1
            download arpack96_patch.tar.gz http://www.caam.rice.edu/software/ARPACK/SRC/patch.tar.gz >> $LOG_FILE 2>&1

```

which don’t exist anymore and, reading up on it, sounds like that hasn’t been the case for a while. It seems I need ARPACK NG now instead, correct? In this case, it would be good to update the GE scripts or else link to another working example of compiling for Windows on the CalculiX website.

If I get this running, I’ll be happy to document it for other newbies who would like to do this 🙂

---

<div class="post-metadata">

**Author:** ![JuanP74](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@JuanP74](https://calculix.discourse.group/u/JuanP74)\
**Post date:** [January 15, 2024, 3:45pm UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/18 "2024-01-15T15:45:48Z")

</div>

check this link: [Build ccx with arpack-ng - #2 by JuanP74](https://calculix.discourse.group/t/build-ccx-with-arpack-ng/1544/2)

---

<div class="post-metadata">

**Author:** ![jbr](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jbr](https://calculix.discourse.group/u/jbr)\
**Post date:** [January 16, 2024, 3:30am UTC](https://calculix.discourse.group/t/compilation-error-ccx-2-21/1825/19 "2024-01-16T03:30:46Z")

</div>

> [@tsvilans](#):
>
> In this case, it would be good to update the GE scripts or else link to another working example of compiling for Windows on the CalculiX website.

I don’t think the GE scripts are maintained anymore… the last commit was on May 12, 2016.
