curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Can't build CURL with nghttp2 statically

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 27 Nov 2017 16:48:02 -0500

On 11/27/2017 4:26 PM, Thomas van Hesteren via curl-library wrote:
> I have build nghttp2 and OpenSSL with the following command both
> statically and shared:
> OpenSSL:
> wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
> tar -xvzf openssl-1.1.0g.tar.gz
> cd openssl-1.1.0g/
> ./Configure mingw shared --cross-compile-prefix=i686-w64-mingw32-
> --prefix=/opt/mingw64/Win32
> make
> make install
> NGHTTP2
> wget
> https://github.com/nghttp2/nghttp2/releases/download/v1.28.0/nghttp2-1.28.0.tar.gz
> tar xf nghttp2-1.28.0.tar.gz
> cd nghttp2-1.28.0/
> ./configure --host=i686-w64-mingw32 --prefix=/opt/mingw64/Win32
> OPENSSL_CFLAGS="/I/opt/mingw64/Win32/openssl/include"
> OPENSSL_LIBS="-L/opt/mingw64/Win32/openssl/lib -lssl -lcrypto"
> make
> make install
>
> When I build Curl dynamically with the following command it works fine:
> i686-w64-mingw32-g++ -Wall Programm.cpp -o Programm.exe
> -I/opt/mingw64/Win32/include -L/opt/mingw64/Win32/lib -static-libgcc
> -static-libstdc++ -DCURL_STATICLIB -lcurl -lnghttp2 -lssl -lcrypto
> -lpthread -lws2_32 -std=c++11
>
> However, when I try to build Curl statically with the following
> command it fails:
> i686-w64-mingw32-g++ -Wall -static Programm.cpp -o Programm.exe
> -I/opt/mingw64/Win32/include -L/opt/mingw64/Win32/lib -static-libgcc
> -static-libstdc++ -DCURL_STATICLIB -lcurl -lnghttp2 -lssl -lcrypto
> -lssl -lcrypto -lz -lpthread -lws2_32 -std=c++11
>
> The errors returned are:
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x47):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x77):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xaf):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x448):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x4ac):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x5d4):
> more undefined references to
> `_imp__nghttp2_session_get_stream_user_data' follow
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x6ee):
> undefined reference to `_imp__nghttp2_session_want_write'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x75e):
> undefined reference to `_imp__nghttp2_priority_spec_init'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x7e2):
> undefined reference to `_imp__nghttp2_submit_priority'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x7ef):
> undefined reference to `_imp__nghttp2_session_send'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x8d3):
> undefined reference to `_imp__nghttp2_session_del'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x94d):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xb43):
> undefined reference to `_imp__nghttp2_submit_rst_stream'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xb4e):
> undefined reference to `_imp__nghttp2_is_fatal'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xb69):
> undefined reference to `_imp__nghttp2_session_get_remote_settings'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xcdb):
> undefined reference to `_imp__nghttp2_submit_rst_stream'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xce4):
> undefined reference to `_imp__nghttp2_is_fatal'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xda8):
> undefined reference to `_imp__nghttp2_session_set_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xe80):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xeca):
> undefined reference to `_imp__nghttp2_session_set_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xf6d):
> undefined reference to `_imp__nghttp2_session_want_read'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xf87):
> undefined reference to `_imp__nghttp2_session_want_write'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0xfc7):
> undefined reference to `_imp__nghttp2_session_mem_recv'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x1036):
> undefined reference to `_imp__nghttp2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x11c5):
> undefined reference to `_imp__nghttp2_http2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x1298):
> undefined reference to `_imp__nghttp2_session_resume_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x12ca):
> undefined reference to `_imp__nghttp2_is_fatal'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x176c):
> undefined reference to `_imp__nghttp2_submit_request'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x17bb):
> undefined reference to `_imp__nghttp2_session_send'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x17f9):
> undefined reference to `_imp__nghttp2_session_resume_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x1d0c):
> undefined reference to `_imp__nghttp2_session_mem_recv'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x1d19):
> undefined reference to `_imp__nghttp2_is_fatal'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x1f9e):
> undefined reference to `_imp__nghttp2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2037):
> undefined reference to `_imp__nghttp2_session_callbacks_new'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2071):
> undefined reference to `_imp__nghttp2_session_callbacks_set_send_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2086):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_frame_recv_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x209b):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_invalid_frame_recv_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x20b0):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_data_chunk_recv_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x20c5):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_before_frame_send_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x20da):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_frame_send_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x20ef):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_frame_not_send_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2104):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_stream_close_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2119):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_begin_headers_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x212e):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_on_header_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2143):
> undefined reference to
> `_imp__nghttp2_session_callbacks_set_error_callback'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x215e):
> undefined reference to `_imp__nghttp2_session_client_new'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x216d):
> undefined reference to `_imp__nghttp2_session_callbacks_del'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x21b7):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x21e7):
> undefined reference to `_imp__nghttp2_session_get_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x22bc):
> undefined reference to `_imp__nghttp2_version'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x22f2):
> undefined reference to `_imp__nghttp2_http2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2510):
> undefined reference to `_imp__nghttp2_session_set_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2555):
> undefined reference to `_imp__nghttp2_submit_rst_stream'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2631):
> undefined reference to `_imp__nghttp2_pack_settings_payload'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2751):
> undefined reference to `_imp__nghttp2_session_resume_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x298c):
> undefined reference to `_imp__nghttp2_submit_settings'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x29bd):
> undefined reference to `_imp__nghttp2_session_set_local_window_size'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2a41):
> undefined reference to `_imp__nghttp2_session_upgrade'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2a54):
> undefined reference to `_imp__nghttp2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2a85):
> undefined reference to `_imp__nghttp2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2ab5):
> undefined reference to `_imp__nghttp2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2afb):
> undefined reference to `_imp__nghttp2_session_set_stream_user_data'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2b49):
> undefined reference to `_imp__nghttp2_session_mem_recv'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2b54):
> undefined reference to `_imp__nghttp2_is_fatal'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2b88):
> undefined reference to `_imp__nghttp2_strerror'
> /opt/mingw64/Win32/lib/libcurl.a(libcurl_la-http2.o):http2.c:(.text+0x2bb5):
> undefined reference to `_imp__nghttp2_strerror'
> collect2: error: ld returned 1 exit status
>
> What am I doing wrong when trying to build CURL statically? I included
> everything that has been returned by the curl-config
> —-static-libraries command?

just like CURL_STATICLIB you'll have to do the same with nghttp2
-DNGHTTP2_STATICLIB

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-11-27