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

Windows Support and Link Problem #219

Closed
ghost opened this issue Apr 29, 2019 · 4 comments
Closed

Windows Support and Link Problem #219

ghost opened this issue Apr 29, 2019 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 29, 2019

I didn't want to bump #197 but I am trying to get Bazel with rust to work on windows. I am having problem that nologo.obj is missing and link.exe demands it. Seems like a different problem that in the previous issue. Not sure if this is rules_rust problem or more upstream again. I also couldn't found any mention of nologo.obj on the internet, so I am turning to you for help. Thanks in advance.
I also noticed that rustc is called with link-args=/nologo. Is this wanted behavior?

My repository settings is as follow

  rust_repository_set(
      name = "rust_windows_x86_64",
      exec_triple = "x86_64-pc-windows-msvc",
      extra_target_triples = [],
      iso_date = "2019-04-20",
      version = "nightly",
  )

and I am compiling a simple hello world application. Also tried with latest stable without much luck.
Is this problem in bazel upstream or in rules_rust?
Thank you in advance and good job with these rules!

EDIT
I have found this post on superuser
seems passing /{args} in msys expands them into fully qualified Windows paths. Could passing -nologo instead of /nologo resolve this issue.
(I am a big beginner when it comes to linker problems so, my apologies if I am asking anything stupid)

@acmcarther
Copy link
Collaborator

I don't think any of the maintainers of rules_rust work actively with Windows, and therefore our support is limited/accidental on that platform.

From this build it looks like Windows isn't actually one of our tested platforms either.

If you do any research in this area and are up for contributing back whether that be updating bugs like here or submitting fixes it would be greatly appreciated.

@mfarrugi
Copy link
Collaborator

The "nologo" string isn't in this repo at all, so ostensibly it's coming from somewhere upstream of

ld, link_args = _get_linker_and_args(ctx, rpaths)
args.add("--codegen=linker=" + ld)
args.add_joined("--codegen", link_args, join_with = " ", format_joined = "link-args=%s")

@ghost
Copy link
Author

ghost commented Apr 30, 2019

@acmcarther @mfarrugi thanks for your response. I managed to fix the previous error by forcing that bazel executes Git bash using BAZEL_SH env variable. Maybe someones finds that usefull.

As for windows support... I also mostly operate on linux and there it works without a problem. As some people in my company use windows to develop I wanted to see if we could also maintain a windows target.

I am still not able to get simple hello world to compile. Using Build Tools 2015 I am getting

 note: msvcrt.lib(loadcfg.obj) : error LNK2001: unresolved external symbol __enclave_config

seems a symbol that should be filled by MSVC compiler...

using BuildTools 2017 or 2019 fails miserably. Doesn't even output any error...

If I find any findings I would love to contribute, but I think I am still a bit too big beginner bazel user. Will be closing this one for now and reopen if anything new is found.

@ghost ghost closed this as completed Apr 30, 2019
@malkia
Copy link

malkia commented Aug 29, 2019

Sorry if I'm spitting out the obvious, but /NOLOGO (or -nologo) is an option given to CL.EXE (or LINK.EXE) - https://docs.microsoft.com/en-us/cpp/build/reference/nologo-suppress-startup-banner-c-cpp?view=vs-2019 - https://docs.microsoft.com/en-us/cpp/build/reference/nologo-suppress-startup-banner-linker?view=vs-2019 - hope that helps. Could be that something is pushing this and it gets treated as some other kind of input (like filename, as it has "/")

This issue was closed.
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

3 participants