Author Topic: Fortran Standalone Windows exe missing dlls  (Read 4109 times)

Offline cristipurdel

  • Single posting newcomer
  • *
  • Posts: 1
Fortran Standalone Windows exe missing dlls
« on: September 25, 2020, 07:13:30 pm »
I am trying to generate a fortran standalone exe, but the following dlls need to be in the same folder (currently this is the only way to run the file):
libgcc_s_seh-1.dll
libquadmath-0.dll
libwinpthread-1.dll

My question is, what options should I modify in cb build options, in order to have a "portable" exe.

Closest thing I found was
http://forums.codeblocks.org/index.php?action=post;quote=100438;topic=14127.0;last_msg=118640
My understanding is that I need to add "MONOLITHIC=1 RUNTIME_LIBS=static SHARED=0" somewhere

I am using cb 20.03 portable windows

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13439
    • Travis build status
Re: Fortran Standalone Windows exe missing dlls
« Reply #1 on: September 25, 2020, 09:14:22 pm »
C::B is not a compiler. You'll have to ask the vendor of the compiler you're using. You might inspect its docs to see if there is an option you could use.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline wbjohns

  • Single posting newcomer
  • *
  • Posts: 1
Re: Fortran Standalone Windows exe missing dlls
« Reply #2 on: November 22, 2021, 06:12:49 pm »
You need to add the static files in the linker.
Try this first for a test project that just compiles the default fortran program that is created when you create a new fortran application project in cb.  The default fortran program just says hello world.
After you create the test project:
1. Go to the Project tab at the top and scroll down to Build options.
2.  Hopefully you have the GNU Fortran Compiler selected. Go to Linker settings and click on the add button. You are going to add some static files (i.e., ".a") files to the linker.
3. Look for the program files directory for cb. (Or just do a file explorer search for the files below).  Look for directory
mingw\lib\gcc\mingw32\4.9.2 (or whatever verion number you are running) and add the following files:
libfortran.a, libquadmath.a,libgcc.a, and libgcc_s.a in that order.
4. under other linker options type: -static-libgcc -static-libstdc++ with one space between the the first and second -static options and no space before the first -static option.
5. Hit okay to get out of the Project tab.
6. under the Build tab hit the rebuild workspace to recompile and relink everything.
Now try to execute the test program in a command window.  This proceddure worked for my codeblocks fortran which is version 16.
Now you need to find the static ".a" files for replace the rest of your ".dll" files.
« Last Edit: November 23, 2021, 02:21:57 am by wbjohns »