new mingw toolchain (Equation tool chain)

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

new mingw toolchain (Equation tool chain)

Postby srvaldez » Aug 24, 2019 18:33

I came across a new mingw distribution (at least for me) http://www.equation.com/servlet/equation.cmd?fa=fortran it has versions 7.4.0, 8.3.0 and 9.1.0 plus weekly snapshots of the latest version
the only thing missing to build FB is ffi.h which can be found at https://sourceware.org/libffi/, I also had a problem with make not having permission to create files, but replacing it with the one from msys2 solved the problem, the nice thing about this distribution is that there are no dependencies other than the already installed windows dll's, whereas building FB with the msys2 toolchain there are a number of mingw dll dependencies, including libwinpthread-1.dll
Last edited by coderJeff on Sep 08, 2019 14:30, edited 1 time in total.
Reason: updated topic title
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain

Postby coderJeff » Aug 26, 2019 17:50

I have downloaded the packages, but haven't quite spent the time to try it out. Soon, tho.

When you created the package for fbc with gcc 9.1, were there any other dependencies that had to be included? For example, binutils. Or maybe it doesn't matter?

How did you create the fbc package? Your own script? Or just with fbc makefile?

I have been putting it off too long now, to update the gcc tool chain we package with fbc releases, so I am thinking of at least getting to gcc 7.3, which is readily available from mingw-w64 project on sourceforge. That's the source for binary packages we have been using for fbc so far.

My experience with msys2 & mingw-w64:
- when building with msys2 there are many dependencies
- when building with mingw-w64, a kind of standalone toolchain, there are no depencies (I think)

Finally, just curious, are there any users of the "offical" releases that are finding dependencies on missing dll's?
srvaldez
Posts: 2104
Joined: Sep 25, 2005 21:54

Re: new mingw toolchain

Postby srvaldez » Aug 26, 2019 18:27

hello coderJeff
yes, when building FB with the msys2 toolchain there are a number of dependencies, however, you can use the msys2 shell facility with other toolchains
The only thing missing from equation's distro was ffi.h and though make is included it was giving me permission problems, so I replaced it with the one from msys2
I find msys2 shell works good for building FB, I used the version found here https://sourceforge.net/projects/msys2/ ... e/download
The good thing is that you can easily install tools like make, git, patch, zip, and p7zip with pacman.
Also, the msys2 package does not include compilers or lib's, the folders are there but are empty, you can install them with pacman but in this case I simply copy the files and folders from equation's toolchain into the appropriate folders mingw32 and mingw64, then it's just a matter of runing make, building the libs and FB distribution
I am happy that you are interested in equation's toolchain, it looks like a clean mingw distribution.

[edit] about the new mingw distribution, one has to install it for the files to be properly decompressed, I tried extracting the files with 7-zip but it din't work.
Last edited by srvaldez on Aug 26, 2019 21:13, edited 1 time in total.
srvaldez
Posts: 2104
Joined: Sep 25, 2005 21:54

Re: new mingw toolchain

Postby srvaldez » Aug 26, 2019 20:50

@coderJeff
I don't know if you are aware of this or not, but msys2 fails to build a 32-bit version of FB unless you patch the makefile, the patch is by StW

Code: Select all

diff --git a/makefile b/makefile
index 8145b4f..512b81b 100644
--- a/makefile
+++ b/makefile
@@ -242,7 +242,12 @@ else
     # For DJGPP, always use x86 (DJGPP's uname -m returns just "pc")
     ifeq ($(TARGET_OS),dos)
       TARGET_ARCH := x86
-    else
+   # For MSYS2, use default compilers (uname -m returns MSYS2's shell architecture)
+    else ifneq ($(findstring MINGW32,$(uname)),)
+      TARGET_ARCH := x86
+    else ifneq ($(findstring MINGW64,$(uname)),)
+      TARGET_ARCH := x86_64
+   else
       TARGET_ARCH = $(shell uname -m)
     endif
   endif
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain

Postby coderJeff » Aug 29, 2019 21:33

Thanks, srvaldez. No, I wasn't aware. Probably because I never use msys2 while developing. Only 'bash' or 'sh' from a windows cmd.exe shell.

I will put it on my TODO list to test; which is actually a pad of paper beside my computer. Yes, old school analog of pen & paper is how I track the important stuff. lol.

Optionally, really for anyone that is interested, is to create a bug report to record any issues. That way it is on record and doesn't get forgotten or lost in the forums. Also, it's nice to use the ticket # to track the issue, put in the changelog.txt, etc.

