curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: MinGW Cross-Compiling results in error "ld: cannot find -link"

From: René Berber via curl-library <>
Date: Mon, 28 Oct 2019 20:35:39 -0600

On 10/27/2019 5:25 PM, Michael Fabian Dirks via curl-library wrote:

> I'm trying to build libcurl for Windows using Ubuntu's 'mingw-w64'
> package. Since I'm building from the git repository, and the CMake
> script has a message stating that it is poorly maintained, I wanted to
> build it through configure with make. As there is no configure file in
> the git repo, I made one using:
>> git reset --hard
>> git clean -fdx
>> autoreconf -i
> It configures fine, but for an unknown reason a sed command is added to
> the linker command which replaces all '-lLIBRARY' with '-link LIBRARY',
> and it seems impossible to remove. Removing the
> '--host=x86_64-w64-mingw32' makes it link, but then fails that it

The host is fine.

Building from the tar.xz (or equivalent) does already have a useful
configure file.

No use wasting time with other procedures if they don't work correctly,
no idea where that sed command comes from, but its obviously incorrect
(could be a product of a badly configured build environment: gnu linker
was not found at configure time, config.log should show that, therefore
Microsoft linker was assumed, or found first in the PATH).

I've build curl many times in a (GNU) cross-compile environment, and it
works fine (build and library). In my case I use a customized MXE cross
environment ( which also builds all the tools
on the environment, and sets variables, and all the details.

Received on 2019-10-29