modula3 / cm3

Critical Mass Modula-3
http://modula3.github.io/cm3/
Other
134 stars 25 forks source link

AMD64_MINGW build looks for AMD64_NT exports files #1029

Open ahribellah opened 2 years ago

ahribellah commented 2 years ago

I just built the AMD64_MINGW version in MSYS2 using the latest release, cm3-boot-AMD64_NT-d5.11.4.7z (which says that it is meant to be used for both AMD64_NT and AMD64_MINGW builds). I followed the build process used in CI and added install/cm3/bin to PATH.

When I go to the hello example's directory and run cm3 to build, I get the following error, indicating that it's still looking for AMD64_NT source files:

ari@DESKTOP-1ER5E33 MINGW64 ~/Code/cm3/examples/hello/src
$ cm3
--- building in ..\AMD64_NT ---

"D:\Applications\msys64\home\ari\Code\cm3\examples\hello\src\m3makefile", line 15: quake runtime error: unable to open "D:\Applications\msys64\home\ari\Code\cm3\install\cm3\pkg\libm3\AMD64_NT\.M3EXPORTS" for reading

--procedure--  -line-  -file---
import             --  <builtin>
include_dir        15  D:\Applications\msys64\home\ari\Code\cm3\examples\hello\src\m3makefile
                    4  D:\Applications\msys64\home\ari\Code\cm3\examples\hello\AMD64_NT\m3make.args

Fatal Error: package build failed

When I go to any of the libraries in install/cm3/pkg, I only see src and AMD64_MINGW folders, as expected. When I check cm3.cfg, this is what I see:

readonly M3_BACKEND_MODE = "C"
if not defined("SL") SL = "/" end
if not defined("HOST") HOST = "AMD64_MINGW" end
if not defined("TARGET") TARGET = HOST end
INSTALL_ROOT = (path() & SL & "..")
include(path() & SL & "config" & SL & TARGET)

EDIT: I forgot to include my cm3 --help output, so here it is.

Critical Mass Modula-3 version d5.11.4
  GitInfo: unknown
  last updated: 2021-10-07
  compiled: 2022-05-29 14:11:42
  configuration: D:\Applications\msys64\home\ari\Code\cm3\install\cm3\bin\cm3.cfg
  host: AMD64_NT
  target: AMD64_MINGW
ahribellah commented 2 years ago

Okay, I've figured out what went wrong and I am leaving the issue open because I would assume that this is not the intended behavior.

Using the default config that comes with the distribution, it looks for AMD64_NT libraries when it should be looking for AMD64_MINGW libraries.

Changing the following line...

if not defined("HOST") HOST = "AMD64_MINGW" end

...to...

HOST = "AMD64_MINGW"

...does not fix the issue. Despite the host now explicitly being set to AMD64_MINGW, whereas the target was always AMD64_MINGW, the host is still being reported as AMD64_NT and builds still report the following message:

--- building in ..\AMD64_NT ---

It wasn't until I changed the following two lines...

if not defined("HOST") HOST = "AMD64_MINGW" end
if not defined("TARGET") TARGET = HOST end

...to...

HOST = "AMD64_MINGW"
TARGET = HOST

...that cm3 started building AMD64_MINGW builds, reporting the following message:

--- building in ..\AMD64_MINGW ---

Despite that, the host is still being reported as AMD64_NT. I am unsure whether this is intentional.

VictorMiasnikov commented 2 years ago

latest release, cm3-boot-AMD64_NT-d5.11.4.7z

It is not latest.

The latest is: https://github.com/VictorMiasnikov/cm3/releases/tag/d5.11.9-ZZYYXX-20220208_13-48

P.S. To All: Please, see my message at "24.05.2022, 13:39" with subject contain "Modula-3 on Github 2) GITHub Action as CI/CD"

P.S. HowTo will be ( and this already done) in next comment

VictorMiasnikov commented 2 years ago

(

release, cm3-boot-AMD64_NT-d5.11.4.7z (which says that it is meant to be used for both AMD64_NT and AMD64_MINGW builds).

At this moment I does not even try bootstrapping from cm3-boot-AMD64_NT-d5.11.4.7z and cm3-boot-AMD64_NT-d5.11.9.7z

But cm3-boot-AMD64_LINUX-d5.11.9.7z is good for Debian

)

At first try this:

https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-all-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z

and write result here.

Thank!

P.S.

If it's need, then I can write algorithm how to create:

https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-boot-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z

and later create step by step "cm3-all*.7z"

