Building on Cygwin fails
hydra opened this issue · 4 comments
Building on Cygwin fails:
$ git clone https://github.com/a1ien/rusb.git
$ cd rusb/libusb1-sys/
$ cargo build
Updating crates.io index
Compiling libc v0.2.126
Compiling cc v1.0.73
Compiling pkg-config v0.3.25
Compiling libusb1-sys v0.6.2 (D:\Users\Hydra\Documents\dev\playground\rust\rusb\libusb1-sys)
error: failed to run custom build command for `libusb1-sys v0.6.2 (D:\Users\Hydra\Documents\dev\playground\rust\rusb\libusb1-sys)`
Caused by:
process didn't exit successfully: `D:\Users\Hydra\Documents\dev\playground\rust\rusb\target\debug\build\libusb1-sys-379884adc9dcdc27\build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=LIBUSB_STATIC
cargo:rerun-if-env-changed=LIBUSB_1.0_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
Can't find libusb pkg: Could not run `"pkg-config" "--libs" "--cflags" "libusb-1.0"`
The pkg-config command could not be found.
Most likely, you need to install a pkg-config package for your OS.
If you've already installed it, ensure the pkg-config command is one of the
directories in the PATH environment variable.
If you did not expect this build to link to a pre-installed system library,
then check documentation of the libusb1-sys crate for an option to
build the library from source, or disable features or dependencies
that require pkg-config.
cargo:vendored=1
cargo:static=1
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 3, kind: NotFound, message: "The system cannot find the path specified." }', libusb1-sys\build.rs:108:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
however I have pkg-config
and other crates are able to be installed that use it, e.g, gcov
$ which pkg-config
/usr/bin/pkg-config
$ pkg-config --version
1.8.0
Note that the cygwin path C:\Cygwin\bin
is NOT, and should not, be in the windows System PATH environment. This is normal for cygwin installations. pkg-config however IS in the Cygwin path, as above.
Windows path:
PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\IVI Foundation\IVI\bin;C:\Program Files\IVI Foundation\IVI\bin;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\Program Files\IVI Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\Git\cmd;D:\Users\Hydra\.cargo\bin;D:\Programs\GNUArmTools\active\bin;D:\Programs\NodeJS\active;D:\Users\Hydra\AppData\Local\Microsoft\WindowsApps;D:\Users\Hydra\AppData\Local\atom\bin;D:\Users\Hydra\AppData\Local\GitHubDesktop\bin
Cygwin path:
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/Program Files (x86)/Razer Chroma SDK/bin:/cygdrive/c/Program Files/Razer Chroma SDK/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/OpenSSH:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Program Files (x86)/IVI Foundation/IVI/bin:/cygdrive/c/Program Files/IVI Foundation/IVI/bin:/cygdrive/c/Program Files (x86)/IVI Foundation/VISA/WinNT/Bin:/cygdrive/c/Program Files/IVI Foundation/VISA/Win64/Bin:/cygdrive/c/Program Files (x86)/IVI Foundation/VISA/WinNT/Bin:/cygdrive/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files (x86)/Razer/ChromaBroadcast/bin:/cygdrive/c/Program Files/Razer/ChromaBroadcast/bin:/cygdrive/c/Program Files (x86)/Bitvise SSH Client:/cygdrive/c/Program Files/Git/cmd:/cygdrive/d/Users/Hydra/.cargo/bin:/cygdrive/d/Programs/GNUArmTools/active/bin:/cygdrive/d/Programs/NodeJS/active:/cygdrive/d/Users/Hydra/AppData/Local/Microsoft/WindowsApps:/cygdrive/d/Users/Hydra/AppData/Local/atom/bin:/cygdrive/d/Users/Hydra/AppData/Local/GitHubDesktop/bin
Cygwin packages installed:
$ cygcheck -c
Cygwin Package Information
Package Version Status
_autorebase 001091-1 OK
alternatives 1.3.30c-10 OK
autoconf 15-1 OK
autoconf2.1 2.13-12 OK
autoconf2.5 2.69-5 OK
autoconf2.7 2.71-2 OK
automake 11-1 OK
automake1.10 1.10.3-3 OK
automake1.11 1.11.6-3 OK
automake1.12 1.12.6-3 OK
automake1.13 1.13.4-2 OK
automake1.14 1.14.1-3 OK
automake1.15 1.15.1-2 OK
automake1.16 1.16.5-1 OK
automake1.9 1.9.6-11 OK
base-cygwin 3.8-1 OK
base-files 4.3-3 OK
bash 4.4.12-3 OK
bash-completion 2.7-1 OK
binutils 2.38-1 OK
bzip2 1.0.8-1 OK
ca-certificates 2021.2.52-1 OK
clang 8.0.1-1 OK
compiler-rt 8.0.1-1 OK
coreutils 8.32-1 OK
crypto-policies 20190218-1 OK
csih 0.9.11-1 OK
curl 7.83.1-1 OK
cygrunsrv 1.62-1 OK
cygutils 1.4.17-1 OK
cygwin 3.3.5-1 OK
cygwin-devel 3.3.5-1 OK
dash 0.5.11.5-1 OK
diffutils 3.8-1 OK
editrights 1.03-1 OK
file 5.41-2 OK
findutils 4.9.0-1 OK
gawk 5.1.1-1 OK
gcc-core 11.3.0-1 OK
gcc-g++ 11.3.0-1 OK
getent 2.18.90-4 OK
git 2.36.1-1 OK
grep 3.7-2 OK
groff 1.22.4-1 OK
gzip 1.12-1 OK
hostname 3.13-1 OK
info 6.8-2 OK
ipc-utils 1.0-2 OK
less 590-1 OK
libargp 20110921-3 OK
libatomic1 11.3.0-1 OK
libattr1 2.4.48-2 OK
libblkid1 2.33.1-2 OK
libbrotlicommon1 1.0.9-2 OK
libbrotlidec1 1.0.9-2 OK
libbz2_1 1.0.8-1 OK
libc++-devel 8.0.1-1 OK
libc++1 8.0.1-1 OK
libc++abi-devel 8.0.1-1 OK
libc++abi1 8.0.1-1 OK
libcbor 0.9.0-3 OK
libcbor-devel 0.9.0-3 OK
libcharset1 1.16-2 OK
libclang8 8.0.1-1 OK
libcom_err2 1.44.5-1 OK
libcrypt2 4.4.20-1 OK
libcurl-devel 7.83.1-1 OK
libcurl4 7.83.1-1 OK
libdb5.3 5.3.28-2 OK
libedit0 20130712-1 OK
libexpat1 2.4.1-1 OK
libfdisk1 2.33.1-2 OK
libffi6 3.2.1-2 OK
libfido2 1.10.0-1 OK
libgc1 8.0.6-1 OK
libgcc1 11.3.0-1 OK
libgcrypt20 1.10.1-1 OK
libgdbm6 1.18.1-1 OK
libgdbm_compat4 1.18.1-1 OK
libgmp10 6.2.1-2 OK
libgomp1 11.3.0-1 OK
libgpg-error0 1.37-1 OK
libgsasl-common 1.8.0-4 OK
libgsasl7 1.8.0-4 OK
libgssapi_krb5_2 1.15.2-2 OK
libguile2.2_1 2.2.7-1 OK
libiconv-devel 1.16-2 OK
libiconv2 1.16-2 OK
libidn11 1.33-1 OK
libidn2_0 2.3.2-1 OK
libintl8 0.21-1 OK
libisl23 0.24-2 OK
libk5crypto3 1.15.2-2 OK
libkrb5_3 1.15.2-2 OK
libkrb5support0 1.15.2-2 OK
libllvm8 8.0.1-1 OK
libltdl7 2.4.7-1 OK
liblz4_1 1.7.5-1 OK
liblzma5 5.2.5-1 OK
libmpc3 1.2.1-2 OK
libmpfr6 4.1.0-2 OK
libncursesw10 6.1-1.20190727 OK
libnghttp2_14 1.47.0-1 OK
libntlm0 1.4-1 OK
libopenldap2 2.6.2-1 OK
libopenldap2_4_2 2.6.2-1 OK
libopenldap2_5_0 2.6.2-1 OK
libp11-kit0 0.23.20-1 OK
libpcre1 8.45-1 OK
libpcre2_8_0 10.40-1 OK
libpipeline1 1.5.3-1 OK
libpkgconf3 1.8.0-1 OK
libpolly8 8.0.1-1 OK
libpopt-common 1.18-1 OK
libpopt0 1.18-1 OK
libpsl5 0.21.1-1 OK
libquadmath0 11.3.0-1 OK
libreadline7 8.1-2 OK
libsasl2_3 2.1.27-1 OK
libsigsegv2 2.10-2 OK
libsmartcols1 2.33.1-2 OK
libsodium-common 1.0.18-1 OK
libsodium23 1.0.18-1 OK
libsqlite3_0 3.34.0-1 OK
libssh2_1 1.10.0-1 OK
libssl-devel 1.1.1o-1 OK
libssl1.1 1.1.1o-1 OK
libstdc++6 11.3.0-1 OK
libtasn1_6 4.14-1 OK
libunistring2 0.9.10-1 OK
libunwind-devel 8.0.1-1 OK
libunwind1 8.0.1-1 OK
libusb1.0 1.0.21-1 OK
libusb1.0-devel 1.0.21-1 OK
libuuid-devel 2.33.1-2 OK
libuuid1 2.33.1-2 OK
libxml2 2.9.12-2 OK
libxxhash0 0.8.0-1 OK
libzstd1 1.5.2-1 OK
login 1.13-1 OK
m4 1.4.19-1 OK
make 4.3-1 OK
man-db 2.10.2-1 OK
mintty 3.6.1-1 OK
ncurses 6.1-1.20190727 OK
openssh 9.0p1-1 OK
openssl 1.1.1o-1 OK
p11-kit 0.23.20-1 OK
p11-kit-trust 0.23.20-1 OK
perl 5.32.1-2 OK
perl-Class-Inspector 1.36-3 OK
perl-Encode-Locale 1.05-4 OK
perl-Error 0.17029-2 OK
perl-File-Listing 6.15-1 OK
perl-File-ShareDir 1.118-2 OK
perl-HTML-Parser 3.78-1 OK
perl-HTML-Tagset 3.20-8 OK
perl-HTTP-Cookies 6.10-2 OK
perl-HTTP-Date 6.05-2 OK
perl-HTTP-Message 6.36-1 OK
perl-HTTP-Negotiate 6.01-8 OK
perl-IO-HTML 1.004-2 OK
perl-libwww-perl 6.66-1 OK
perl-LWP-MediaTypes 6.04-3 OK
perl-Net-HTTP 6.22-1 OK
perl-Scalar-List-Utils 1.62-1 OK
perl-TermReadKey 2.38-3 OK
perl-Test-Harness 3.44-1 OK
perl-TimeDate 2.33-2 OK
perl-Try-Tiny 0.31-1 OK
perl-Unicode-Normalize 1.26-3 OK
perl-URI 5.10-1 OK
perl-WWW-RobotRules 6.02-8 OK
perl_autorebase 5.32.1-2 OK
perl_base 5.32.1-2 OK
pkg-config 1.8.0-1 OK
pkgconf 1.8.0-1 OK
publicsuffix-list-dafsa 20220430-1 OK
python2 2.7.18-4 OK
python27 2.7.18-4 OK
python27-pip 20.3.3-2 OK
python27-setuptools 41.2.0-1 OK
rebase 4.5.0-1 OK
rsync 3.2.3+20200903+git9f9240b-4 OK
run 1.3.4-2 OK
sed 4.8-1 OK
tar 1.34-1 OK
terminfo 6.1-1.20190727 OK
terminfo-extra 6.1-1.20190727 OK
texinfo 6.8-2 OK
tree 1.7.0-1 OK
tzcode 2022a-1 OK
tzdata 2022a-1 OK
unzip 6.0-17 OK
util-linux 2.33.1-2 OK
vim 8.2.4372-1 OK
vim-common 8.2.4372-1 OK
vim-doc 8.2.4372-1 OK
vim-minimal 8.2.4372-1 OK
w32api-headers 10.0.0-1 OK
w32api-runtime 10.0.0-1 OK
which 2.20-2 OK
windows-default-manifest 6.4-1 OK
xxd 8.2.4372-1 OK
xz 5.2.5-1 OK
zip 3.0-12 OK
zlib0 1.2.12-1 OK
zstd 1.5.2-1 OK
$ uname
CYGWIN_NT-10.0-19044
Windows 10 x64 + Cygwin x86_64.
I'm here because I'm trying to build probe-run
which uses libusb 0.5 as a dependency which also fails to build for a different, but related libusb
reason, see knurling-rs/probe-run#325
I not recommend use cygwin for building library. For windows better try vcpkg. And also in cygwin really outdated packages. libusb 1.0.21 it's released around 2016 year.
whilst I agree that some cygwin packages are old, I don't really want yet another package manager to install, maintain and update on all the projects development machines. Also, the prerequisites for vcpkg list Visual Studio 2015 or newer, I don't fancy having to install and maintain another IDE either, the project already uses CLion and Eclipse.
I'm also not sure about compatibility between vcpkg compiled packages and the rest of the tools and ecosystem. This is why I don't build on WSL which is binary incompatible.
I'll look at vcpkg, I'd never heard of it before, but if you have other suggestions or solutions that would be preferred, keep me posted.
- vcpkg it's recommend package manager for windows by Microsoft. They develop and maintain in.
- You don't need install Visual Studio ide you just need msvc compiler, Visual Studio C++ Build Tools if be more correct.
- For building rusb(and libusb1-sys) you only need compiler. If libusb1-sys didn't find any suitable libusb version they build from vendored source code. But you need only compiler, for example the msvc and not cygwin.
If you setup rust fro windows for use msvc then you have less problems. The msvc compiler is free for use.
P.S. cygwin it's crutch try avoid it in all place where it's possible. For use rusb they not need entirely.
P.S.2 Rust and cygwin don't work well together.