libuvc-rs
libuvc-rs copied to clipboard
Can't build on Windows
Are there any instructions to build it on Windows?
- I run 'cargo build' but failed with
wrapper.h:1:10: fatal error: 'libuvc/libuvc.h' file not found
. - I download libuvc source code and extracted to uvc-src/source, ran 'cargo build' in uvc-src, but end up with the error:
error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-4dd37a42ddbc29e6\\out\\include" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\libusb1-sys-aaea21a84a91340c\\out\\include" "-Fod:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-4dd37a42ddbc29e6\\out\\source/src/ctrl.o" "-c" "source/src/ctrl.c" with args "cl.exe" did not execute successfully (status code exit code: 2).
This crate is using cargo features, you can build a static/vendored binary with cargo b --features vendor
. The sources can be downloaded using git submodule --init --recursive
instead of extracting an archive
@mulimoen Still getting the error.
error: failed to run custom build command for `uvc-src v0.2.1 (D:\workspace\libuvc-rs\uvc-src)`
Caused by:
process didn't exit successfully: `D:\workspace\libuvc-rs\target\debug\build\uvc-src-93253615d4c37a5c\build-script-build` (exit code: 1)
--- stderr
error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "D:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\include" "-I" "D:\\workspace\\libuvc-rs\\target\\debug\\build\\mozjpeg-sys-ddb6b1c8b1f1aa7b\\out\\include" "-I" "C:\\Users\\1\\.cargo\\registry\\src\\crates.rustcc.com-a21e0f92747beca3\\mozjpeg-sys-0.10.13\\vendor" "-I" "D:\\workspace\\libuvc-rs\\target\\debug\\build\\libusb1-sys-6c610780e57f042a\\out\\include" "-FoD:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\source/src/ctrl.o" "-c" "source/src/ctrl.c" with args "cl.exe" did not execute successfully (status code exit code: 2).
@pansila That error is a bit mysterious, could you try getting a more verbose output with e.g. cargo b --features vendor -vvv
?
If you don't have libusb
installed you might have to configure libusb
to also be vendored. You can do this by adding features = ["vendored"]
under uvc-src/Cargo.toml
.
<sys/time.h> can not be found. It's not in the MSVC toolchain. A similar one is C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\time.h
. I can only find it in the C:\msys64\mingw64\x86_64-w64-mingw32\include\sys\time.h
, but building it against mingw's headers doesn't work.
...
running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\include" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\mozjpeg-sys-ddb6b1c8b1f1aa7b\\out\\include" "-I" "C:\\Users\\1\\.cargo\\registry\\src\\crates.rustcc.com-a21e0f92747beca3\\mozjpeg-sys-0.10.13\\vendor" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\libusb1-sys-6c610780e57f042a\\out\\include" "-Fod:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\source/src/frame.o" "-c" "source/src/frame.c"
misc.c
init.c
ctrl.c
diag.c
ctrl-gen.c
stream.c
device.c
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
frame.c
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
exit code: 0
exit code: 2
exit code: 2
exit code: 2
exit code: 2
exit code: 2
exit code: 2
exit code: 2
running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\include" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\mozjpeg-sys-ddb6b1c8b1f1aa7b\\out\\include" "-I" "C:\\Users\\1\\.cargo\\registry\\src\\crates.rustcc.com-a21e0f92747beca3\\mozjpeg-sys-0.10.13\\vendor" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\libusb1-sys-6c610780e57f042a\\out\\include" "-Fod:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\source/src/frame-mjpeg.o" "-c" "source/src/frame-mjpeg.c"
frame-mjpeg.c
d:\workspace\libuvc-rs\target\debug\build\uvc-src-a0505ccbf953a2fc\out\include\libuvc/libuvc.h(10): fatal error C1083: 无法打开包括文件: “sys/time.h”: No such file or directory
exit code: 2
--- stderr
error occurred: Command "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\include" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\mozjpeg-sys-ddb6b1c8b1f1aa7b\\out\\include" "-I" "C:\\Users\\1\\.cargo\\registry\\src\\crates.rustcc.com-a21e0f92747beca3\\mozjpeg-sys-0.10.13\\vendor" "-I" "d:\\workspace\\libuvc-rs\\target\\debug\\build\\libusb1-sys-6c610780e57f042a\\out\\include" "-Fod:\\workspace\\libuvc-rs\\target\\debug\\build\\uvc-src-a0505ccbf953a2fc\\out\\source/src/ctrl.o" "-c" "source/src/ctrl.c" with args "cl.exe" did not execute successfully (status code exit code: 2).
I'm afraid using this for windows is not possible at the momen. The c library (which this crate wraps) does not support windows: https://github.com/libuvc/libuvc/issues/136. Workarounds exists, see that issue. If you install a functioning libuvc
, it should be possible to link to system uvc
, but I do not have any windows experience, so I can't help you much there.
Thanks for your quick reply. Looks libuvc has no plan to support Windows.
https://github.com/pupil-labs/libuvc You will have better lucks with the above libuvc fork for Windows.