Better yet, in addition to the bug report, if somebody can test it for themseves, and make a pull request to merge in to the development tree, that effort helps everybody.
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain

Postby coderJeff » Sep 08, 2019 14:07

@srvaldez, I've added the makefile patch to current fbc/master, with this note:

Code: Select all

    # For MSYS2, use default compilers (uname -m returns MSYS2's shell
    #  architecture).  For example, from win 7:
    #
    # host    shell    uname -s -m              default gcc target
    # ------  -------  --------------------     ------------------
    # msys32  msys2    MSYS_NT-6.1-WOW i686     n/a
    # msys32  mingw32  MINGW32_NT-6.1-WOW i686  i686-w64-mingw32
    # msys32  mingw64  MINGW64_NT-6.1-WOW i686  x86_64-w64-mingw32
    # msys64  msys2    MSYS_NT-6.1 x86_64       n/a
    # msys64  mingw32  MINGW32_NT-6.1 x86_64    i686-w64-mingw32
    # msys64  mingw64  MINGW64_NT-6.1 x86_64    x86_64-w64-mingw32


I didn't notice the issue before because I typically don't use the shells, just cmd.exe with PATH set up for each environment. And typically using msys32/mingw32 or msys64/mingw64 only.

Thanks for making me aware of the patch.
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain (Equation tool chain)

Postby coderJeff » Sep 08, 2019 14:42

I downloaded and installed the 6 packages to have a look. Some interesting things to note.

All 6 packages:
- use binutils 2.27
- have identical ./include/*.h files

For targets:

Code: Select all

gcc       default target      other targets
--------  ------------------  ----------------
7.4.0-32  i686-pc-mingw32     n/a
7.4.0-32  i686-pc-mingw32     n/a
8.3.0-32  i686-pc-mingw32     n/a
8.3.0-64  x86_64-w64-mingw32  i686-w64-mingw32
9.2.0-64  x86_64-w64-mingw32  i686-w64-mingw32
9.2.0-64  x86_64-w64-mingw32  i686-w64-mingw32


I'm not certain, but looks like 32 bit versions are for mingw (the original), both host and target. And 64 bit versions for 64 bit host, default 64 bit target, but can cross to 32 bit. Overall 6 packages, compiling for 9 different environments (i.e. should not mix linking objects compiled on different tool chains / targets ).
srvaldez
Posts: 2104
Joined: Sep 25, 2005 21:54

Re: new mingw toolchain (Equation tool chain)

Postby srvaldez » Sep 08, 2019 15:44

@coderjeff
thank you for your continuing work on improving FB.
to tell the truth, I was not planing to post on this forum again, way too embarrassed, nevertheless, here I am.
I am a beginner programmer, and publishing FB builds is simply out of my league, you might call me a script kiddie -- without the hack, just run the make script.
regarding bintools, msys2 was able to build the latest version without the binaries having any mingw dll dependencies, gdb builds ok in 32-bit but can't figure out how to build a 64-bit version without some unwanted mingw dll dependencies.
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain (Equation tool chain)

Postby coderJeff » Sep 08, 2019 16:53

I'm glad you posted again, and I hope you continue to do so. At least you made the attempt, and I respect your courage for sharing the result. And that's important to recognize; that we have a result, and new information is learned. So, I hope you stay interested.

I'm no expert. I've just been at this longer than most users. I haven't actually tried a build with these compilers yet, so I don't know what problems are yet to be faced, and maybe I have no idea how to solve. Hopefully my comments help you to keep going with it.

I guess the first thing to get sorted is what environment you are working on, and what environment you are targeting. And be specific about it. It can be confusing on win 7-64 bit because it will run both 32 bit and 64 bit. mingw-w64 has compilers for both 32 bit and 64 bit. And they can cross compile to the other, either 64 bit or 32 bit. msys2 has multiple shells, each with a different (default) purpose. And finally, there is also what I call mingworg, which is the old 32-bit only mingw that predates mingw-w64.

I noticed in your building fbc for beginners you used msys2/mingw32 and msys2/mingw64 shells. That's good, as I think the msys2/msys2 shell is only for building supporting packages for msys2 itself; like the unix-y backend stuff.

I guess, make sure you are starting off with a msys64/mingw64 shell, or optionally c:\msys64\usr\bin\sh.exe.

For gdb, probably need to at least './configure --enable-static' and there may be other features that have to be disabled depending on the gdb version. Sorry, it's been a while since I've built gdb, so I don't know from memory.
deltarho[1859]
Posts: 2003
Joined: Jan 02, 2017 0:34
Location: UK

Re: new mingw toolchain (Equation tool chain)

Postby deltarho[1859] » Sep 08, 2019 19:16

srvaldez wrote:to tell the truth, I was not planing to post on this forum again, way too embarrassed, nevertheless, here I am.

Believe it or not I actually figured that.

You may have missed this but the post immediately following your comment "at this point I don't recommend any of my builds" I wrote "Kudos to you my friend for the effort so far - keep up the good work. Image".

It was your efforts that got me thinking about SetCompilerPaths.exe. I knew early on that with WinFBE we could only use it if WinFBE was not running. I was convinced that it would work if posesidonFB was running and the poseidonFB thread was originally written based upon that conviction. Eventually, I realized that I was wrong and had to rewrite the poseidonFB's thread's opening post. That was embarrassing but, like you, I had to come clean and fast.

I then contacted both authors. PaulSquires accepted my idea and changed WinFBE to accommodate it. Kuan Hsu also accepted my idea but came up with his solution. The upshot is that both WinFBE and poseidonFB will now allow us to change compiler paths 'on the fly'.

OK I wrote SetCompilerPaths but that is a result of your work looking into different compiler builds.

coderJeff became interested in what you and I were doing and, specifically, what you were doing. In the thread 'ST_W builds' coderJeff has just written "I'm working on a 1.07.1 release to provide an "official" starting point for multiple gcc packages.". I am sure that coderJeff will agree that he is taking this path as a result of your work looking into different compiler builds.

FreeBASIC has some very exciting times ahead and when we look back at what started it all it will be down to you - how embarrassing is that? Image
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain

Postby coderJeff » Oct 06, 2019 21:48

srvaldez wrote:[edit] about the new mingw distribution, one has to install it for the files to be properly decompressed, I tried extracting the files with 7-zip but it din't work.


After extracting the files from the .exe with 7z, all of the files in ./source are actually still compressed with bzip2 compression. So each file has to be decompressed using 7z again, or bzip2. I'm trying to work on a script to do it but 7z and/or bzip2 are not dealing well with the filename as-is.
srvaldez
Posts: 2104
Joined: Sep 25, 2005 21:54

Re: new mingw toolchain (Equation tool chain)

Postby srvaldez » Oct 06, 2019 22:28

Hi coderJeff
I also tried to extract the files with 7zip but when I saw that extraction had failed I simply ran the installer and then moved the files.
remember that the make command failed on me with permission problems when trying to write to a file, so I replaced it with the one from msys2, also ffi.h and friends are not where the FB makefile can find them, I simply compiled the latest ffi and copied to msys64\mingw32\i686-pc-mingw32 and msys64\mingw64\x86_64-w64-mingw32
coderJeff
Site Admin
Posts: 3061
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: new mingw toolchain (Equation tool chain)

Postby coderJeff » Oct 11, 2019 23:06

OK, we probably need to look a little closer at your msys* & mingw* set-ups. When building the release package, even from sources, should not need to install anything in your host environment.

When building a release package, There are a couple of objectives I have in mind:
- download (or cache) original binary packages from original locations
- unpack packages in a separate build directory (initially empty at start of build)
- try not to touch any files on the host computer (i.e. do not link to host installed libraries).
- batch/script so that process is repeatable (i.e. none or very few manual steps)
- msys, or bash, or sh, should only be needed to run the scripts, invoke make, provide some standard unix tools for the build.

----
I looked at the equation installer packages and originally I installed all six packages:
- no unattended install, must click to continue (maybe there is a command line option to override this).
- no uninstaller
- makes changes to registry
- directories automatically added to my system PATH environment variable (all six packages added to PATH)
- addition of EQ_LIBRARY_PATH system environment variable (all six packages are added to this one variable)

So to script this, I really want just a normal 7z archive. And I don't want an installer to mess with any settings (registry) on my computer. I created a script to help with that:
repack-eq-gcc.sh
This script will download all the EXE's and repack as 7z archives. If you already have the EXE's, can just copy them to the 'cache' directory.
The archive's are about 30% smaller after repacking as normal 7z.

That's about as far as I got for now. Next will be to build a fresh fbc with the toolchain. Keeping in mind that the 32-bit versions appear to be mingw (org), and the 64-bit version appears to be mingw-w64, with option to cross compile to 32-bit. The Equation tools chains seem to be like a stand alone version, so will need to investigate there a little more as well.
srvaldez
Posts: 2104
Joined: Sep 25, 2005 21:54

Re: new mingw toolchain (Equation tool chain)

Postby srvaldez » Oct 13, 2019 10:33

@coderJeff
thank you for the detailed information and the script :-)

Return to “Windows”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 20 guests