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

Full Windows Support #182

Open
2 of 4 tasks
John-Colvin opened this issue Oct 9, 2019 · 18 comments
Open
2 of 4 tasks

Full Windows Support #182

John-Colvin opened this issue Oct 9, 2019 · 18 comments
Assignees

Comments

@John-Colvin
Copy link
Contributor

John-Colvin commented Oct 9, 2019

clang say they mostly match the msvc C++ ABI on windows (https://clang.llvm.org/docs/MSVCCompatibility.html) so it should be possible to get everything working nicely just like on linux.

@John-Colvin John-Colvin changed the title Windows Full Windows Support Oct 9, 2019
@atilaneves
Copy link
Owner

@adamdruppe - I tried assigning this to you but couldn't.

@adamdruppe
Copy link
Contributor

maybe it is cuz i never forked the thing, try it now

@adamdruppe
Copy link
Contributor

quick update, I have it down to just 5 tests still failing. Kinda surprising that one of these would be Windows-specific, just a ctor decl outside the class (issue 115). But still getting through it all.

@adamdruppe
Copy link
Contributor

So... clang --ast-dump agrees with what I'm seeing in dpp. The compound statement is included on linux, but just null on Windows. I tried a new llvm too, no change. It could be a different build flag or something, but if people are going to use the upstream Windows binaries, I think we just need to work around this.

The good news is a member function definition is.... maybe something you never actually need? Unless it is trying to automatically port a template body from c++ over to D instead of just matching mangling which I don't see even Linux version attempting.. but idk, since the clang command directly is showing the same hole as found in the code it makes me fairly certain it is a problem in the upstream library/build.

@adamdruppe
Copy link
Contributor

see #183 for checking off the dub test. I haven't tried the others yet, my Windows box doesn't have any ruby so that will be more painful to run there.

@adamdruppe
Copy link
Contributor

adamdruppe commented Oct 16, 2019

i just got ruby installed on my windows box. 10 scenarios, 7 failed, 3 passed. 66 steps, 7 failed, 22 skipped, 37 passed.

at least it went quickly after getting all the deps installed! i'll start looking at them now.

edit: lol they assume g++ is in path. fun.

@adamdruppe
Copy link
Contributor

OK, good news on that. The tests all fail because of trivial name changes like .obj instead of .o and files being in PATH. I wrote a helper program to translate those.

import std.process;
import std.algorithm;
import std.array;

string fixObjFiles(string a) {
	version(Windows) {
		if(a.endsWith(".o")) return a[0 .. $-2] ~ ".obj";
		if(a.startsWith("-of")) return a ~ ".exe";
	}
	return a;
}

string fixCompiler(string a) {
	version(Windows) {
		if(a == "gcc" || a == "g++")
			return "clang"; // this box has clang specifically for dpp sooooo
		if(a.startsWith("./")) {
			import std.file;
			import std.path;
			return buildNormalizedPath(thisExePath, "../../tmp/aruba", a ~ ".exe");
		}
	}
	
	return a;
}

int main(string[] args) {
	if(args[1] == "dmd" || args[1] == "d++")
		args ~= "-m64";
	auto sargs = args[1 .. 2].map!fixCompiler.array ~ args[2 .. $].map!fixObjFiles.array;
	import std.stdio; writeln("RUNNING ", sargs);
	auto p = spawnProcess(sargs);
	return wait(p);
}

hacky but like it is a good sign these only failed due to trivialities too.

the only other one is the

Scenario: Compile but don't link
When I successfully run fixup d++ -c main.dpp
Then a file matching %r<main.[o|obj]> should exist

and that regex fixes it.

prolly time to actually try using it... I suspect it will work now.

@John-Colvin
Copy link
Contributor Author

Excellent, this is looking very promising.

@adamdruppe
Copy link
Contributor

i just ran nanomsg on Linux literally seconds ago using dpp instead of the bundled bindings (though i think the bundled bindings are a better approach...). Took a few semi-hacky things, undef VERSION and errno, and I ran dpp separately from dub (but I suppose preBuildCommands could run it automatically there i don't feel like that is a good solution)... but it worked.

I'm gonna copy the files to my Windows box soon and see if it works there as well.

@adamdruppe
Copy link
Contributor

the include path on Windows isn't automagically figured out... but i can add it manually (took me forever to even find it but meh). and now the .lib has leading _ and D doesn't put that out.

again, it is easy enough to convert the lib but just another thing that doesn't just work... i wonder if there's any good way to know why it has it or if it does etc

@adamdruppe
Copy link
Contributor

OK, nanomsg did work on Windows, I just had a 32 bit build and making dpp do that i guess --clang-option -m32 works but idk if it is the best.

Replaced the import nanomsg.bindings with

#include <nanomsg/nn.h>
#include <nanomsg/reqrep.h>
#include <nanomsg/pubsub.h>
#include <nanomsg/pipeline.h>
#include <nanomsg/pair.h>
#include <nanomsg/survey.h>
#include <nanomsg/bus.h>
#include <nanomsg/tcp.h>
#undef errno
#undef __VERSION__

but the rest was just setup pain. The undefs are interesting as they conflicted with D stuff... but solvable right there. so I'd say dpp does work on Windows you just need to tell it where to find third party lib files.

@atilaneves
Copy link
Owner

The appveyor build works now.

The more I think of it the less I seem to care about getting cucumber to work on Windows. It's probably better to rewrite the bash scripts that test external projects into D actually.

@adamdruppe
Copy link
Contributor

What are you next steps? I think it would be kinda nice if dub actually understood .dpp files in the source and just automatically read in dpp as a dependency and pulled it down.

@John-Colvin
Copy link
Contributor Author

John-Colvin commented Oct 19, 2019 via email

@atilaneves
Copy link
Owner

What are you next steps?

I don't have any as far as Windows support goes. appveyor will keep us honest.

@Imperatorn
Copy link

Schrödinger's Windows support? Is it working now, or not? Is it just the cucumber support that's blocking it?

@aminya

This comment has been minimized.

@aminya

This comment has been minimized.

@aminya aminya mentioned this issue May 21, 2021
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

5 participants