Compilation TOUGHREACT on Windows using gfortran and Cygwin

I am having some problems with compiling the original source code of TOUGHREACT.

I have tried using all of the compiler flags and the ones suggested on this forum. The errors i get are usually these two

inichm_v3.o:inichm_v3.f:(.text+0x18d): relocation truncated to fit: R_X86_64_PC32 against symbol `chemnode_' defined in COMMON section in inichm_v3.o

 unrecognized -a option `ck_size'
collect2.exe: error: ld returned 1 exit status


I tried for so long to get a fix but have been unsuccessful thus far. Anyone with an idea of where i am going wrong?


Thank you

4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Temitope, I am having the same problem as you with the inichm_v3 when compiling TOUGHREACT. Did you find the mistake? it would be great if you can share your experience with me.  If not, could someone please help us with this issue?

    Thanks in advance 

    best regards 


  • Last week, I was able to solve these problems and want to leave a record of my experience in case any other person needs it.  

    - The  flag “-stack_size," is no longer recognized by some compilers like MINGW+MSYS2, so this has to be changed just to  "-stack,"

    - The problem with the inichm_v3.o file (or any other file with the same error message) arose after I compiled some ".f" files without any of the recommended flags. So, when I tried to link all the ".o" files to create an executable, this error popped up. In my case was better to compile and link the executable in a single step, using the recommended flags provided in the "makefiles" directory. (e.g.: gfortran -o X2_eos9_n.exe -g -O2 -fstack-arrays -fdefault-integer-8 -fdefault-real-8 -fdefault-double-8 -falign-loops=16 -malign-double -fwhole-file -fopenmp -Wall -Wl,-stack,0x80000000 -fno-align-commons t2cg22_v3.f t2f_v3.f t2solv_v3.f meshm_v3.f multi_v3.f thermcond_v3.f wellboresim.f inichm_v3.f geochem_v3.f readtherm_hkf_v3.f readsolu_v3.f adsorption_v3.f heatcapacity_v3.f aqueous_kin_v3.f newton_v3.f rctprop_v3.f diffusion_lhs.f lapack_solver_int8.f treact_v3.f main_v3.f eos9_v3.f)

    • Hi Diego,

      Thanks for posting this! None of use MINGW and Cygwin with TOUGHREACT so this should be helpful to many others.

      cheers, Eric

      • Temitope
      • Temitope
      • 1 mth ago
      • Reported - view

      Diego Bedoya Gonzalez  Thanks for your instructions. I tried compiling and linking in one step as you suggested. While I was able to get rid of the inichm_v3.o error and the majority of the code compiled albeit with some warnings, I ended up getting this new error related to pthread

      c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread
      collect2.exe: error: ld returned 1 exit status


      I tried adding a lpthread flag but this didn't work. Is this something you encountered and if yes how did you fix it?


      Thank you

Like Follow
  • 1 mth agoLast active
  • 4Replies
  • 45Views
  • 3 Following