ahribellah commented 2 years ago

Sorry, I didn't realize there was a fork with a more updated version. Maybe that should be mentioned in the README.

As for the result, I tried the cm3-all-AMD64_MINGW... binaries (literally just renamed the old folder and replaced it) and it's throwing the same error. It will not build for the right target unless the following is in cm3.cfg:

HOST = "AMD64_MINGW"
TARGET = HOST
VictorMiasnikov commented 2 years ago

( I write short, because write from smartphone. )

I am not sure that my releases are "fork": -- I'm always return source code ( and configs) to "master branch" as P. request(s); -- I prefer / "love" compile modern commit[s] with minimal absolutely needed changed for test both "pure source code on M3 , C language and C++" and "build scripts".

( I send this part of answer and continue writing in next part) + ( Part number 2. I will be do some editing on Monday, I hope... )

should be mentioned in the README

Oh, yes: sorry. It's because that AMD64_MINGW is most young target.

In fact i386_DJGPP is "return M3 to OS DOS"

Even name AMD64_MINGW was be result of big discussion.

May be best name is AMD64_NT_GCC, etc

( to be continued...)

04.06.2022, 00:26, "Ari" @.***>: Just got around to this. Sorry, I didn't realize there was a fork with a more updated version. Maybe that should be mentioned in the README. As for the results, it's exactly the same. It will not build for the right target unless the following is in cm3.cfg: HOST = "AMD64_MINGW" TARGET = HOST

VictorMiasnikov commented 2 years ago

= = =

As for the results, it's exactly the same. It will not build for the right target unless the following is in cm3.cfg: HOST = "AMD64_MINGW" TARGET = HOST = = =

There is special .py script for creating cm3.cfg I will send its name on Monday

In phrase AMD64_MINGW first part is name of CPU architecture ( i.e. Intel / AMD 64bit a-ka x64)

Second part , usual, is name of Operating System ( OS). In any case our OS is NT ( NT family)

"MINGW" in fact is short form of " NT_GCC".

This short variant is best for using in .sh / .bat , .cmd and Python scripts

I write all this as historic info -)

( to be continued...)

04.06.2022, 00:26, "Ari" @.***>: Just got around to this. Sorry, I didn't realize there was a fork with a more updated version. Maybe that should be mentioned in the README. As for the results, it's exactly the same. It will not build for the right target unless the following is in cm3.cfg: HOST = "AMD64_MINGW" TARGET = HOST

VictorMiasnikov commented 2 years ago

Ok: let's go to "practical things"

As I understood, You have good and worked "Modula-3 AMD64_MINGW" ?

Even 5.11.4 is good for 64bit targets. Version 5.11.9 is better variant for 32bit targets and for debugging with m3gdb on AMD64_LINUX.

( There is finally sub-message of weekend series -) )

04.06.2022, 00:26, "Ari" @.***>: Just got around to this. Sorry, I didn't realize there was a fork with a more updated version. Maybe that should be mentioned in the README. As for the results, it's exactly the same. It will not build for the right target unless the following is in cm3.cfg: HOST = "AMD64_MINGW" TARGET = HOST

ahribellah commented 2 years ago

AMD64_MINGW is working...but only if I make the config change I mentioned above.

I have not had a working AMD64_MINGW version before. I didn't need it previously, but I recently discovered an issue with my Visual Studio install that I have as yet been unable to fix, so I have to use the AMD64_MINGW version for now.

I don't think that the .py script is the issue. The issue is that the compiler doesn't seem to be setting the proper build environment by default and I can only get the proper build environment by making the aforementioned configuration changes.

So the problem is thus: even though cm3 --help reports by default that the target is AMD64_MINGW, it continues to look for AMD64_NT libraries (the host) unless you explicitly tell it to set both to AMD64_MINGW.

There is then the further problem that the reported host does not change, even when explicitly set to a different setting.

VictorMiasnikov commented 2 years ago

Let go "step by step"

Step N1: choice source code

This commit: https://github.com/VictorMiasnikov/cm3/commit/69f22c9a199e80db8fc5cbdb2609923e8bb6ec2a are good?

Step N2:

We can use

https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-all-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z

( or cm3-min-AMD64_MINGW-* )

or start compiling from https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-boot-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z ?

Or create even cm3-boot-AMD64_MINGW* "from scratch"?

ahribellah commented 2 years ago

I have not built...

Step N1: choice source code

This commit: VictorMiasnikov@69f22c9 are good?

...or...

or start compiling from https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-boot-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z ?

...but....

https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-all-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z

...and the AMD64_NT version of 5.11.4 both have the issue. You said that AMD64_MINGW is the newest target. Perhaps there was simply some small switch that was missed when adding it.

Have you run the same builds on your end?

VictorMiasnikov commented 2 years ago

Have you run the same builds on your end?

Yes, I have even 2 or more:

Y:\ZZZZZZZ\Modula-3\ZZ v5.11.4-ZZYYXX-20211101_22-02 Era VVM--.--\ZZ v5.11.4-AMD64_MINGW\ZZ v5.11.4-MINGW64 _ _ gcc-10.3.0-2 _ _ 16bit-Unicode _ _ AMD64_MINGW\
     03.11.2021│     77489932│   A      │cm3-all-AMD64_MINGW-d5.11.4-MINGW64(git-sdk-64@53940e3_and_{{mingw-w64-x86_64-gcc-10.3.0-2}})-2021-11-01_22-02__FIXed__by__VVM__2021-11-02_14-16__16bit__Unicod
     02.11.2021│     <Folder>│          │._ -JL- -Ok!- 16bit Unicode cm3 cm3-all-AMD64_MINGW-d5.11.4-MINGW64(git-sdk-64@53940e3_and_{{mingw-w64-x86_64-gcc-10.3.0-2}})-2021-11-01_22-02 FIXed by VVM 202
───────────────┴─────────────┴──────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Y:\ZZZZZZZ\Modula-3\ZZ v5.11.4-ZZYYXX-20211215_07-28 Era VVM P- Big\ZZ v5.11.4-AMD64_MINGW P- Big\ZZ v5.11.4-MINGW64 _ _ gcc-10.3.0-2 _ _ 16bit-Unicode _ _ AMD64_MINGW P- Big\S
     17.12.2021│     77564108│   A      │-Ok!- cm3 16bit Unicode cm3-all-AMD64_MINGW-d5.11.4-MINGW64(git-sdk-64@53940e3_and_{{mingw-w64-x86_64-gcc-10.3.0-2}})-2021-12-15_07-28 FIXed by VVM 2021-12-17

But we can switch to modern 5.11.9:

https://github.com/VictorMiasnikov/cm3/releases/download/d5.11.9-ZZYYXX-20220208_13-48/cm3-all-AMD64_MINGW-d5.11.9-MINGW64.git-sdk-64@53940e3_and_.mingw-w64-x86_64-gcc-10.3.0-2.-2022-02-08_13-48__FIXed__by__VVM__2022-05-11_12-35__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z ...and the AMD64_NT version of 5.11.4 both have the issue.

Let do it ( switch): I going to compile Hello.exe ( Hello World)

Perhaps there was simply some small switch that was missed when adding it.

I think, yes

VictorMiasnikov commented 2 years ago

Yes, You are right.

And, yes -- this is right fix:

==
--- cm3.cfg 000    Wed May 11 15:03:19 2022
+++ cm3.cfg    Tue Jun 07 11:58:09 2022
@@ -5,7 +5,7 @@
 if not defined("M3_PROFILING") M3_PROFILING = FALSE end
 if not defined("SL") SL = "/" end
 %-------------------------------------------------------------------
-if not defined("HOST") HOST = "AMD64_MINGW" end
-if not defined("TARGET") TARGET = HOST end
+HOST = "AMD64_MINGW"
+TARGET = HOST
 INSTALL_ROOT = (path() & SL & "..")
 include(path() & SL & "config" & SL & TARGET)
==

P.S. But description of problem, looks like, is not good. We will be change it...

VictorMiasnikov commented 2 years ago

Description of problem:

We are should change cm3.cfg for build Hello.exe in case of AMD64_MINGW target:

--- cm3.cfg 000 Wed May 11 15:03:19 2022
+++ cm3.cfg Tue Jun 07 11:58:09 2022
@@ -5,7 +5,7 @@
 if not defined("M3_PROFILING") M3_PROFILING = FALSE end
 if not defined("SL") SL = "/" end
 %-------------------------------------------------------------------
-if not defined("HOST") HOST = "AMD64_MINGW" end
-if not defined("TARGET") TARGET = HOST end
+HOST = "AMD64_MINGW"
+TARGET = HOST
 INSTALL_ROOT = (path() & SL & "..")
 include(path() & SL & "config" & SL & TARGET)

Diff of build logs:

