Cargo Build Error in curl-sys


#1

Hey all,

new to Rust, and trying the example here: https://github.com/gifnksm/twitter-api-rs

cargo build is failing on curl-sys (I think) with a file not found error.

I think this is related to using 32bit rather than 64 - there is a similar issue logged on curl-rust git, (can’t post a link)

I’ve posted the error on Stack Overflow, no answers as yet - http://stackoverflow.com/questions/32487166/cargo-build-error-file-missing

any and all help would be very welcome - totally stuck!


#2

Hi @Zebedee68, I’m pretty sure that’s because you run cargo build from windows cmd and not from shell that comes with mingw (bash in case of MSYS2). So command

sh -c "/c/Users/Me/.ca...url/configure --args"

that build script of curl-sys issue to cmd will fail.


#3

Thanks semmaz I’m pretty sure that is the problem…

I get the same problem running ‘cargo build’ from the mingw-w64 command prompt, but perhaps I haven’t got the paths set right.

MSYS2 is a whole other ballgame - I had a quick look, but failed to install the mingw toolchain - the learning curve is suddenly exponential :wink:

Anyone have a good recommendation for a tutorial in setting up and running Rust with msys & mingw on Windows?


#4

Follow Building on Windows section from rust repo. Just skip step 4, build-script of curl-sys will do that for you (it will build curl from the source).
Now you should have all needed for successful build of curl-rust (you don’t need curl package from mingw).

Do note, that MSYS2 have different packages for different targets.
This goes like mingw-w64-${target-arch}-package-name.

For example, if you want to build your project that uses hyper with openssl for win x64 target - launch mingw from mingw64_shell.bat and ensure that you have openssl package for your target

$ pacman -S mingw-w64-x86_64-openssl

Build!

$ cargo build

Also take a look at pacman page at ArchWiki if you have a trouble managing packages.

Hope this makes sense to you.


Openssl-sys on rust 32 bit msvc: Does it work?
#5

Brilliant Semmaz, that’s great, I’ll follow that…

from Stack Overflow:

My guess is that the --prefix=D:/Proj/… part is wrong, and should be --prefix=/d/Proj/…

In https://github.com/carllerche/curl-rust/blob/master/curl-sys/build.rs#L110 , there is a hardcoded replace(“C:\”, “/c/”) but no handling of other unit labels.

In other words, it seems curl-rust currently does not support building when your project root is not on C:. Would it be possible to move your projects directory, or at least the code for this project?

I think the next step will be to uninstall everything, and reinstall on the C: drive (currently Rust & my projects dir are on D: )


#6

You can just make a symbolic link or junction on C:.


#7

Thanks gkoz, I’ll give mklink a try - every day is a schoolday :wink:


#8

Yeah, that might be a problem.

Build script of curl-sys will try to make a suitable for mingws shell string from

C:\\msys64\\home\\user\\.cargo\\registry\\...\\curl/configure --args --prefix=C:\\msys64\\home\\user\\my-proj\\...\\out

to

/c/msys64/home/user/.cargo/registry/.../curl/configure --args --prefix=/c/msys64/home/user/my-proj/.../out

Which is troublesome if either MSYS2 (msys64) or your project isn’t located on C: (as assumed by build script).


#9

Yeah, I have neither MSYS2, mingw or Rust installed to the default locations…

I’ll play around with setting symlinks, or if necessary reinstall everything using the defaults to test this when I get a chance.

Anything with an absolute path in any library will fail if not.

Thanks for your input guys.