LADSoft / OrangeC

OrangeC Compiler And Tool Chain
http://ladsoft.tripod.com/orange_c_compiler.html
Other
291 stars 39 forks source link

How to debug omake? #904

Closed ghost closed 1 year ago

ghost commented 1 year ago

I want to help debugging omake. As you said you are running Windows 11, it's very likely something changed on Windows 11 that is no longer compatible with older Windows and caused the instability of omake. But first, omake has to let me debug it instead of printing a useless stack trace. It crashed silently without triggering a omake.exe has stopped working window.

chuggafan commented 1 year ago

Try using a debug build, if you have the repository downloaded you can run the executable via visual studio or compile with the /DDEBUG=YES command, or if you're fiesty run the DEBUGcompiles.bat script.

Personally I also use:

:: This is to allow for one to quickly set up the development environment for OrangeC
:: This consists of: bringing up the MSVC compiler, adding OrangeC's bin to the path
:: and setting the path of OrangeC so that some tools can find it
:: this batch file is used only because the MSVC tools on windows aren't always
:: available to use from the get-go, so we must instantiate them
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"
SET PATH=%PATH%;C:\OrangeC\bin
set ORANGEC=c:\ORANGEC

as a batch script before I attempt to compile on the command line in order to ensure that I have everything correct.

ghost commented 1 year ago

I'm using Windows 8.1 64 bit so very unfortunately I can't install Visual Studio.

chuggafan commented 1 year ago

