linklayer / cantact

Drivers and Command Line Interface for CANtact tools
http://cantact.io
MIT License
46 stars 12 forks source link

Building Cantact.dll #4

Closed elliotwoods closed 3 years ago

elliotwoods commented 3 years ago

I'm trying to build a Cantact.dll in x64 (Actually I need to wrap it in .NET for an x64 .NET project)

I can find an x86 version of cantact.dll in the cantact branch of your busmaster fork Also I can see in this repo there is the driver/src/c/mod.rs which seems to be the source code for cantact.dll

However, I'm not sure how to build this to x64 When I try to build the repo with cargo i get the following errors:

C:\dev\cantact>cargo install --path .
  Installing cantact v0.0.7 (C:\dev\cantact)
    Updating crates.io index
   Compiling winapi v0.3.9
   Compiling autocfg v1.0.1
   Compiling proc-macro2 v1.0.24
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.48
   Compiling cfg-if v1.0.0
   Compiling crc32fast v1.2.1
   Compiling version_check v0.9.2
   Compiling winapi-build v0.1.1
   Compiling libc v0.2.80
   Compiling take_mut v0.2.2
   Compiling rle-decode-fast v1.0.1
   Compiling adler32 v1.2.0
   Compiling cfg-if v0.1.10
   Compiling vcpkg v0.2.10
   Compiling cc v1.0.62
   Compiling pkg-config v0.3.19
   Compiling serde_derive v1.0.117
   Compiling serde v1.0.117
   Compiling lazy_static v1.4.0
   Compiling maybe-uninit v2.0.0
   Compiling bitflags v1.2.1
   Compiling winapi v0.2.8
   Compiling unicode-segmentation v1.7.0
   Compiling log v0.4.11
   Compiling linked-hash-map v0.5.3
   Compiling hashbrown v0.9.1
   Compiling cantact-driver v0.0.7 (C:\dev\cantact\driver)
   Compiling unicode-width v0.1.8
   Compiling strsim v0.10.0
   Compiling os_str_bytes v2.4.0
   Compiling vec_map v0.8.2
   Compiling textwrap v0.12.1
   Compiling yaml-rust v0.4.4
   Compiling shell32-sys v0.1.2
   Compiling ole32-sys v0.2.0
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling num-traits v0.2.14
   Compiling crossbeam-utils v0.7.2
   Compiling num-integer v0.1.44
   Compiling indexmap v1.6.0
   Compiling heck v0.3.1
   Compiling libflate v0.1.27
   Compiling quote v1.0.7
   Compiling crossbeam-channel v0.4.4
   Compiling winapi-util v0.1.5
   Compiling time v0.1.44
   Compiling atty v0.2.14
   Compiling ctrlc v3.1.7
   Compiling filetime v0.2.13
   Compiling termcolor v1.1.0
   Compiling tar v0.4.30
   Compiling chrono v0.4.19
   Compiling libusb1-sys v0.3.7
   Compiling simplelog v0.8.0
   Compiling clap_derive v3.0.0-beta.2
   Compiling clap v3.0.0-beta.2
   Compiling app_dirs v1.2.1
   Compiling toml v0.5.7
   Compiling cantact v0.0.7 (C:\dev\cantact)
error[E0308]: mismatched types
  --> src/main.rs:37:9
   |
36 |     let result = match matches.subcommand() {
   |                        -------------------- this expression has type `std::option::Option<(&str, &clap::ArgMatches)>`
37 |         ("dump", Some(m)) => dump::cmd(m),
   |         ^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found tuple
   |
   = note: expected enum `std::option::Option<(&str, &clap::ArgMatches)>`
             found tuple `(_, _)`

error[E0308]: mismatched types
  --> src/main.rs:38:9
   |
36 |     let result = match matches.subcommand() {
   |                        -------------------- this expression has type `std::option::Option<(&str, &clap::ArgMatches)>`
37 |         ("dump", Some(m)) => dump::cmd(m),
38 |         ("send", Some(m)) => send::cmd(m),
   |         ^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found tuple
   |
   = note: expected enum `std::option::Option<(&str, &clap::ArgMatches)>`
             found tuple `(_, _)`

error[E0308]: mismatched types
  --> src/main.rs:39:9
   |
36 |     let result = match matches.subcommand() {
   |                        -------------------- this expression has type `std::option::Option<(&str, &clap::ArgMatches)>`
...
39 |         ("cfg", Some(m)) => cfg::cmd(m),
   |         ^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found tuple
   |
   = note: expected enum `std::option::Option<(&str, &clap::ArgMatches)>`
             found tuple `(_, _)`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
error: failed to compile `cantact v0.0.7 (C:\dev\cantact)`, intermediate artifacts can be found at `C:\dev\cantact\target`

Caused by:
  could not compile `cantact`.

To learn more, run the command again with --verbose.

I will keep trying here

elliotwoods commented 3 years ago

i managed to get this to work (by just building the library and not the app)