==
--- Var for Diff cm3 }} -- {{ issues }} -- {{ 1029 C_-- AMD64_NT Error readme.txt   Tue Jun 07 13:52:17 2022
+++ Var for Diff cm3 }} -- {{ issues }} -- {{ 1029 C_-- AMD64_NT Error readme.txt after FIX readme.txt  Tue Jun 07 13:53:46 2022
@@ -27,16 +27,12 @@

 user1@TestComp MINGW64 /usr/local/cm3/src/examples/hello (d5.11.9-ZZYYXX-20220208_13-48)
 $ cm3
---- building in AMD64_NT ---
+--- building in AMD64_MINGW ---

-"D:\git-sdk-64\usr\local\cm3\src\examples\hello\src\m3makefile", line 15: quake runtime error: unable to open "D:\git-sdk-64\usr\local\cm3\pkg\libm3\AMD64_NT\.M3EXPORTS" for reading
-
---procedure--  -line-  -file---
-import             --  <builtin>
-include_dir        15  D:\git-sdk-64\usr\local\cm3\src\examples\hello\src\m3makefile
-                    4  D:\git-sdk-64\usr\local\cm3\src\examples\hello\AMD64_NT\m3make.args
-
-Fatal Error: package build failed
+new source -> compiling Hello.m3
+****  PARALLEL BACK-END BUILD, M3_PARALLEL_BACK = 20
+ -> linking hello.exe
+x86_64-w64-mingw32-g++ -o hello  @C:\Users\ADMINI~1\AppData\Local\Temp\2\qk

 user1@TestComp MINGW64 /usr/local/cm3/src/examples/hello (d5.11.9-ZZYYXX-20220208_13-48)
 $
==

In both cases output of cm3 -version still equal:

$ cm3 -version
Critical Mass Modula-3 version d5.11.9
     . . .
  host: AMD64_NT
  target: AMD64_MINGW
jaykrell commented 2 years ago

Try leaving HOST alone and just set TARGET: TARGET = "AMD64_MINGW" which "setup" should do.

VictorMiasnikov commented 2 years ago

( I again on smartphone...)

J.K.} Try leaving HOST alone and just set TARGET: J.K.} TARGET = "AMD64_MINGW" J.K.} which "setup" should do. There is "should do" or "it is really worked methodology" ?