As far as I'm aware Visual Studio 2019 can be used on Windows 8.1 and we still (should) be able to be compiled on Visual Studio 2019. I know in general we use VS2022 now but it's easy enough to change that script to point to the VS2019 install (IIRC It's just make it Program Files (x86) and 2019.

GitMensch commented 1 year ago

You can get vs2019 from https://visualstudio.microsoft.com/de/vs/older-downloads/, take either the community version (for use with this free software project) or the build tools.

Note that when you use the build tools, then debug with WinDbg.

LADSoft commented 1 year ago

@iahunq:

thank you for your offer to look at it.

bear in mind the build of OCC you get out of the appveyor (or out of the 'releases') is itself compiled with OCC... that is why there isn't any real debug info. So yeah you need either an older version of Visual Studio that will run on 8.1 and give you debug info, or you need to compile with GCC or some other compiler and debug using the existing tools for that compiler chain.

MINGW32-MAKE compiles the existing makefile (in orangec/src) just fine, as does the make on linux, so, a way to do it without VS especially if you are familiar with gcc is just to compile it with gcc and then run gdb using MINGW32-MAKE to build it.

if on windows or in msys2 the compile is easily done with the existing makefile:

mingw32-make -DCOMPILER=MINGW64

but that doesn't give you debug info. but it is easy enough to add -g to the compiler command line...

ghost commented 1 year ago

@LADSoft The correct command would be mingw32-make COMPILER=MINGW64 since mingw32-make doesn't understand -D and the most important is I have to change into the src directory for this command to work. Btw, this command might not be what I wanted. I consulted BUILD.md and tried mingw32-make COMPILER=MINGW64 fullbuild and mingw32-make COMPILER=MINGW64 exebuild but both failed.

chuggafan commented 1 year ago

I consulted BUILD.md and tried mingw32-make COMPILER=MINGW64 fullbuild and mingw32-make COMPILER=MINGW64 exebuild but both failed.

Can you post the build failures in a different issue? I know that our appveyor builds for mingw32 are currently succeeding (seealso: the most recent full success build we had), and that most of our "failing" builds are actually successes with timeouts. It would be helpful to just dump the output into a file and go from there, you might have a gcc that's 64 bit installed and no 32 bit gcc and that could cause this issue.

ghost commented 1 year ago

I consulted BUILD.md and tried mingw32-make COMPILER=MINGW64 fullbuild and mingw32-make COMPILER=MINGW64 exebuild but both failed.

Can you post the build failures in a different issue? I know that our appveyor builds for mingw32 are currently succeeding (seealso: the most recent full success build we had), and that most of our "failing" builds are actually successes with timeouts. It would be helpful to just dump the output into a file and go from there, you might have a gcc that's 64 bit installed and no 32 bit gcc and that could cause this issue.

The errors are from mingw32-make. The makefiles are for omake and not fully compatible with mingw32-make.

@LADSoft Please have a look at treetop.mak for compatibility with mingw32-make.

$ mingw32-make COMPILER=MINGW64 fullbuild
mingw32-make[1]: Entering directory 'C:/msys64/home/Administrator/OrangeC/src'
del /Q C:\msys64\home\Administrator\OrangeC\src\..\bin\*.pdb 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\.. 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:182: cleanDISTRIBUTE] Error 1 (ignored)
mkdir C:\msys64\home\Administrator\OrangeC\src\..\bin 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:183: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\bin 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\help 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:185: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\help 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:187: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:189: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\support 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:191: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\support 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\support\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:193: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\support\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c\sys 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:195: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c\sys 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\sys 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:198: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:200: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:202: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\config 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:204: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\config 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\debug 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:206: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\debug 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\pointers 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:208: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\pointers 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\using 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:210: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\using 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stl 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:212: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stl 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:215: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\msdos 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:217: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\msdos 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:219: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\addon 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:221: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\addon 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:223: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\msdos 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:225: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\msdos 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\system 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:227: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\system 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\c\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:229: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\c\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\atc 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:232: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\atc 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\listview 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:234: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\listview 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\xmlview 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:236: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\xmlview 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\RCDemo 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:238: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\RCDemo 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\huff 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:240: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\huff 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\dist 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:242: cleanDISTRIBUTE] Error 1 (ignored)
C:/msys64/mingw64/bin/mingw32-make.exe DISTRIBUTE
mingw32-make[2]: Entering directory 'C:/msys64/home/Administrator/OrangeC/src'
C:/msys64/home/Administrator/OrangeC/src/copydir.exe examples\%.% C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
No filesmingw32-make[2]: *** [makefile:126: DISTRIBUTE] Error 1
mingw32-make[2]: Leaving directory 'C:/msys64/home/Administrator/OrangeC/src'
mingw32-make[1]: *** [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:321: distribute_self] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/Administrator/OrangeC/src'
mingw32-make: *** [makefile:104: fullbuild] Error 2
$ mingw32-make COMPILER=MINGW64 exebuild
mingw32-make[1]: Entering directory 'C:/msys64/home/Administrator/OrangeC/src'
del /Q C:\msys64\home\Administrator\OrangeC\src\..\bin\*.pdb 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\.. 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:182: cleanDISTRIBUTE] Error 1 (ignored)
mkdir C:\msys64\home\Administrator\OrangeC\src\..\bin 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:183: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\bin 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\help 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:185: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\help 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:187: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:189: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\support 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:191: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\support 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\support\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:193: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\support\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c\sys 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:195: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c\sys 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\sys 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:198: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:200: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:202: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\config 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:204: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\config 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\debug 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:206: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\debug 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\pointers 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:208: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\pointers 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\using 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:210: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\using 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stl 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:212: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stl 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:215: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\msdos 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:217: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\msdos 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:219: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\addon 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:221: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\addon 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:223: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\msdos 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:225: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\msdos 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\system 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:227: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\system 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\c\win32 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:229: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\c\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\atc 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:232: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\atc 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\listview 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:234: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\listview 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\xmlview 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:236: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\xmlview 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\RCDemo 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:238: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\RCDemo 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\huff 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:240: cleanDISTRIBUTE] Error 1 (ignored)
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\huff 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\dist 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:242: cleanDISTRIBUTE] Error 1 (ignored)
C:/msys64/mingw64/bin/mingw32-make.exe DISTRIBUTE
mingw32-make[2]: Entering directory 'C:/msys64/home/Administrator/OrangeC/src'
C:/msys64/home/Administrator/OrangeC/src/copydir.exe examples\%.% C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
No filesmingw32-make[2]: *** [makefile:126: DISTRIBUTE] Error 1
mingw32-make[2]: Leaving directory 'C:/msys64/home/Administrator/OrangeC/src'
mingw32-make[1]: *** [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:321: distribute_self] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/Administrator/OrangeC/src'
mingw32-make: *** [makefile:86: exebuild] Error 2
ghost commented 1 year ago

@LADSoft @GitMensch @chuggafan

I edited mingw64.mak and changed CCFLAGS to the follow:

