Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMD64_MINGW build looks for AMD64_NT exports files #1029

Open
ahribellah opened this issue May 29, 2022 · 26 comments
Open

AMD64_MINGW build looks for AMD64_NT exports files #1029

ahribellah opened this issue May 29, 2022 · 26 comments

Comments

@ahribellah
Copy link

ahribellah commented May 29, 2022

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
Copy link
Author

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
Copy link
Contributor

VictorMiasnikov commented Jun 2, 2022

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
Copy link
Contributor

VictorMiasnikov commented Jun 2, 2022

(

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
Copy link
Author

ahribellah commented Jun 3, 2022

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
Copy link
Contributor

VictorMiasnikov commented Jun 4, 2022 via email

@VictorMiasnikov
Copy link
Contributor

VictorMiasnikov commented Jun 4, 2022 via email

@VictorMiasnikov
Copy link
Contributor

VictorMiasnikov commented Jun 4, 2022 via email

@ahribellah
Copy link
Author

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.

@ahribellah
Copy link
Author

@VictorMiasnikov
Copy link
Contributor

VictorMiasnikov commented Jun 7, 2022

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
Copy link
Contributor

VictorMiasnikov commented Jun 7, 2022

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
Copy link
Contributor

VictorMiasnikov commented Jun 7, 2022

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
Copy link
Contributor

jaykrell commented Jun 7, 2022

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

@VictorMiasnikov
Copy link
Contributor

VictorMiasnikov commented Jun 7, 2022 via email

@ahribellah
Copy link
Author

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
Copy link
Contributor

VictorMiasnikov commented Jun 7, 2022 via email

@VictorMiasnikov
Copy link
Contributor

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@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

replaced

by

cm3-min-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-37__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z

b)
File

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

replaced

by

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-37__16bit__Unicode__AMD64_MINGW__Target__cm3-69f22c9.7z

@ahribellah
Copy link
Author

ahribellah commented Jun 10, 2022

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
Copy link
Contributor

VictorMiasnikov commented Jun 11, 2022 via email

@VictorMiasnikov
Copy link
Contributor

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
Copy link

jpgpng commented Aug 18, 2022

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
Copy link
Contributor

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 #1040

@VictorMiasnikov
Copy link
Contributor

cm3 AMD64_CYGWIN affected too

This was referenced Aug 31, 2022
@jpgpng
Copy link

jpgpng commented Sep 8, 2022

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

@VictorMiasnikov
Copy link
Contributor

VictorMiasnikov commented Sep 8, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants