2014-06-08 41 views
2

我想從我的Windows DLL項目中使用源編譯cURL。對於這一點,我安裝在虛擬機與Ubuntu,從http://curl.haxx.se/download/curl-7.37.0.tar.bz2下載捲曲源,解壓縮,並將其配置是這樣的:最小cURL交叉編譯窗口

./configure --prefix=$HOME/devel/curl3 --disable-ftp --disable-file\ 
--disable-ldap --disable-dict --disable-telnet --disable-tftp\ 
--disable-rtsp --disable-pop3 --disable-imap --disable-smtp\ 
--disable-gopher --disable-ares --disable-debug --without-ssl\ 
--without-zlib --without-libidn --build=i586-pc-linux-gnu\ 
--host=i386-pc-mingw32 --disable-shared 

所以我有這樣的輸出:

configure: Configured to build curl/libcurl: 

    curl version:  7.37.0 
    Host setup:  i386-pc-mingw32 
    Install prefix: /home/victor/devel/curl3 
    Compiler:   gcc 
    SSL support:  no  (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl}) 
    SSH support:  no  (--with-libssh2) 
    zlib support:  no  (--with-zlib) 
    GSS-API support: no  (--with-gssapi) 
    SPNEGO support: no  (--with-spnego) 
    TLS-SRP support: no  (--enable-tls-srp) 
    resolver:   default (--enable-ares/--enable-threaded-resolver) 
    ipv6 support:  no  (--enable-ipv6) 
    IDN support:  no  (--with-{libidn,winidn}) 
    Build libcurl: Shared=no, Static=yes 
    Built-in manual: enabled 
    --libcurl option: enabled (--disable-libcurl-option) 
    Verbose errors: enabled (--disable-verbose) 
    SSPI support:  no  (--enable-sspi) 
    ca cert bundle: no 
    ca cert path:  no 
    LDAP support:  no  (--enable-ldap/--with-ldap-lib/--with-lber-lib) 
    LDAPS support: no  (--enable-ldaps) 
    RTSP support:  no  (--enable-rtsp) 
    RTMP support:  no  (--with-librtmp) 
    metalink support: no  (--with-libmetalink) 
    HTTP2 support: disabled (--with-nghttp2) 
    Protocols:  HTTP 

然後,我只是做化妝&使安裝創建文件(libcurl.a和include/curl/)*。 一切運行良好,但問題是:當我導入生成的文件時,缺少一個標頭: sys/socket.h。這個頭文件不是乾淨的MingW32安裝的一部分,因此,帶有--host = i386-pc-mingw32的configure命令不需要它,因爲windows使用winsock,對吧?

缺少什麼我在這裏?

對不起,長時間提問,並提前致謝。

回答

2

我發現了什麼是錯的;

我不得不下載mingw32包,然後將其設置爲配置和make命令的工具鏈。 --host配置也是錯誤的。下載的工具鏈必須指出的「i586的-PC-mingw32msvc」,路徑設置爲:

PATH=(path/to/i586ming):$PATH ./configure <options described above> 
PATH=(path/to/i586ming):$PATH make 
PATH=(path/to/i586ming):$PATH make install 

而且我的輸出是正確的。

1

這個問題也許是一個古老的,但這裏是我做到了..

  1. 我安裝的mingw32

    sudo apt-get install mingw32 
    
  2. 然後用添加的選項--host=i586-mingw32msvc LDFLAGS=-mwindows運行./Configure

    ./configure --host=i586-mingw32msvc LDFLAGS=-mwindows --prefix=path/to/install/to \ 
    --disable-ftp --disable-file --disable-ldap --disable-dict --disable-telnet \ 
    --disable-tftp --disable-rtsp --disable-pop3 --disable-imap --disable-smtp \ 
    --disable-gopher --disable-ares --disable-debug --without-ssl --without-zlib \ 
    --without-libidn --disable-shared 
    

    修改path/to/install/to選項--prefix=

  3. 然後:

    make && make install