Code Monkey home page Code Monkey logo

Comments (6)

dtolnay avatar dtolnay commented on July 28, 2024

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`.

from cxx.

fabjan avatar fabjan commented on July 28, 2024

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.

from cxx.

dtolnay avatar dtolnay commented on July 28, 2024

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.

from cxx.

fabjan avatar fabjan commented on July 28, 2024

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.

from cxx.

dtolnay avatar dtolnay commented on July 28, 2024

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.

from cxx.

dtolnay avatar dtolnay commented on July 28, 2024

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

from cxx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.