如何在 Linux 上交叉编译 Windows 的“cURL”(实际上使用 kali)?或者是否有已经构建了交叉编译环境或易于构建交叉编译环境的linux发行版? 请帮忙!
我让 Mingw 可以正常使用其包含目录中已有的头文件。现在我编译了 cURL 并验证了它在 Mingw 的 include 目录中的存在。但现在当我包括<curl/curl.h>
时在我的代码中,这是我在编译时遇到的错误:
/tmp/ccsrpc1o.o:https.c:(.text+0x1c): undefined reference to `__imp__curl_global_init'
/tmp/ccsrpc1o.o:https.c:(.text+0x26): undefined reference to `__imp__curl_easy_init'
/tmp/ccsrpc1o.o:https.c:(.text+0x4a): undefined reference to `__imp__curl_easy_setopt'
/tmp/ccsrpc1o.o:https.c:(.text+0x5a): undefined reference to `__imp__curl_easy_perform'
/tmp/ccsrpc1o.o:https.c:(.text+0x73): undefined reference to `__imp__curl_easy_strerror'
/tmp/ccsrpc1o.o:https.c:(.text+0xb2): undefined reference to `__imp__curl_easy_cleanup'
/tmp/ccsrpc1o.o:https.c:(.text+0xbc): undefined reference to `__imp__curl_global_cleanup'
collect2: ld returned 1 exit status
最佳答案
首先使用以下命令交叉编译 cURL:
$ ./configure --host=i586-mingw32msvc --enable-http --with-zlib --with-winssl
$ make
$ make install
现在您可以编译代码了:
$ i586-mingw32msvc-gcc -o https.exe https.c -lcurl
或
$ i586-mingw32msvc-gcc -o https.exe https.c /usr/i586-mingw32msvc/lib/libcurl.dll.a
关于c++ - cURL交叉编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31260830/