Open TomatoMr opened 2 years ago
Yes, please see the README for instructions
Oh sorry, misunderstood your question. I thought you asked if it builds on Windows.
Building from Linux to Windows should work since we support Windows builds, but we don't have it documented.
😁Thank you very much for your reply. I would be very grateful if there are documents or construction guidelines.
I used the build tool: cargo-xwin , and tried to run:
cargo xwin build --target x86_64-pc-windows-msvc
then, I got the failed info:
= note: lld-link: error: could not open 'wpcap.lib': No such file or directory
lld-link: error: could not open 'pcap.lib': No such file or directory
I have downloaded the SDK of WinPcap and copied wpcap.lib and packet.lib in the x64 directory to Linux. But I can't find pcap.lib
I'm no expert on cross-compiling so I can't help you here. However, I'll reopen the issue so that somebody else perhaps will see this and answer.
tks🌹
have you try use LIB
env variable to pin point the location of wpcap.lib
? also try to just put the file at the root of the project. Should work.
have you try use
LIB
env variable to pin point the location ofwpcap.lib
? also try to just put the file at the root of the project. Should work.
Yes, I tried it, it didn't work. I also tried to copy and rename wpcap.lib
to pcap.lib
, but it still failed with the error: lld-link: error: could not open 'pcap.lib': No such file or directory
. I can't find pcap.lib
.
You might try building with a build.rs (which puts the build information into the build process) instead of the manual environmental variable. The following build.rs works for me on a "built for windows, on windows" build which I haven't tried from Linux, but should be a reasonable starting point. It assumes the same directory structure as what comes out of the npcap dev libs, e.g., that if you want a x64 bit build, you want to use the "lib/x64" subdir.
robsh@LAPTOP-O7RS71IJ MINGW64 ~/git/myproj (main)
$ find lib/
lib/
lib/x64
lib/x64/Packet.lib
lib/x64/wpcap.lib
robsh@LAPTOP-O7RS71IJ MINGW64 ~/git/myproj (main)
$ ls build.rs
build.rs
$ cat build.rs
use std::env;
use std::path::Path;
fn main() {
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
println!(
"cargo:rustc-link-search=native={}",
Path::new(&dir).join("lib/x64").display()
);
}
You might try building with a build.rs (which puts the build information into the build process) instead of the manual environmental variable. The following build.rs works for me on a "built for windows, on windows" build which I haven't tried from Linux, but should be a reasonable starting point. It assumes the same directory structure as what comes out of the npcap dev libs, e.g., that if you want a x64 bit build, you want to use the "lib/x64" subdir.
robsh@LAPTOP-O7RS71IJ MINGW64 ~/git/myproj (main) $ find lib/ lib/ lib/x64 lib/x64/Packet.lib lib/x64/wpcap.lib robsh@LAPTOP-O7RS71IJ MINGW64 ~/git/myproj (main) $ ls build.rs build.rs $ cat build.rs use std::env; use std::path::Path; fn main() { let dir = env::var("CARGO_MANIFEST_DIR").unwrap(); println!( "cargo:rustc-link-search=native={}", Path::new(&dir).join("lib/x64").display() ); }
@robs-zeynet thank you, i had tried it, but it not worked
I want to build on Linux to Windows, can it supports?