RejectedSoftware Forums

Sign up

Compiling for x64 on Windows

After running into lots of problems with memory and the GC on x86, I need to move to x64 (which I'd love to just use for everything always) for one of my applications which runs on Windows. Unfortunately I've been unable to make this work even with a trivial dub/empty vibe application.

As the vibe page notes, libevent DLLs are missing for x64. I could compile those myself but I'd actually rather switch to try out win32 or libasync. Unfortunately even setting those via "subConfigurations" as described in the Vibe readme it still fails to build. From the DUB output from a 32-bit build, it looks like it always builds vibed:core using "libevent", while the final "vibed" will get built using whatever subconfiguration is selected. I haven't tested what happens at runtime, but this seems wrong from the start. Given that I'm using a trivial example, I'm curious what's going wrong.

As per my previous posts, I'll readily admit to being confused about how all the dub configurations and packages stuff ties together, but I'm just following instructions here and yet it doesn't seem to be working.

Assuming I get this working, is there some way in the DUB file to specify a 64-bit build rather than having it on the command line every time? Similarly, is there some way in generating a VisualD project that builds the 64-bit version rather than 32-bit?

I'd love to move entirely away from 32-bit at this point and I have in most other languages. D tends to hang on a bit stubbornly to 32-bit (on Windows) though which is unfortunately considering it has the additional GC issues there.

Thanks in advance!

Re: Compiling for x64 on Windows

On Wed, 13 Apr 2016 17:51:14 GMT, punkUser wrote:

After running into lots of problems with memory and the GC on x86, I need to move to x64 (which I'd love to just use for everything always) for one of my applications which runs on Windows. Unfortunately I've been unable to make this work even with a trivial dub/empty vibe application.

As the vibe page notes, libevent DLLs are missing for x64. I could compile those myself but I'd actually rather switch to try out win32 or libasync. Unfortunately even setting those via "subConfigurations" as described in the Vibe readme it still fails to build. From the DUB output from a 32-bit build, it looks like it always builds vibed:core using "libevent", while the final "vibed" will get built using whatever subconfiguration is selected. I haven't tested what happens at runtime, but this seems wrong from the start. Given that I'm using a trivial example, I'm curious what's going wrong.

As per my previous posts, I'll readily admit to being confused about how all the dub configurations and packages stuff ties together, but I'm just following instructions here and yet it doesn't seem to be working.

I think you are hitting a bug in DUB that was recently fixed. Can you try with the latest alpha version or GIT master?

Assuming I get this working, is there some way in the DUB file to specify a 64-bit build rather than having it on the command line every time? Similarly, is there some way in generating a VisualD project that builds the 64-bit version rather than 32-bit?

DUB currently always defaults to the platform that the compiler defaults to. Maybe there is a way to do this in dmd.conf? But it would probably also make sense to add a configuration option to DUB's configuration file. As a workaround, you could create a little batch file that just runs dub --arch=x86_64 %* and use that instead of the dub executable directly.

You can generate a 64-bit VisualD solution using dub generate visuald --arch=x86_64.

I'd love to move entirely away from 32-bit at this point and I have in most other languages. D tends to hang on a bit stubbornly to 32-bit (on Windows) though which is unfortunately considering it has the additional GC issues there.

Yeah, it's really time to have a linker in the standard distribution that can link 64-bit object files. That's the only thing holding back a 64-bit default build.

Re: Compiling for x64 on Windows

Thanks for the reply!

On Fri, 15 Apr 2016 08:39:02 GMT, Sönke Ludwig wrote:

I think you are hitting a bug in DUB that was recently fixed. Can you try with the latest alpha version or GIT master?

The alpha still has the same issue (and for some reason has a long delay before starting to do work):

32-bit build ("dub" with no arguments) - note libevent still referenced in vibe-d:core
vibe-d:utils 0.7.28: target for configuration "library" is up to date.
vibe-d:data 0.7.28: target for configuration "library" is up to date.
vibe-d:core 0.7.28: target for configuration "libevent" is up to date.
vibe-d:http 0.7.28: target for configuration "library" is up to date.
vibe-d:diet 0.7.28: target for configuration "library" is up to date.
vibe-d:mail 0.7.28: target for configuration "library" is up to date.
vibe-d:mongodb 0.7.28: target for configuration "library" is up to date.
vibe-d:redis 0.7.28: target for configuration "library" is up to date.
vibe-d:web 0.7.28: target for configuration "library" is up to date.
vibe-d 0.7.28: target for configuration "libasync" is up to date.
steamproxyvibed ~master: building configuration "application"...
Linking...

64-bit build (dub --arch=x86_64):
Performing "debug" build using dmd for x86_64.
vibe-d:utils 0.7.28: target for configuration "library" is up to date.
vibe-d:data 0.7.28: target for configuration "library" is up to date.
vibe-d:core 0.7.28: building configuration "libevent"...
Error: Error reading file 'blahblah\vibe-d-0.7.28\lib\win-amd64\event2.lib'
dmd failed with exit code 1.

I'll give master a try when I get the chance just in case the fix wasn't in the alpha build (0.9.25-alpha.1, built on Apr 5 2016).

You can generate a 64-bit VisualD solution using dub generate visuald --arch=x86_64.

Oh cool, I'll give that a shot once I get the build working.

Yeah, it's really time to have a linker in the standard distribution that can link 64-bit object files. That's the only thing holding back a 64-bit default build.

Ah, interesting. Wasn't aware of there being a linker issue.

Re: Compiling for x64 on Windows

Hi,

I recently ran into the same issue. Here is some dirty workaround I came up with..

Look up the dub package of vibed, it should be in %appdata%\Roaming\dub\packages\vibe-d-0.7.29-alpha.3
Open vibed's dub.json, scroll down to configurations and change the entry with name libasync to the following:

{
	"name": "libasync",
	"targetType": "library",
	"subConfigurations": {
		"vibe-d:core": "libasync"
	} 
},

Finally, in your own dub.json add subConfigurations": { "vibe-d": "libasync"}

Best Regards!

Re: Compiling for x64 on Windows

On Wed, 20 Apr 2016 18:06:53 GMT, Fynn Schröder wrote:

I recently ran into the same issue. Here is some dirty workaround I came up with..

Ah, interesting thanks! I'll definitely give that a try.

I don't know enough about DUB's subconfiguration stuff to know if that's a mistake in the vibed package.json or a bug in DUB itself? If it's the former it's probably worth filing an issue to get that upstreamed.

Good find, thanks!

Re: Compiling for x64 on Windows

I've removed the libevent config for Win64 on master now.