OpenSmalltalk / opensmalltalk-vm

Cross-platform virtual machine for Squeak, Pharo, Cuis, and Newspeak.
http://opensmalltalk.org/
Other
562 stars 110 forks source link

How to build on Win32 using WSL/Ubuntu | Missing headers #510

Closed LinqLover closed 4 years ago

LinqLover commented 4 years ago

build.win32x86/HowToBuild describes how we can build the VM using cygwin. However, I have installed WSL instead. When running mvm, it gives me:

../../platforms/win32/vm/sqWin32Utils.c:11:10: fatal error: Windows.h: No such file or directory

What do I have to do to enable mingw to find these header files? Any help is appreciated.

OpenSmalltalk-Bot commented 4 years ago

On 13.06.2020, at 19:29, Christoph Thiede notifications@github.com wrote:

build.win32x86/HowToBuild describes how we can build the VM using cygwin. However, I have installed WSL instead. When running mvm, it gives me:

../../platforms/win32/vm/sqWin32Utils.c:11:10: fatal error: Windows.h: No such file or directory

What do I have to do to enable mingw to find these header files? Any help is appreciated.

Why build then win32 under WSL and not the Linux one?

LinqLover commented 4 years ago

I would like to debug the dnd plugin for Windows. But if possible, I did not want to install cygwin additionally as I prefer WSL ...

OpenSmalltalk-Bot commented 4 years ago

Hi Christoph.

WSL = Windows Subsystem for Linux? https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux [https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux]

Can you even build Windows binaries from within WSL? I don't know.

Using Cygwin, you can build Windows binaries that link against Cygwin1.dll. Using MinGW (not necessarily out of Cygwin) you can build Windows binaries that directly link to Windows libraries. MinGW provides all the header files such as windows.h.

But you can also use the MSVC compiler. :-) I think. There are people doing that.

Best, Marcel Am 13.06.2020 19:33:37 schrieb Christoph Thiede notifications@github.com: I would like to debug the dnd plugin for Windows. But if possible, I did not want to install cygwin additionally as I prefer WSL ...

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/510#issuecomment-643653889

I would like to debug the dnd plugin for Windows. But if possible, I did not want to install cygwin additionally as I prefer WSL ...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub [https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/510#issuecomment-643653889], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AIJPEW6D4M55JISUIMAUUG3RWOZ6TANCNFSM4N5CJXTQ].

LinqLover commented 4 years ago

Hi Marcel,

WSL = Windows Subsystem for Linux? https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

Exactly. :-)

I tried installing Cygwin now, too, but I still do not succeed.
I ran scripts/installCygwin.bat, then started a Cygwin session and ran the mvm script from there. But still, Windows.h is not found. Is this what I am supposed to do?

However, I tried MSVC, too (this would be my preferred way over Cygwin). So, again strictly following the HowToBuild file, I opened an x86 Native Tools Command Prompt, navigated to build.win32x86\squeak.cog.spur\, executed ..\common\SETPATH.BAT and finally ..\common\MAKEDEBUG.BAT. Now guess what type LOGD will give me?

../../platforms/win32/vm/sqWin32Utils.c:11:10: fatal error: Windows.h: No such file or directory

So I guess the HowToBuild instructions much miss some significant point on how to get these headers ... :-(

Best, Christoph

nicolas-cellier-aka-nice commented 4 years ago

Using Cygwin, you can build Windows binaries that link against Cygwin1.dll. Using MinGW (not necessarily out of Cygwin) you can build Windows binaries that directly link to Windows libraries. MinGW provides all the header files such as windows.h.

Technically, we don't build a cygwin application (requiring Cygwin1.dll). We use cross-compiler for a mingw64 target. It's just that cygwin comes with enough pre-compiled tools and libraries (including mingw target), unlike various flavours of mingw/msys. Eliot provided makefiles for using MSVC toolchain, but we still need a gnu-make AFAIR.

Maybe it's possible to use WSL if you installed enough tools for cross-compiling a mingw target, but you'll be alone then, I think no one ever tried that.

installCygwin.bat requires parameters, at least x86_64, otherwise, it will install tools for 32bit (i686) VM. see https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/07161bcb145bc4c6b08c617df2c708e3a94597b6/.appveyor.yml#L162

LinqLover commented 4 years ago

Maybe it's possible to use WSL if you installed enough tools for cross-compiling a mingw target, but you'll be alone then, I think no one ever tried that.

As said, this would be optimal, but at the moment I will be happy if I manage to build it anyhow :-)

installCygwin.bat requires parameters, at least x86_64, otherwise, it will install tools for 32bit (i686) VM. see

https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/07161bcb145bc4c6b08c617df2c708e3a94597b6/.appveyor.yml#L162

Yes, I had specified these parameters (i686). I am trying to build the 32bit version.

OpenSmalltalk-Bot commented 4 years ago

WSL runs a Linux, so without cross-compilation you don't make Windows binaries there, unlike with mingw or Cygwin. If you want a VM that runs in WSL, build a Linux VM. Don't use WSL to build a Windows VM.

Kind regards, Jakob

Christoph Thiede notifications@github.com schrieb am Sa., 13. Juni 2020, 21:21:

Maybe it's possible to use WSL if you installed enough tools for cross-compiling a mingw target, but you'll be alone then, I think no one ever tried that.

As said, this would be optimal, but at the moment I will be happy if I manage to build it anyhow :-)

installCygwin.bat requires parameters, at least x86_64, otherwise, it will install tools for 32bit (i686) VM. see

https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/07161bcb145bc4c6b08c617df2c708e3a94597b6/.appveyor.yml#L162

Yes, I had specified these parameters (i686). I am trying to build the 32bit version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/510#issuecomment-643666521, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJPEW6GXMF32FGZCWLGLZDRWPGRBANCNFSM4N5CJXTQ .

LinqLover commented 4 years ago

Alright, thanks for all your help. Marcel has explained to me that I need to start cygwin via the cygwin.bat but never must start the bash.exe itself. Now the headers are found and mvm succeeds! 🎉

I still don't understand why it did work for me via MSVC, but at least I can build now, so everything else is secondary :-)

LinqLover commented 4 years ago

... I can build the VM, but I cannot load any image file. After running Squeak[Console].exe and choosing an image, I always get [Smalltalk stack dump: ]Segmentation fault. gdb only tells me that the exception occurs in JIT code. Is this a common problem? How can I investigate this? :-)

nicolas-cellier-aka-nice commented 4 years ago

Is it the win64 (64 bits) VM?
It's currently broken (crash at early startup).

There is an issue opened https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/498
It would be great to bissect...

AFAIK, the build using LLVM clange.exe is working OK though...
But this requires different build instructions...

LinqLover commented 4 years ago

Is it the win64 (64 bits) VM?

build.win32x86, no 64 bit. Hm ... could this occur because I have installed 64-bit version of cygwin?

LinqLover commented 4 years ago

Is it the win64 (64 bits) VM?

build.win32x86, no 64 bit. Hm ... could this occur because I have installed 64-bit version of cygwin?

No, just installed cygwin 32 bit and built everything again. Still segfault ...

LinqLover commented 4 years ago

No progress on this so far. Does there exist something like a docker file I could use to skip all these error-prone setup steps?

OpenSmalltalk-Bot commented 4 years ago

Hi Christoph,

On Jun 13, 2020, at 11:07 AM, Christoph Thiede notifications@github.com wrote:

 Hi Marcel,

WSL = Windows Subsystem for Linux? https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

Exactly. :-)

I tried installing Cygwin now, too, but I still do not succeed. I ran scripts/installCygwin.bat, then started a Cygwin session and ran the mvm script from there. But still, Windows.h is not found. Is this what I am supposed to do?

However, I tried MSVC, too (this would be my preferred way over Cygwin). So, again strictly following the HowToBuild file, I opened an x86 Native Tools Command Prompt, navigated to build.win32x86\squeak.cog.spur\, executed ..\common\SETPATH.BAT and finally ..\common\MAKEDEBUG.BAT. Now guess what type LOGD will give me?

../../platforms/win32/vm/sqWin32Utils.c:11:10: fatal error: Windows.h: No such file or directory So I guess the HowToBuild instructions much miss some significant point on how to these headers ... :-(

Did you install an SDK? I’m pretty sure that’s where the Windows.h headers live. Instal a 10.x SDK if you haven’t already.

Best, Christoph

,,,^..^,,, (phone)

eliotmiranda commented 4 years ago

Hi Christoph,

On Jun 19, 2020, at 11:56 AM, Christoph Thiede notifications@github.com wrote:

 Is it the win64 (64 bits) VM?

build.win32x86, no 64 bit. Hm ... could this occur because I have installed 64-bit version of cygwin?

No. 64-bit Cygwin will build the 32-bit vm. The problem is that its gdb won’t debug the 32-big exe :-(. So if you do want to debug you have to install 32-big Cygwin, & IIRC it had to be on a 32-bit OS. Hence use a VM :-(

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

LinqLover commented 4 years ago

Hi all,

here are my current results of building the spur versions on Windows, using commit 16ffd5b3c4c6e48968277e40543ca1f96b984473 + patch from https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/498#issuecomment-647189330

Additional notes:

If anyone succeeds to build, we should really encapsulate the necessary tech stack. I believe this could make things really easier ... 😅

eliotmiranda commented 4 years ago

Hi Christoph,

please read my message here:

http://forum.world.st/Win64-Builds-broken-slow-build-times-tp5116826p5120506.html

It explains the bug and how to fix it.

,,,^..^,,, (phone)

On Sep 1, 2020, at 9:34 AM, Christoph Thiede notifications@github.com wrote:

 Hi all,

here are my current results of building the spur versions on Windows, using commit 16ffd5b + patch from #498 (comment)

cygwin32/cygwin64 for build.win32x86: $ ./mvm -f

$ ./build/vm/SqueakConsole ..\relative\path\to\valid\squeak.image Could not open the Squeak image file <...> Aborting... Smalltalk stack dump: cygwin32 for build.win64x64: $ ./mvm -f $ ./build/vm/SqueakConsole ..\relative\path\to\valid\squeak.image cygwin64 for build.win64x64: $ ./mvm -f rm: cannot remove 'build/vm/ADPCMCodecPlugin.lib': No such file or directory make[1]: [/cygdrive/c/Users/Christoph/OneDrive/Dokumente/Squeak/Christoph/git/opensmalltalk-vm/build.win64x64/common/Makefile.plugin:139: build/vm/ADPCMCodecPlugin.lib] Error 1 (ignored) x86_64-w64-mingw32-ar rc build/vm/ADPCMCodecPlugin.lib build/ADPCMCodecPlugin/ADPCMCodecPlugin.o make[1]: x86_64-w64-mingw32-ar: No such file or directory make[1]: *** [/cygdrive/c/Users/Christoph/OneDrive/Dokumente/Squeak/Christoph/git/opensmalltalk- vm/build.win64x64/common/Makefile.plugin:140: build/vm/ADPCMCodecPlugin.lib] Error 127 make[1]: Leaving directory „/cygdrive/c/Users/Christoph/OneDrive/Dokumente/Squeak/Christoph/git/opensmalltalk- vm/build.win64x64/squeak.cog.spur“ make: *** [../common/Makefile:271: build/vm/ADPCMCodecPlugin.lib] Error 2 Additional notes: When I run SqueakConsole.exe from Cygwin, the output listed above is appended by a "Segmentation fault" line. When run in PowerShell, this line is not displayed, but everything else looks identically. Running Squeak.exe (without "Console") did not work better, but as is known does not log errors to the console. Despite I passed the image path to the executable, I have to choose it manually in a dialog. Same problems when using squeak.stack.spur instead of squeak.cog.spur. So this is not a JIT problem (is this correct?). If anyone succeeds to build, we should really encapsulate the necessary tech stack. I believe this could make things really easier ... 😅 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
LinqLover commented 4 years ago

Thanks Eliot,

@nicolas-cellier-aka-nice wrote that could fix the cygwin builds on his machine. This solution did not work for me, so is it possible that there is another problem?

Otherwise, I will try soon again to build using MSVC ...

LinqLover commented 4 years ago

I have to apologize for a stupid rookie mistake. The 32-bit builds "did not work" for me because I was trying to open a 64-bit image file in it, which Marcel kindly made we aware of ... (for 32-bit VMs, it has to be a 32-bit image and vice versa)

So to correct the above description, I can say:

Because I did not ask a specific question, I'm going to close this now - yahoo, I can finally start developing for the OSVM Windows platform! :tada:

OpenSmalltalk-Bot commented 3 years ago

please don't send me more letters !!!

On 2020-06-13, at 23:29, Jakob Reschke @.***> wrote:

 WSL runs a Linux, so without cross-compilation you don't make Windows binaries there, unlike with mingw or Cygwin. If you want a VM that runs in WSL, build a Linux VM. Don't use WSL to build a Windows VM.

Kind regards, Jakob

Christoph Thiede @.***> schrieb am Sa., 13. Juni 2020, 21:21:

Maybe it's possible to use WSL if you installed enough tools for cross-compiling a mingw target, but you'll be alone then, I think no one ever tried that.

As said, this would be optimal, but at the moment I will be happy if I manage to build it anyhow :-)

installCygwin.bat requires parameters, at least x86_64, otherwise, it will install tools for 32bit (i686) VM. see

https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/07161bcb145bc4c6b08c617df2c708e3a94597b6/.appveyor.yml#L162

Yes, I had specified these parameters (i686). I am trying to build the 32bit version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.