Thread overview
any chance to get it working on windows xp?
May 17, 2020
a beginner
May 17, 2020
Seb
May 18, 2020
a beginner
May 19, 2020
rikki cattermole
May 17, 2020
rikki cattermole
May 18, 2020
Mike Parker
May 18, 2020
Jonathan M Davis
Oct 03, 2020
Drone1h
May 17, 2020
It might seem unbelievable, but windows xp is still widely used (did you know it runs most bank cash machines by the way?).
As it happens, in my case I've been away from computing a long while, and my old box with xp-sp2 is all I have available at the moment. I had a very old dmd version which used to work. I tried to use it, only to discover dub doesn't connect online anymore (guess it's some security protocol update, stuff I know next to nothing about). Tried to replace dub with the latest one (1.24 perhaps, not sure), doesn't run. Tried dub 1.11, it runs but fails trying to xcopy the package cache onto itself, and doing so without quoting the obviously space-including pathname ("documents and settings", I wish I could kick in the balls whoever came up with that). I did not check the source yet, but the error message shows an xcopy command line and a "wrong number of arguments" (I'll spare my opinion on this one). Deleted the cache, same problem: it works the first time, the second time it tries to move the cache from where it just created it to... where it is already.
Tried the last dmd2 2.092.0, doesn't run. I went backwards until 2.089.1 which seems to work, but calls lld-link which doesn't. This comes as a surprise, because sc.ini has "LINKCMD=%@P%\optlink.exe" in the Environment32 section. Tried to move lld-link out of the way and now it tries to link, only it fails with an "error 4 module corrupt" or something. Went back to 2.085.1 and behold, it links the "hello world" kind of program as generated by "dub init". But dub gives access violation as soon as a dependency is involved. No hint to what the problem is, just "access violation" and good bye. Even a simple "dub init" or "dub add". Tried replacing it with dub from dmd 2.089.1 and... access violation.
Now, I am probably doing something wrong, and someone familiar with the tools would likely know what to do, but that is not me.
Is there a release working on xp (sp2 at that), dmd2 and dub at least, and if so, which one? if not, is there a way to pick parts here and there and make it work? Is there a technical reason for dropping xp compatibility or did it just happen and who cares in 2020?
I have searched online for some info, indeed I found something, but not being familiar with the tools it hasn't been terribly useful. Only it confirms that windows support is somewhat disappointing in general, xp or not.
It seems to me my best chance is to stay with dmd 2.085.1, try fix the cache problem in dub 1.11 myself (or give up on that and build "by hand"), probably wrestle some linking problems (pretty sure I wouldn't succeed with that) and be happy until I can upgrade. After all, these days programming is just a hobby for me. But honestly, all this is quite annoying for a beginner. In my experience, trouble getting the tools to work is often the biggest obstacle in learning a new language (well, unless it's something really weird...), which in many cases means giving up after some cursing.
May 17, 2020
On Sunday, 17 May 2020 at 22:30:22 UTC, a beginner wrote:
> [...]

You could try grabbing a newer dub release binary from here: https://github.com/dlang/dub/releases

There are two versions (installer + zip archive). It looks like you're better off with the zip archive.

Alternatively, if you have a working compiler building dub from scratch isn't hard. You just need to clone the repo and run the build script (build.bat in your case).

Good luck!
May 18, 2020
It isn't just about the OS.

Dmd and ldc's codegen haven't stood still for 10 years. They both will be emitting instructions your cpu cannot handle. Hence crashes.
May 18, 2020
On Sunday, 17 May 2020 at 22:30:22 UTC, a beginner wrote:

> I have searched online for some info, indeed I found something, but not being familiar with the tools it hasn't been terribly useful. Only it confirms that windows support is somewhat disappointing in general, xp or not.

I've been using D on Windows since I first found it in 2003. From my perspective, Windows support is fairly solid.

> It seems to me my best chance is to stay with dmd 2.085.1, try fix the cache problem in dub 1.11 myself (or give up on that and build "by hand"), probably wrestle some linking problems (pretty sure I wouldn't succeed with that) and be happy until I can upgrade. After all, these days programming is just a hobby for me. But honestly, all this is quite annoying for a beginner. In my experience, trouble getting the tools to work is often the biggest obstacle in learning a new language (well, unless it's something really weird...), which in many cases means giving up after some cursing.

Unfortunately, the minimum Windows version "officially" supported is Windows 7:

https://forum.dlang.org/post/ktfgps$2ghh$1@digitalmars.com

With no testing on XP, you are bound to run into difficulties trying to use the tools there. So yeah, your best bet is using a compiler version that works and see if building dub from source makes a difference. If you can't get dub to work, then you'll want to look into using rdmd, which has shipped with dmd for years now, or perhaps makefiles.
May 18, 2020
On Sunday, May 17, 2020 11:36:01 PM MDT Mike Parker via Digitalmars-d-learn wrote:
> Unfortunately, the minimum Windows version "officially" supported is Windows 7:
>
> https://forum.dlang.org/post/ktfgps$2ghh$1@digitalmars.com
>
> With no testing on XP, you are bound to run into difficulties trying to use the tools there. So yeah, your best bet is using a compiler version that works and see if building dub from source makes a difference. If you can't get dub to work, then you'll want to look into using rdmd, which has shipped with dmd for years now, or perhaps makefiles.

I'm pretty sure that Phobos (and possibly druntime) use Windows API calls that do not exist on XP and have done so for years now. You might get lucky and get some stuff to work on XP, but not everything will work. The only way to guarantee that it will work is to use a compiler version old enough that XP was still supported (which probably means grabbing one from the 2013 timeframe given the date of Walter's post, though it may be possible to dig through the changelog and find the exact version that Windows XP support was officially dropped). However, you're not going to be able to pull in much of anything with dub that way, because the older compiler likely won't be able to compile the newer code, and I don't know if a version of dub that old will ever work with the current dub repository.

- Jonathan M Davis



May 18, 2020
Thanks to all of you for support.

On Sunday, 17 May 2020 at 22:37:14 UTC, Seb wrote:
> Alternatively, if you have a working compiler building dub from scratch isn't hard. You just need to clone the repo and run the build script (build.bat in your case).
>
> Good luck!
I recompiled latest dub 1.21 from github (which means I was very likely wrong to call it 1.24), went smooth. Though, it still gives "access violation" when asking it to add a dependency. However, I noticed it seems to happily pull down dependencies if they're in the "dub.selections.json" file, so it's kinda usable after all, and what's more, I can try to debug the problem. Anyway I suspect the binary download would have behaved the same if I only though about trying before.

@rikki cattermole
>Dmd and ldc's codegen haven't stood still for 10 years. They both will be
>emitting instructions your cpu cannot handle. Hence crashes.
So... was I wrong to assume it generates code for the cpu it's running on (a P4 Northwood in my case) by default? I will try the "-mpcu" command line option then, and see if it takes care of that crash.

@Jonathan M Davis
>I'm pretty sure that Phobos (and possibly druntime) use Windows API calls that
> do not exist on XP and have done so for years now. You might get lucky and get
> some stuff to work on XP, but not everything will work.
Very likely indeed. I hope I'll somehow be able to work around this issue, at least in some cases.
May 19, 2020
On 19/05/2020 12:51 AM, a beginner wrote:
> @rikki cattermole
>> Dmd and ldc's codegen haven't stood still for 10 years. They both will be
>> emitting instructions your cpu cannot handle. Hence crashes.
> So... was I wrong to assume it generates code for the cpu it's running on (a P4 Northwood in my case) by default? I will try the "-mpcu" command line option then, and see if it takes care of that crash.

Yes.

Compilers make assumptions, especially dmd which uses newer instructions than an XP era build of dmd did.

But because D is self hosted, this means that the compiler itself has now been compiled with such instructions in use. So it too can crash.

Unless you bootstrap compile ldc up to the latest version (which also means LLVM), what options you pass it may very well not matter.
October 03, 2020
On Monday, 18 May 2020 at 05:36:01 UTC, Mike Parker wrote:
> [...]
> Unfortunately, the minimum Windows version "officially" supported is Windows 7:
>
> https://forum.dlang.org/post/ktfgps$2ghh$1@digitalmars.com
>
> With no testing on XP, you are bound to run into difficulties trying to use the tools there. So yeah, your best bet is using a compiler version that works and see if building dub from source makes a difference. If you can't get dub to work, then you'll want to look into using rdmd, which has shipped with dmd for years now, or perhaps makefiles.
> [...]

This is not exactly a reply to the original thread, but maybe it helps someone who has searched for "Windows XP" in the forum and found this discussion.

For version 2.094, dmd.exe and dub.exe require Windows Vista or Windows 7 or newer.

We can make these tools support Windows XP (and possibly Windows 2000 too) by patching them as follows:

- at offset 148h (offset 40h from the "PE" signature), we change 06h to 05h;
- at offset 150h (offset 48h from the "PE" signature), we change 06h to 05h;
- in both dmd.exe and dub.exe.

(This support has not been thoroughly tested, but I seem to be able to build and run simple applications using Windows XP.)


lld-link.exe also requires Windows Vista or 7 or newer, but I am too noob to make it support Windows XP.

ddemangle.exe, dustmite.exe, libcurl.dll, optlink.exe and rdmd.exe all support older versions of Windows (at least, they support Windows XP).


(All the .exe files mentioned above are the 32-bit ones located in the "windows\bin" subfolder, not the 64-bit ones located in the "windows\bin64" subfolder etc.)


Good luck ! (Contact: DoctorNoobingstoneIPresume at gmail dot com)
November 25
>

With no testing on XP, you are bound to run into difficulties trying to use the tools there.

The problem looks mostly not in WinXP-hosted compiler and tools, but in core and side libraries support such as druntime, phobos, etc. As a sample, I can use LDC for cross-compiling from Linux for win32-i486 target, but next I'll be stucked on core libs that block me the same as using cross-D on non-glib Linux systems.