CCFLAGS = -c -O0 -ggdb -ggdb3 -D__MSVCRT__ -D_MINGW -Wno-int-to-pointer-cast

This means we now have a debug friendly build.

$ gdb omake
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from omake...
(gdb) r
Starting program: C:\orangec\bin\omake.exe
[New Thread 2356.0xcd4]
[Thread 2356.0xcd4 exited with code 0]
[Inferior 1 (process 2356) exited normally]
(gdb) l
1       C:/M/B/src/mingw-w64/mingw-w64-crt/misc/mbrtowc.c: No such file or directory.
(gdb)

p/s: the version of omake from the latest release (I'm not using the CI build) is weird, when you run omake fullbuild -DCOMPILER=MINGW64 on MSYS2 (MINGW64) it will crash immediately, but it doesn't crash if you run omake fullbuild -DCOMPILER=MINGW64 using the Windows Command Prompt. This is the only case when running different shells changed the result (note: for other cases, omake crashed on both shells). Because of this unexpected behavior of omake I now could build the latest code using MINGW64.

chuggafan commented 1 year ago

This looks like an x64 instance when you should be looking for an x32 instance.

Specifically on msys2 it's i686-w64-mingw

ghost commented 1 year ago

This looks like an x64 instance when you should be looking for an x32 instance.

Specifically on msys2 it's i686-w64-mingw

Yeah the version of Orange C I just built is 64 bit. I will try to build a 32 bit version.

Update: it's impossible to build Orange C with MINGW32 (the bin directory is empty, indicating that the build has failed).

LADSoft commented 1 year ago

it is ok to do the simple build i told you about then run omake from its own directory, as omake doesn't have much in the way of dependencies, but for just about everything else you'll have to specify the 'fullbuild' target on the make command line to get everything in the right place and create an environment that can actually be used..

like this:

make fullbuild -DCOMPILER=XXX WITHDEBUG=YES

In addition to building the compiler and using it to build the runtime library, make fullbuild populates the bin, lib, and include directories. Part of what happens when the bin directory is populated is that a bunch of necessary configuration files are copied to it.

None of the files in those three directories are in the repository location for those directories, so you have to run fullbuild at least once if you are going to set up the environment from scratch.

I think if you want you only have to do the fullbuild once, after that you can do

make -DCOMPILER=XXX WITHDEBUG=YES

followed by

make copyexes

if it succeeds,

and it will copy just the exes into the bin directory without going through all the other steps involved in populating a release. I don't use that very much though, since MSVC puts everything in a single directory I just copy the directory...

btw make reads variables from the environment, so you can set it up so you don't have to keep typing stuff on the command line... useful for developing...

ghost commented 1 year ago

There are several issues on your guide above and your BUILD.md. First, on BUILD.md it seems it's expected to run the common on the top level directory? Nope. This will not work, even with omake. You will have to change into the src directory. Please update your BUILD.md. Second, both mingw32-make and make don't understand -D switch. -D seems to be something omake specific. It seems you got the idea about the -D switch from cmake? Finally, your makefiles are invoking the Windows Command Prompt cmd.exe and various Windows commands like del. It will only work with mingw32-make and not make.

Note: mingw32-make and make are different.

$ make --version
GNU Make 4.4.1
Built for x86_64-pc-msys
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ mingw32-make --version
GNU Make 4.4
Built for Windows32
Copyright (C) 1988-2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

You could clearly see mingw32-make is a special version of make patched to use with the Windows utilities. The normal make is designed to be used with the POSIX utilities only.

ghost commented 1 year ago

And as I said, your treetop.mak is for omake only and it's incompatible with mingw32-make.

$ mingw32-make fullbuild COMPILER=MINGW64 WITHDEBUG=YES
mingw32-make[1]: Entering directory 'C:/msys64/home/Administrator/OrangeC/src'
x86_64-w64-mingw32-gcc -LC:\msys64\home\Administrator\OrangeC\src\..\src\lib\mingw64 -Xlinker -Map=output.map -o restub.exe restub.cpp -lstdc++ -lcomctl32 -lgdi32 -lcomdlg32 -lole32 -luxtheme -lkernel32 -lmsimg32 -luuid
x86_64-w64-mingw32-gcc -LC:\msys64\home\Administrator\OrangeC\src\..\src\lib\mingw64 -Xlinker -Map=output.map -o renseg.exe renseg.cpp -lstdc++ -lcomctl32 -lgdi32 -lcomdlg32 -lole32 -luxtheme -lkernel32 -lmsimg32 -luuid
x86_64-w64-mingw32-gcc -LC:\msys64\home\Administrator\OrangeC\src\..\src\lib\mingw64 -Xlinker -Map=output.map -o pepatch.exe pepatch.c -lstdc++ -lcomctl32 -lgdi32 -lcomdlg32 -lole32 -luxtheme -lkernel32 -lmsimg32 -luuid
pepatch.c: In function 'main':
pepatch.c:37:16: warning: overflow in conversion from 'long long unsigned int' to 'long int' changes value from '18446744073709551368' to '-248' [-Woverflow]
   37 |     fseek(fil, - sizeof(struct PEHeader), SEEK_CUR);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
del /Q C:\msys64\home\Administrator\OrangeC\src\..\bin\*.pdb 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:181: cleanDISTRIBUTE] Error 1 (ignored)
mkdir C:\msys64\home\Administrator\OrangeC\src\.. 2> NUL
mingw32-make[1]: [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:182: cleanDISTRIBUTE] Error 1 (ignored)
mkdir C:\msys64\home\Administrator\OrangeC\src\..\bin 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\bin 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\help 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\help 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\support 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\support 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\support\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\support\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c\sys 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c\sys 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\sys 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\c\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\c\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\config 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\config 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\debug 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\debug 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\pointers 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\stlport\pointers 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\using 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stlport\using 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\include\stl 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\include\stl 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\msdos 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\msdos 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\lib\startup\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\addon 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\addon 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\msdos 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\msdos 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\system 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\system 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\c\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\c\win32 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\atc 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\atc 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\listview 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\listview 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\xmlview 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\xmlview 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\RCDemo 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\RCDemo 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\huff 2> NUL
del /Q C:\msys64\home\Administrator\OrangeC\src\..\examples\win32\huff 2> NUL
mkdir C:\msys64\home\Administrator\OrangeC\src\..\dist 2> NUL
C:/msys64/mingw64/bin/mingw32-make.exe DISTRIBUTE
mingw32-make[2]: Entering directory 'C:/msys64/home/Administrator/OrangeC/src'
C:/msys64/home/Administrator/OrangeC/src/copydir.exe examples\%.% C:\msys64\home\Administrator\OrangeC\src\..\examples 2> NUL
No filesmingw32-make[2]: *** [makefile:126: DISTRIBUTE] Error 1
mingw32-make[2]: Leaving directory 'C:/msys64/home/Administrator/OrangeC/src'
mingw32-make[1]: *** [C:\msys64\home\Administrator\OrangeC\src\treetop.mak:321: distribute_self] Error 2
mingw32-make[1]: Leaving directory 'C:/msys64/home/Administrator/OrangeC/src'
mingw32-make: *** [makefile:104: fullbuild] Error 2
ghost commented 1 year ago

@LADSoft @GitMensch @chuggafan

I edited mingw64.mak and changed CCFLAGS to the follow:

CCFLAGS = -c -O0 -ggdb -ggdb3 -D__MSVCRT__ -D_MINGW -Wno-int-to-pointer-cast

This means we now have a debug friendly build.

$ gdb omake
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from omake...
(gdb) r
Starting program: C:\orangec\bin\omake.exe
[New Thread 2356.0xcd4]
[Thread 2356.0xcd4 exited with code 0]
[Inferior 1 (process 2356) exited normally]
(gdb) l
1       C:/M/B/src/mingw-w64/mingw-w64-crt/misc/mbrtowc.c: No such file or directory.
(gdb)

p/s: the version of omake from the latest release (I'm not using the CI build) is weird, when you run omake fullbuild -DCOMPILER=MINGW64 on MSYS2 (MINGW64) it will crash immediately, but it doesn't crash if you run omake fullbuild -DCOMPILER=MINGW64 using the Windows Command Prompt. This is the only case when running different shells changed the result (note: for other cases, omake crashed on both shells). Because of this unexpected behavior of omake I now could build the latest code using MINGW64.

This time I didn't edit mingw64.mak. With the newly built Orange C from latest code, omake fullbuild -DCOMPILER=MINGW64 WITHDEBUG=YES is now working on MSYS2 (MINGW64) too.

Remember my comment here? https://github.com/LADSoft/OrangeC/issues/905#issuecomment-1629931624

The Orange C built by me is still not yet working:

$ occ test.cpp
occ (OrangeC) Version 6.0.70.2
Copyright (C) LADSoft 2006-2023
Error: Library 'clwin.l' does not exist or is not a library
Error: Undefined External '_CatchCleanup(void*)' in module test.cpp
Error: Undefined External 'std::__basic_string_common<bool=1>::__basic_string_common()' in module test.cpp
Error: Undefined External 'std::__basic_string_common<bool=1>::~__basic_string_common()' in module test.cpp
Error: Undefined External 'std::basic_ostream<char, char_traits<char>>::sentry::sentry(basic_ostream<char, char_traits<char>>&)' in module test.cpp
Error: Undefined External 'std::basic_ostream<char, char_traits<char>>::sentry::~sentry()' in module test.cpp
Error: Undefined External 'std::basic_string<char, char_traits<char>, allocator<char>>::~basic_string()' in module test.cpp
Error: Undefined External 'std::basic_string<char, char_traits<char>, allocator<char>>::__init(unsigned int, char)' in module test.cpp
Error: Undefined External 'std::basic_string<char, char_traits<char>, allocator<char>>::__rep::__rep()' in module test.cpp
Error: Undefined External 'std::ctype<char>::id' in module test.cpp
Error: Undefined External 'std::cout' in module test.cpp
Error: Undefined External 'std::ios_base::__set_badbit_and_consider_rethrow()' in module test.cpp
Error: Undefined External 'std::ios_base::clear(unsigned int)' in module test.cpp
Error: Undefined External 'std::ios_base::getloc() const ' in module test.cpp
Error: Undefined External 'std::locale::~locale()' in module test.cpp
Error: Undefined External 'std::locale::use_facet(std::locale::id&) const ' in module test.cpp
Error: Undefined External '__cppexceptionhandle' in module test.cpp
Error: Undefined External '__startup' in module c0xpe.nas
Error: Undefined External 'strlen' in module test.cpp
        19 Errors, 0 Warnings
        Errors encountered, not creating output file

Btw, I found something really strange. Remember the Nana makefile? If I run omake on the Windows Command Prompt then it seems omake has not crashed at all, even though it's still not working right. But if I run omake on the MSYS2 (MINGW64) shell then it exits without printing anything on the screen. Using gdb, I know it crashed.

ghost commented 1 year ago
$ gdb omake
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from omake...
(gdb) r
Starting program: C:\orangec\bin\omake.exe
[New Thread 2356.0xcd4]
[Thread 2356.0xcd4 exited with code 0]
[Inferior 1 (process 2356) exited normally]
(gdb) l
1       C:/M/B/src/mingw-w64/mingw-w64-crt/misc/mbrtowc.c: No such file or directory.
(gdb)

This is still the best thing you could have from gdb, and as you can see, it was run on the MSYS2 (MINGW64) shell.

ghost commented 1 year ago

Btw, I found something really strange. Remember the Nana makefile? If I run omake on the Windows Command Prompt then it seems omake has not crashed at all, even though it's still not working right. But if I run omake on the MSYS2 (MINGW64) shell then it exits without printing anything on the screen. Using gdb, I know it crashed.

Now I know why this happened. Windows' mkdir command doesn't support the -p switch, so running omake on the Windows Command Prompt will spit out an error related to this, but it will not crash. On the MSYS2 (MinGW64) shell, the mkdir command supports the -p switch, so omake will continue to run and crash. You could confirm this by editing makefile to remove the -p switch. After that, omake also crashed on the Windows Command Prompt.

LADSoft commented 1 year ago

thanks for the heads up on the mkdir problem, I will look at it tonite.

Rather than go through these issues point-by-point I'm going to get out my msys2 prompt and see what is up for myself... honestly I do most work on windows so haven't done extensive builds on msys2....

LADSoft commented 1 year ago

the confusion over 'make' vs 'mingw32-make' isn't because I didn't know the difference, it is because I was making a shortcut :)

