#2679: How to link an externally compiled library during ET compilation
Reporter: Maria Mutz Status: open Milestone: Version: Type: bug Priority: minor Component:
Comment (by Roland Haas):
Thank you. Ok so the line that triggers the error is the last executed one:
``` gcc -L/cm/shared/apps/spack/cpu/opt/spack/linux-centos8-zen2/gcc-10.2.0/numactl-2.0.12-brsvuiqgwwnn2otgnu3pyemvgp6dal2n/lib/ -lm -lgfortran -L/home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src/Cocal_MRNS/Main_utility/ -lcocalmrns include_modulefiles_MRNS.f90.o -o include_modulefiles_MRNS.f90 ```
which indeed is full compile and link (no `-c` flag). This line should not be there, in particular since the lines above:
``` 1673483420.23084 Compiling /home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src/include_modulefiles_MRNS.f90 current_wd=`pwd` ; cd /home/mmutz/Cactus/configs/sim18/scratch ; gfortran -m128bit-long-double -fcray-pointer -ffixed-line-length-none -fno-range-check -march=znver2 -fomit-frame-pointer -lgfortran -I/home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src/Cocal_MRNS/Include_file/ -O2 -mavx2 -mfma -fopenmp -I"/home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src" -I"/home/mmutz/Cactus/configs/sim18/config-data" -I"/home/mmutz/Cactus/configs/sim18/bindings/include" -I"/home/mmutz/Cactus/src/include" -I"/home/mmutz/Cactus/arrangements" -I"/home/mmutz/Cactus/configs/sim18/bindings/Configuration/Thorns" -I"/home/mmutz/Cactus/configs/sim18/bindings/include/Cocalthorn" -I"/home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src" -I"/home/mmutz/Cactus/configs/sim18/bindings/include/Cocalthorn" -c -o $current_wd/include_modulefiles_MRNS.f90.o $current_wd/include_modulefiles_MRNS.f90 1673483422.67902 Postprocessing /home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src/include_modulefiles_MRNS.f90 ```
already compiled that same file to an object file (note the `-c` option in the long `gfortran` line).
The only reason I could think of why this may happen is that there are rogue Makefile recipes present.
In your case could you attach any and all files that have names like “Makefile”, “make.code.defn”, “make.code.deps”, “make.configuration.defn”, “make.configuration.deps” in the source code directory `/home/mmutz/Cactus/arrangements/MRNS/Cocalthorn/src/` that may help.
My guess would be that there is somthing that COCAL added. Namely the link line uses `gcc` but Cactus would use `g++` to link. Also the error producing file is very wrong in itself already, since it uses `include_modulefiles_MRNS.f90` as the _output_ that is writes to it (writes the linked executable there if it succeeded). The normal direction would be for `include_modulefiles_MRNS.f90` to be the _input_ and `include_modulefiles_MRNS.f90.o` (the object file) be the output. That is what is in the “Compiling” line above.
Unfortunately I am mostly guessing here, sorry.
-- Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2679/how-to-link-an-ext...