I'm currently trying to cross compile libcurl in c for Windows 32x on Ubuntu 64x 14.04. After a little research, I followed these steps:
1) Download the library from https://curl.haxx.se/download.html
2) Go to the extracted libcurl folder and do:
./configure --host=i686-w64-mingw32 --build=i686-pc-linux-gnu --prefix=/usr/i686-w64-mingw32/ --enable-static --disable-shared
3) Run: make
4) Run: sudo make install
Then I added these include statements:
#include <winsock2.h> // Needed for curl
Now I tried to compile my code with the following arguments:
i686-w64-mingw32-gcc main.c -o main.exe -L/usr/i686-w64-mingw32/lib -lcurl
The compiler returned the following error code:
/tmp/ccebLf6U.o:main.c:(.text+0x336): Not defined reference to `_imp__curl_easy_init' /tmp/ccebLf6U.o:main.c:(.text+0x365): Not defined reference to `_imp__curl_easy_setopt' /tmp/ccebLf6U.o:main.c:(.text+0x372): Not defined reference to `_imp__curl_easy_perform' /tmp/ccebLf6U.o:main.c:(.text+0x3f4): Not defined reference to `_imp__curl_easy_cleanup' collect2: error: ld returned 1 exit status
Does anyone know how to fix this?
[EDIT]
Something really interesting, I came across the fact that if you call curl-config, you get a bunch of compiler options.
c linux ubuntu libcurl cross-compiling
Qubasa
source share