Sorry about the confusion over the -D switch. Omake can do without and I'll try to start not using -D in communications in the future.

I've taken it as an action item to reassess readme.md and possibly some other documentation.

The problem with mingw32-make not compiling fullbuild on msys2 seems to be mostly a confusion where I used %.% as a filename wildcard in the makefile... once I fixed that the compiler built fine on mysys2 with mingw32-make. But there is also a problem where the RTL build isn't detecting MSYS2 (I can't remember if it was automatic or manual) and I have to look into that before I can get this finished. Because it tries to run csc.exe... gotta get back to work though, so I'll finish this later.

ghost commented 1 year ago

@LADSoft The Orange C built locally by me is broken so I use the builds from your CI. Something for you:

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 3704.0xf0c]
0x0042ec0c in ?? ()

MSVC THEN WITH STATIC LIBRARY.

ghost commented 1 year ago

MSVC THEN WITH LSCRTL

omake.exe caused an Access Violation at location 00000000004D8542 in module LSCRTL.DLL Reading from location 0000000000000000.

Registers:
eax=01e60578 ebx=006027d0 ecx=01ea3d88 edx=02bbff38 esi=01ea3d88 edi=00498aa5
eip=004d8542 esp=02bbfe5c ebp=02bbfe68 iopl=0         nv up ei pl nz ac pe cy
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010213

AddrPC   Params
004D8542 006027D0 02BBFEEC 004AD3BB  LSCRTL.DLL!__static_guard+0x9
004DFD4B 01E60578 01EA3D88 004474CA  LSCRTL.DLL!@std@__thread_local_data.qv+0x48
00447545 01EA3D88 00640FE0 0064A870  omake.exe!0x47545
004E0325 01E60588 00498AA5 0064A870  LSCRTL.DLL!@std@__libcpp_thread_id_less.qll+0x31
00498AFF 0064A870 748F7BE0 F82E64E1  LSCRTL.DLL!_endthreadex+0xd1
748F7C04 0064A870 FA4C5705 00000000  KERNEL32.DLL!@BaseThreadInitThunk@12+0x24
76F1B90F FFFFFFFF 76F006FB 00000000  ntdll.dll!__RtlUserThreadStart+0x2f
76F1B8DA 00498AA5 0064A870 00000000  ntdll.dll!__RtlUserThreadStart@8+0x1b
LADSoft commented 1 year ago

im building it to see if the problem is endemic or just with msys2/mingw32...

ghost commented 1 year ago

im building it to see if the problem is endemic or just with msys2/mingw32...

You will have more luck with MINGW64. As I said above (https://github.com/LADSoft/OrangeC/issues/904#issuecomment-1629904297), it's impossible to build Orange C with MINGW32. Of course I tried both -DCOMPILER=MINGW64 and -DCOMPILER=MINGW. It seems MINGW is the original MinGW compiler (https://sourceforge.net/projects/mingw/), MINGW32 is based on MinGW-w64 (https://sourceforge.net/projects/mingw-w64/).

LADSoft commented 1 year ago

@iahunq -

occ compiles ok with itself...

are you setting the ORANGEC environment variable? I noticed it isn't in the docs and added it today. The build might not succeed without it.

since mingw64 is just gcc, shouldn't you be able to use some command line switches to make it build 32-bit executables?

Anyway I was thinking about it, and the crashes you gave above were not out of the CI builds.... the CI builds build orangec with itself and the crash dumps you've shown seem to be from a mingw executable rather than an occ executable..

next in msys2 (32 bit shell) I used mingw32-make to do a fullbuild with the MINGW64 compiler script. That succeeded so I cleaned with the OCC script and then did another build with the OCC compiler I had just built (not a fullbuild this time). Now it was confusing libraries for LEX files (because of the .l extension we use for libraries) so I did another build using mingw64-make with the --no-builtin-rules command line switch and it built ok, although somehow the lex files things squashed the sqlite3.c source file.... I'll try to remember how to override that builtin rule in occ.mak tomorrow...

in case we also have a compiler mismatch, here is my compiler identification for the mingw compiler I am using: (I did this in a cmd.exe shell while a build was occurring in my msys2 shell)

c:\OrangeC\src>x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=c:/mingw64/w64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
ghost commented 1 year ago

@iahunq -

occ compiles ok with itself...

are you setting the ORANGEC environment variable? I noticed it isn't in the docs and added it today. The build might not succeed without it.

Of course. But it's this way. The ORANGEC environment variable point to the Orange C release I downloaded from you, e.g: C:\orangec. The Orange C source code I cloned from github is on C:\msys64\home\Administrator\OrangeC. Please tell me if I need to change ORANGEC to C:\msys64\home\Administrator\OrangeC or not.

since mingw64 is just gcc, shouldn't you be able to use some command line switches to make it build 32-bit executables?

No. You hard coded in your makefiles to use x86_64-w64-mingw32-gcc and x86_64-w64-mingw32-g++. These are 64 bit. 32 bit compiler is i686-w64-mingw32-gcc and i686-w64-mingw32-g++. Btw, if you simply used gcc and g++ you could expect it to build out of the box on MINGW32. But unfortunately this is not the case. I have no idea why you decided to hard code the compiler to x86_64-w64-mingw32-gcc and x86_64-w64-mingw32-g++ like that. You are intended to cross compile Orange C from Linux to Windows with the MinGW-w64 cross compiler? Otherwise there is no reason to do so.

Anyway I was thinking about it, and the crashes you gave above were not out of the CI builds.... the CI builds build orangec with itself and the crash dumps you've shown seem to be from a mingw executable rather than an occ executable..

The Orange C version built locally by me is broken so don't count it as gdb gave useless information. The latest result I give you were from your CI builds. Please have a look. There are so many updates. But please don't ignore my posts. You seem to ignore my posts so you don't have the latest information. See: https://github.com/LADSoft/OrangeC/issues/904#issuecomment-1631366014 https://github.com/LADSoft/OrangeC/issues/904#issuecomment-1631367464

next in msys2 (32 bit shell) I used mingw32-make to do a fullbuild with the MINGW64 compiler script. That succeeded so I cleaned with the OCC script and then did another build with the OCC compiler I had just built (not a fullbuild this time). Now it was confusing libraries for LEX files (because of the .l extension we use for libraries) so I did another build using mingw64-make with the --no-builtin-rules command line switch and it built ok, although somehow the lex files things squashed the sqlite3.c source file.... I'll try to remember how to override that builtin rule in occ.mak tomorrow...

There is no such a thing as mingw64-make. It's called mingw32-make even for 64 bit.

in case we also have a compiler mismatch, here is my compiler identification for the mingw compiler I am using: (I did this in a cmd.exe shell while a build was occurring in my msys2 shell)

c:\OrangeC\src>x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=c:/mingw64/w64/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib-static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib-static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: posix
gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)

