Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to use pkg_config instead of vcpkg when building with mingw64 on Windows #484

Open
lepapareil opened this issue Jan 9, 2023 · 1 comment · May be fixed by #486
Open

Comments

@lepapareil
Copy link

lepapareil commented Jan 9, 2023

Hi @alexcrichton, and many thks for your work 😀.

I am having the same need as @ian-p-cooke had 4 years ago 👉 #221.
I decided to use mingw64 to build curl-4.dll on Windows instead of vcpkg. It works as expected following these steps:

  • installing msys2
  • installing base-devel and mingw-w64-x86_64-toolchain
  • building curl 7.87 schannel from source for mingw64

Then I build my rust app with crate-sys dependency with these prerequisites:

  • adding mingw64/bin dir to path
  • rust toolchain stable-gnu

I expected curl-sys to link my mingw64/curl-4.dll, but it does not permit the use of mingw64's pkg_config. Instead, the crate uses embedded curl 7.86-DEV as mentioned in documentation.

So, to achieve my goal, I had to update curl-sys/build.rs line 38 like this:

if windows {
  if try_vcpkg() {
    return;
    } else if try_pkg_config() {
        return;
      }
  } else if try_pkg_config() {
    return;
  }
}

With this update, curl-sys correctly links my rust app with my fresh mingw64/curl-4.dll.

Now that compiling curl with mingw64 is working easily, I think that we could allow curl-sys to use pkg_config instead of vcpkg according to the dev's choice.

@lepapareil lepapareil changed the title Add the ability to use Pkg_config instead of Vcpkg when building with Mingw64 on Windows Add the ability to use pkg_config instead of vcpkg when building with mingw64 on Windows Jan 9, 2023
@lepapareil lepapareil linked a pull request Feb 10, 2023 that will close this issue
@theoparis
Copy link

I would also like to be able to use pkg-config on other platforms such as Linux to use the system libcurl, which I have built with aws-lc. This would also allow using curl with HTTP/3 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants