Compilation error ccx 2.21

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.

1 Like

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. 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:

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
1 Like

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)

With best regards, Prool

1 Like

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

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

1 Like

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

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

1 Like

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:

### 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!

@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

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

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…

@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
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

1 Like

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

and Makefile_mingw from patch: MINGW-packages/mingw-w64-calculix-ccx/ccx_mingw.patch at 4edf04ee0d34b3d84a7c1d2657cb94d02a582ee9 · msys2/MINGW-packages · GitHub

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 :slight_smile:

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!

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

1 Like

@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.

2 Likes

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

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:

            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 :slight_smile:

1 Like

check this link: Build ccx with arpack-ng - #2 by JuanP74

1 Like

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