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

Add continuous integration on Windows #25

Closed
dtolnay opened this issue Jan 26, 2020 · 6 comments · Fixed by #42
Closed

Add continuous integration on Windows #25

dtolnay opened this issue Jan 26, 2020 · 6 comments · Fixed by #42
Labels
help wanted windows Issues that manifest on Windows

Comments

@dtolnay
Copy link
Owner

dtolnay commented Jan 26, 2020

No description provided.

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 19, 2020

I believe the current thing blocking this is our use of symlinks in the source tree.

$ cargo run --manifest-path demo-rs/Cargo.toml
info: default toolchain set to 'nightly'
info: syncing channel updates for 'nightly-x86_64-pc-windows-gnu'
   Compiling proc-macro2 v1.0.8
   Compiling unicode-xid v0.2.0
   Compiling winapi-x86_64-pc-windows-gnu v0.4.0
   Compiling cc v1.0.50
   Compiling syn v1.0.14
   Compiling winapi v0.3.8
   Compiling anyhow v1.0.26
   Compiling unicode-segmentation v1.6.0
   Compiling unicode-width v0.1.7
   Compiling codespan v0.7.0
   Compiling link-cplusplus v1.0.1
   Compiling cxx v0.1.2 (C:\Users\travis\build\dtolnay\cxx)
   Compiling quote v1.0.2
   Compiling winapi-util v0.1.3
   Compiling termcolor v1.1.0
   Compiling codespan-reporting v0.7.0
   Compiling thiserror-impl v1.0.11
   Compiling cxxbridge-macro v0.1.2 (C:\Users\travis\build\dtolnay\cxx\macro)
error[E0583]: file not found for module `syntax`
  --> macro\src\lib.rs:13:5
   |
13 | mod syntax;
   |     ^^^^^^
   |
   = help: name the file either syntax.rs or syntax\mod.rs inside the directory "macro\src"

error: aborting due to previous error

For more information about this error, try `rustc --explain E0583`.
error: could not compile `cxxbridge-macro`.

@fabjan
Copy link

fabjan commented Feb 19, 2020

Yes!

Hello and thanks for sharing this crate dtolnay, my team is evaluating using it to create some nicer bindings for our C++ code, but Windows support is something we need. Cannot commit to anything as we're still digging through options but we hit this snag pretty quickly.

It's possible to tell git to use Windows symlinks e.g. in your global config or on checkout:

git clone -c core.symlinks=true git@github...

This (creating symlinks) seems to require admin privileges however so is maybe not the nicest solution.

I'm not too familiar with Rust yet, is symlinking like this to share code inside a repo common? Is it too cumbersome to share the code inside as different crates instead?

P.S. please let me know if I'm acting weird, have not been hugely active on GitHub before but decided to be bold and comment instead of lurking.

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 24, 2020

FWIW cargo publish and cargo vendor eliminate the links so I don't expect that they would negatively impact windows support. This issue is specifically for windows CI which is different from windows support in general in that CI needs to run against the source repo, not the published library.

@fabjan
Copy link

fabjan commented Feb 24, 2020

Oh I see... Yeah I checked out the repo to have a known working example to poke at. Using it from Cargo has not been an issue. 👍

So I guess calling this a snag is overstating it.

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 24, 2020

Next error: https://travis-ci.com/dtolnay/cxx/jobs/290316130

$ cargo run --manifest-path demo-rs/Cargo.toml

error: failed to run custom build command for `cxxbridge-demo v0.0.0 (C:\Users\travis\build\dtolnay\cxx\demo-rs)`

Caused by:
  process didn't exit successfully: `C:\Users\travis\build\dtolnay\cxx\target\debug\build\cxxbridge-demo-7cfe4801d6523f80\build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,mmx,sse,sse2")
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "\\\\?\\C:\\Users\\travis\\build\\dtolnay\\cxx\\target\\cxxbridge" "-I" "\\\\?\\C:\\Users\\travis\\build\\dtolnay\\cxx" "-Wall" "-Wextra" "-std=c++11" "-o" "C:\\Users\\travis\\build\\dtolnay\\cxx\\target\\debug\\build\\cxxbridge-demo-0333a5c7c738fe49\\out\\demo-rs\\src\\main.rs.o" "-c" "C:\\Users\\travis\\build\\dtolnay\\cxx\\target\\debug\\build\\cxxbridge-demo-0333a5c7c738fe49\\out\\demo-rs\\src\\main.rs.cc"
cargo:warning=C:\Users\travis\build\dtolnay\cxx\target\debug\build\cxxbridge-demo-0333a5c7c738fe49\out\demo-rs\src\main.rs.cc:1:10: fatal error: demo-cxx/demo.h: No such file or directory
cargo:warning= #include "demo-cxx/demo.h"
cargo:warning=          ^~~~~~~~~~~~~~~~~
cargo:warning=compilation terminated.
exit code: 1

Unclear what could be going wrong here and it's pretty painful to debug via remote CI builds, so hopefully someone with access to a Windows installation can look into this.

I definitely see "-I" "\\\\?\\C:\\Users\\travis\\build\\dtolnay\\cxx" on the gcc command line, which is the location the repo got cloned to, and demo-cxx/demo.h does exist.

@dtolnay
Copy link
Owner Author

dtolnay commented Feb 25, 2020

It turned out to be simple, gcc.exe can't handle UNC include paths. We can work around that.

@dtolnay dtolnay added the windows Issues that manifest on Windows label Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted windows Issues that manifest on Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants