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

Fix Windows #285

Merged
merged 10 commits into from
May 28, 2021
Merged

Fix Windows #285

merged 10 commits into from
May 28, 2021

Conversation

aminya
Copy link
Contributor

@aminya aminya commented May 21, 2021

  • Fix dmd needs -of= to specify the output
  • Append the arch flag on Windows if not provided manually
  • Add mscrtlib option

Addresses #182 (comment)

@adamdruppe
Copy link
Contributor

so that other linker error you saw is just optlink related so if the compiler is dmd, you need to specify either -m32mscoff OR -m64. not both, not neither. so i guess xor lol.

but i'd say if args doesn't include -m64, just add -m32mscoff

Fixes Error: argument expected for switch '-of'
@aminya aminya marked this pull request as ready for review May 21, 2021 01:09
@aminya
Copy link
Contributor Author

aminya commented May 21, 2021

This is ready now. I tested it on Windows by building a large C library, and I can confirm that now it works with dmd if I use --mscrtlib=msvcrtd. I put it behind an option, but this can be the default behavior.

d++ --mscrtlib=msvcrtd  #....other things

@aminya
Copy link
Contributor Author

aminya commented May 24, 2021

Edit: fixed in #287

I don't know why this irrelevant change somehow causes the Linux tests to fail in the CI! It works locally for me:
image

Edit: This also happens on the master branch, so it is not related to this PR.

Comment on lines +99 to +106
if(!dlangCompilerArgs.canFind!(a => a == "-m64" || a == "-m32" || a == "-m32mscoff")) {
version(X86_64) {
dlangCompilerArgs ~= "-m64";
}
version(x86) {
dlangCompilerArgs ~= (dlangCompiler == "dmd") ? "-m32mscoff" : "-m32";
}
}
Copy link
Contributor Author

@aminya aminya May 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we run this code on all operating systems (except for the m32mscoff part)? Architecture is independent of Windows.

@atilaneves atilaneves merged commit d746256 into atilaneves:master May 28, 2021
@aminya aminya deleted the fix-windows branch May 29, 2021 06:48
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

Successfully merging this pull request may close these issues.

None yet

3 participants