Author Topic: gfortran Compiler Options File  (Read 4973 times)

Offline DoctorRad

  • Single posting newcomer
  • *
  • Posts: 6
gfortran Compiler Options File
« on: November 09, 2016, 11:18:12 am »
Hi folks,

I am trying to add a couple of extra compiler options to the GNU Fortran Compiler, so have added the following section to options_gfortran.xml:

Code: xml
	<Category name="Misc">
<Option name="Do not append underscores to names of entities specified in the Fortran source file"
                option="-fno-underscoring"/>
<Option name="Use a different function-calling convention"
                option="-mrtd"/>
</Category>

It does not appear that this is being picked up when I re-start C::B (Windows v16.01).

Can anyone help sort out what might be wrong? There does not appear to be a separate Compiler File (compiler_*.xml) specifically for gfortran, and it appears that the options_gfortran.xml file is being ignored.

Many thanks,

Dr. Matt...

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: gfortran Compiler Options File
« Reply #1 on: November 09, 2016, 07:53:34 pm »
Hi,
I tried to add your lines in my options_gfortran.xml (in my C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\compilers folder).
It works as expected : new options appear in my fortran compiler options.
I had a problem with my 64 bits version because my configuration for gfortran 64 was based on gcc. But, I rebuilt it from standard gfortran, and it also works now.
So, there is something wrong in your configuration, but it should work.

cordially,

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: gfortran Compiler Options File
« Reply #2 on: November 09, 2016, 07:59:45 pm »
Have you tried to use UI in the complier options dialog?
Right click -> Add new flag or something like this.
(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 DoctorRad

  • Single posting newcomer
  • *
  • Posts: 6
Re: gfortran Compiler Options File
« Reply #3 on: November 10, 2016, 10:31:47 am »
I had a problem with my 64 bits version because my configuration for gfortran 64 was based on gcc. But, I rebuilt it from standard gfortran, and it also works now. So, there is something wrong in your configuration, but it should work.
Many thanks for your response. Could you talk me through 'rebuilding from standard gfortran' or point me in the direction of a guide? What do you mean by 'standard' gfortran?

Best wishes,

Dr. Matt...

Offline DoctorRad

  • Single posting newcomer
  • *
  • Posts: 6
Re: gfortran Compiler Options File
« Reply #4 on: November 10, 2016, 10:33:28 am »
Have you tried to use UI in the complier options dialog?
Right click -> Add new flag or something like this.
Yes, I've tried this, but the user interface does not allow you to add a new category of flags from what I can see.

Can you also tell me, if I do add new flags using the user interface, in which configuration file they should appear?

Many thanks,

Dr. Matt...

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: gfortran Compiler Options File
« Reply #5 on: November 10, 2016, 04:40:00 pm »
I had a problem with my 64 bits version because my configuration for gfortran 64 was based on gcc. But, I rebuilt it from standard gfortran, and it also works now. So, there is something wrong in your configuration, but it should work.
Many thanks for your response. Could you talk me through 'rebuilding from standard gfortran' or point me in the direction of a guide? What do you mean by 'standard' gfortran?

I'm not sure if gfortran configuration was already included in 16.01 version. I use myself a nightly svn version (and more a version that I build myself with the distributed .workspace file, but it's not necessary: last distributed nightlies should be OK for Windows or Linux). In that case, when I choose a compiler for a fortran source, in Settings / Compiler..., I click on the first top button under "Selected Compiler" and choose GNU fortran compiler which is almost at the bottom of the list. This is this setting that I call standard gfortran (may be I should say "distributed version").
So, I choosed this version, which has a "Fortran Dialect" category, then copy it (with the "Copy" button"), and modified the copy to obtain a 64 bit setting for gfortran.

gd_on
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: gfortran Compiler Options File
« Reply #6 on: November 10, 2016, 09:19:58 pm »
Can you also tell me, if I do add new flags using the user interface, in which configuration file they should appear?
Somewhere next to the default.conf file. It is some xml file.
(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 DoctorRad

  • Single posting newcomer
  • *
  • Posts: 6
Re: gfortran Compiler Options File
« Reply #7 on: November 14, 2016, 04:42:06 pm »
Somewhere next to the default.conf file. It is some xml file.
Many thanks, I found it now, a modified options_gfortran.xml file is in my AppData folder, not with the main application files.

In keeping with the style of that file, I added the following two lines:

Code: xml
  <Option name="Do not append underscores to names of entities specified in the Fortran source file" option="-fno-underscoring" category="Misc"/>
  <Option name="Use a different function-calling convention" option="-mrtd" category="Misc"/>

...and the two options now appear in their own 'Misc' category as expected.
« Last Edit: November 14, 2016, 05:05:27 pm by DoctorRad »