You are confused. The compiler you used is MinGW-w64, not the original mingw.org (domain is defunct) compiler so please correctly call it mingw64. Btw, don't tell me you only used MSYS2 as a shell do you? The MINGW64 compiler is installed by this package: https://packages.msys2.org/groups/mingw-w64-x86_64-toolchain. The MINGW32 compiler: https://packages.msys2.org/groups/mingw-w64-i686-toolchain

See:

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.1.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev7, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (Rev7, Built by MSYS2 project)
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.1.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-13.1.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap --enable-checking=release --with-arch=pentium4 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev7, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --disable-sjlj-exceptions --with-dwarf2 --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (Rev7, Built by MSYS2 project)

Yeah, it's very likely you are only using MSYS2 as a shell and not using the compiler provided by MSYS2 at all. You are still using the last standalone MinGW-w64 8.1.0 provided by the MinGW-w64 project before they stopped providing prebuilt binaries.

LADSoft commented 1 year ago

the reason it is hardcoded is for appveyor... and it was a deliberate choice to use the 64-bit version of the compiler. We wanted the compiler compiled as a 64-bit program.

At the time I did this I didn't understand that I could just use 'gcc'. I will change it.

I did look at your seg fault and stack dump yesterday, and I will say it again those were NOT generated by the orange c runtime, and if you were using the CI builds the way you say you are they would never be generated.

I will look at using the 'native' compiler on msys2 but it may not happen until tomorrow night...

and you'll have to forgive me I'm not 'strict' about words, I might type mingw64-make accidentally for example when I do know that it is mingw32-make... I try to proofread and fix the details but I don't always succeed...