I was built cm3 5.11.9 and even was not built anyone component ( Hello.exe for example) by "running cm3.exe" ;-( It my first "organizational mistake".

And I think that issue related building cm3 by convergence.py ( In fact Issue is not related ).

Ok: I send this message "as is"

07.06.2022, 19:20, "Jay Krell" @.***>:

ahribellah commented 2 years ago

Try leaving HOST alone and just set TARGET: TARGET = "AMD64_MINGW" which "setup" should do.

I already did that. It doesn't work. The target is already reported as AMD64_MINGW, but it will only attempt to build for AMD64_NT unless the above changes are made.

VictorMiasnikov commented 2 years ago

J.K.}} J.K.}} Try leaving HOST alone and just set TARGET: TARGET = "AMD64_MINGW" which "setup" should do. J.K.}} `

I already did that. It doesn't work. The target is already reported as AMD64_MINGW, but it will only attempt to build for AMD64_NT unless the above changes are made.

There is very interesting info. ( Really) It's important part of "description of problem".

"07.06.2022, 20:46, "Ari" @.***>:

VictorMiasnikov commented 2 years ago

2022-06-08: Inside https://github.com/VictorMiasnikov/cm3/releases/tag/d5.11.9-ZZYYXX-20220208_13-48

a) File

cm3-min-AMD64_MINGW-d5.11.9-MINGW64(git-sdk-64@53940e3and{{mingw-w64-x86_64-gcc-10.3.0-2}})-2022-02-08_13-48FIXedbyVVM2022-05-11_12-3516bitUnicode__AMD64_MINGWTargetcm3-69f22c9.7z

replaced

by

cm3-min-AMD64_MINGW-d5.11.9-MINGW64(git-sdk-64@53940e3and{{mingw-w64-x86_64-gcc-10.3.0-2}})-2022-02-08_13-48FIXedbyVVM2022-05-11_12-3716bitUnicode__AMD64_MINGWTargetcm3-69f22c9.7z

b) File

cm3-all-AMD64_MINGW-d5.11.9-MINGW64(git-sdk-64@53940e3and{{mingw-w64-x86_64-gcc-10.3.0-2}})-2022-02-08_13-48FIXedbyVVM2022-05-11_12-3516bitUnicode__AMD64_MINGWTargetcm3-69f22c9.7z

replaced

by

cm3-all-AMD64_MINGW-d5.11.9-MINGW64(git-sdk-64@53940e3and{{mingw-w64-x86_64-gcc-10.3.0-2}})-2022-02-08_13-48FIXedbyVVM2022-05-11_12-3716bitUnicode__AMD64_MINGWTargetcm3-69f22c9.7z

ahribellah commented 2 years ago

So, looking at the updated distribution, your "fix" is to just change the config file? That doesn't fix the underlying problem that is that it is, by default, reporting that the target is AMD64_MINGW, but building for AMD64_NT. Whether or not the config file change allows it to function, something is still fundamentally broken (at least when built using MinGW-w64) about the way that the system is either a) reporting the target or b) choosing which target to build for.

I'm personally leaning towards a, as changing the HOST in cm3.cfg doesn't appear to change the reported host either.

VictorMiasnikov commented 2 years ago

} your "fix" is to just change the config file?

Yes, You are right.

It's "quick fix".

In any key if we change source code then should create new binary release of cm3.

( I on smartphone, send as is)

10.06.2022, 21:34, "Ari" @.***>: So, looking at the updated distribution, your "fix" is to just change the config file? That doesn't fix the underlying problem that is that it is, by default, reporting that the target is AMD64_MINGW, but building for AMD64_NT. Whether or not the config file change allows it to function, something is still fundamentally broken about the way that the system is either a) reporting the target or b) choosing which target to build for. I'm personally leaning towards a, as changing the HOST in cm3.cfg doesn't appear to change the reported host either.

VictorMiasnikov commented 2 years ago

I386_MINGW affected too:

--- cm3.cfg I386_MINGW 2022-06-15_18-47.log Tue Jun 21 12:52:31 2022
+++ cm3.cfg.log Tue Jun 21 12:52:23 2022
@@ -4,15 +4,12 @@

 User@TestComp MINGW32 /usr/local/cm3/cm3/examples/hello (d5.11.9-ZZYYXX-20220208_13-48)
 $ cm3
---- building in I386_NT ---
+--- building in I386_MINGW ---

-"D:\git-sdk-64\usr\local\cm3\cm3\examples\hello\src\m3makefile", line 15: quake runtime error: unable to open "D:\git-sdk-64\usr\local\cm3\pkg\libm3\I386_NT\.M3EXPORTS" for reading
-
---procedure--  -line-  -file---
-import             --  <builtin>
-include_dir        15  D:\git-sdk-64\usr\local\cm3\cm3\examples\hello\src\m3makefile
-                    4  D:\git-sdk-64\usr\local\cm3\cm3\examples\hello\I386_NT\m3make.args
-
-Fatal Error: package build failed
+new source -> compiling Hello.m3
+****  PARALLEL BACK-END BUILD, M3_PARALLEL_BACK = 20
+ -> linking hello.exe
+i686-w64-mingw32-g++ -o hello  @C:\Users\User~1\AppData\Local\Temp\2\qk

 User@TestComp MINGW32 /usr/local/cm3/cm3/examples/hello (d5.11.9-ZZYYXX-20220208_13-48)
+$
jpgpng commented 2 years ago

I suffered from the same error. My solution is also manually edit cm3.cfg. This is my version:

readonly M3_BACKEND_MODE = "C"
if not defined("SL") SL = "/" end
HOST = "AMD64_MINGW"
TARGET = HOST
INSTALL_ROOT = (path() & SL & "..")
include(path() & SL & "config" & SL & TARGET)
VictorMiasnikov commented 2 years ago

I suffered from the same error. My solution is also manually edit cm3.cfg. This is my version:

readonly M3_BACKEND_MODE = "C"
if not defined("SL") SL = "/" end
HOST = "AMD64_MINGW"
TARGET = HOST
INSTALL_ROOT = (path() & SL & "..")
include(path() & SL & "config" & SL & TARGET)

Please see https://github.com/modula3/cm3/issues/1040

VictorMiasnikov commented 2 years ago

cm3 AMD64_CYGWIN affected too

jpgpng commented 2 years ago

@VictorMiasnikov It's something related to MxConfig but I have no idea where is MxConfig defined to investigate further.

VictorMiasnikov commented 2 years ago

File cm3.cfg has been generated by one of .py scripts. IMHO, best way edit this .py script. ( I am on smartphone)

08.09.2022, 04:45, "jpgpng" @.***>: @VictorMiasnikov It's something related to MxConfig but I have no idea where is MxConfig defined to investigate further.