Skip to content

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

Open
@lepapareil

Description

@lepapareil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions