SetCompilerPathsII & SetCompilerSwitches for WinFBE

Windows specific questions.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by srvaldez »

I like it :-)
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

Paul Squires has come up trumps with WinFBE Version 2.0.6 (February 22, 2020) with an edit allowing me to remove the message: "Make sure you do a compilation before closing WinFBE."

However, until you get 2.0.6 on board keep using my last efforts. The link below, imaginatively called SCPII&SCSIISansMsg.zip, unzips to a folder containing versions of SCPII and SCSII without the message reminder.

SCPII&SCSIISansMsg.zp
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by srvaldez »

Hi deltarho[1859]
I see a problem, if you choose a 64-bit compiler and set the -arch to the indeterminate state = 686, then it compiles to 32-bit
the only two options that we have when compiling to 64-bit is native or x86-64, at least that's what I see.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

@srvaldez

That is one great catch!

This is what I get:

Code: Select all

SetCompilerSwitchesII
 
No tick : Default
 
32 bit
FreeBASIC Compiler - Version 1.07.1 (2019-09-29), built for win32 (32bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win32, 486, 32bit
 
64 bit
FreeBASIC Compiler - Version 1.07.1 (2019-09-29), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
 
Indeterminate : 686
 
32 bit
FreeBASIC Compiler - Version 1.07.1 (2019-09-29), built for win32 (32bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win32, 686, 32bit
 
64 bit
FreeBASIC Compiler - Version 1.07.1 (2019-09-29), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win32, 686, 32bit
 
Tick : Native
 
32 bit
FreeBASIC Compiler - Version 1.07.1 (2019-09-29), built for win32 (32bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win32, 686, 32bit
 
64 bit
FreeBASIC Compiler - Version 1.07.1 (2019-09-29), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
So, with the default we have 486/x86-64, with 686 we have 686/686 and with native we have 686/x86-64

For the sheer hell of it I tried x86-64 as the Indeterminate and that was OK in 64 bit mode but I got an 'Internal compiler error' in 32 bit mode. What a bummer - it would have been nice if the compiler said: "What is he/she playing at, I'll give him/her 686 for 32 bit mode."

I'm going to leave it as it is - I cannot see what else to do. Compiling in 64 bit mode we have a choice between 'no tick' or 'tick'. Compiling in 32 bit mode we can choose any of the three options.

Just as a 'by the way' for the first time I compiled both tools this time using '-gen gcc -Wc -Os' - there is no need for performance optimization. I also used gcc 8.3 which is turning out to be my favourite compiler. The binaries are pretty much the same size as with 9.2 and with my setup there is no performance difference. However, I do get the occasional warning with 9.2 that I don't get with 8.3. Did you know there is now a 7.5 version - 11 months after 7.4 and that is the end of that branch. No new features but over 200 bugs sorted out. Equation.com are still on 7.4.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by srvaldez »

deltarho[1859] wrote:Did you know there is now a 7.5 version - 11 months after 7.4 and that is the end of that branch. No new features but over 200 bugs sorted out. Equation.com are still on 7.4.
where's it available?
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

srvaldez wrote:where's it available?
Well, it is mentioned here but I do not know if it is in a form we can make use of. I will be keeping an eye on equation.com.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by srvaldez »

@deltarho[1859]
regarding the fbc64 compiler producing a 32-bit executable, I believe it works because of the way the 32 and 64-bit compilers are packaged in one folder, it wouldn't work otherwise.
I like this feature, just set the default compiler to fbc64 and whenever you want a 32-bit build then just set the switch to indeterminate.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

@srvaldez

That sounds OK except for those running a 32-bit OS, but they must be getting few and far between nowadays.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

Re-writing the table above we get:

Code: Select all

Mode   0 tick  Int  Tick
32-bit  486    686  686
64-bit x86-64  686 x86-64
So, if anyone wants a 486 binary, FB's default, then they need to use 32-bit mode and no tick otherwise they get a 686 binary for both gas and gcc.

With srvaldez's suggestion, 64-bit mode as the default, if anyone wants a 686 binary then they need to use Indeterminate otherwise they get a x86-64 binary.

Without my -arch option we don't get access to a 686 binary.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

It is worth noting that in 32-bit mode although we have 686 for both gcc Indeterminate and Tick/native the resulting binaries may be different. One source code using gcc gave me:-

Code: Select all

No tick  164864
Ind      165888
Tick     164352 
On my machine then there is a difference between 686 and native and it does not follow that my native binary will run on your machine. In fact, FB's -arch options is only a subset of gcc's -march options, see x86 Options. With the full set I could choose 'ivybridge'.

Added: In 64-bit mode we have x86-64 for no tick and tick, but they have different binaries.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by srvaldez »

you can pass other architectures on the command line options with -Wc -march=skylake for example, you will windup with two -march=* on the compile command, but from my tests, it seems that gcc ignores the first options and uses the last on the command line
for example, if you use -Wc -O3 then you may have something like this: compiling C: D:\dev\FreeBASIC-1.07.1-win64\bin\win64\gcc.exe -m64 -march=x86-64 -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-main -Werror-implicit-function-declaration -O0 -fno-strict-aliasing -frounding-math -fno-math-errno -fwrapv -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-format -masm=intel "breeze-plant3.c" -o "breeze-plant3.asm" -O3 -march=native
note that gcc-5.2 does not recognize the more recent architectures, you may need to use gcc-8.3 or higher
breeze-plant3.c:1:0: error: bad value (skylake) for -march= switch
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

Interesting. We are definitely into personal use territory use now.
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

Three posts back we have a little table which tells us what we get by clicking on the -arch button when we are in 32-bit mode or 64-bit mode.

It occurred to me that it may be worthwhile to have a tool which reminded us of the table and that is what we have here, 'Arch settings.exe' to be dropped into your 'Tools' folder and installed in the usual way.

Needless to say if you are not using SetCompilerSwitchesII then this new tool is meaningless.

This is what it looks like.
Image

It is worth remembering what we are doing here. For example, the 32-bit and 64-bit modes using the indeterminate selection, that is the little black box, both output i686 binaries. The difference is that in 32-bit mode we are using the 32-bit C-emitter and in 64-bit mode we are using the 64-bit C-emitter. Theoretically the resulting binaries should be the same, but they are not so the C-emitters are generating different emissions but I do not think that makes any difference in practice.

Don't forget that using -arch as checked should be for personal use - the resulting binary may not work on other machines.

If you re-position the window after the first execution that position will be remembered.

The images used are proper buttons, but they have been disabled otherwise someone will click on them and then ask why nothing is happening. Image

As per srvaldez's suggestion I now have 64-bit as my default mode and use the unchecked -arch for x86-64 or the indeterminate -arch for i686.

If, for some reason, you want i486 binaries then use 32-bit mode and the -arch button as unchecked.

ArchSettings.zip
Last edited by deltarho[1859] on Feb 27, 2020 22:11, edited 1 time in total.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by srvaldez »

:-)
deltarho[1859]
Posts: 4305
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: SetCompilerPathsII & SetCompilerSwitches for WinFBE

Post by deltarho[1859] »

@srvaldez

And there am I thinking that you had become a smiley user convert.
Post Reply