cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Error when building libcurl v7.49.0 with mbedTLS

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 24 May 2016 12:12:14 +0200 (CEST)

On Tue, 24 May 2016, Moti Avrahami wrote:

> I tried to upgrade libcurl from v7.47.1 to v7.49.0 and encountered this
> build error :
>
> "LNK2019: unresolved external symbol _snprintf referenced in function
> _Curl_mbedtls_version"

...

> Does it a bug? Should I do something else to solve it?

Yes it is a bug. I believe the proper fix is like this:

diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index 6fc7214..ef0b949 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -51,14 +51,13 @@
  #include "connect.h" /* for the connect timeout */
  #include "select.h"
  #include "rawstr.h"
  #include "polarssl_threadlock.h"

-#define _MPRINTF_REPLACE /* use our functions only */
-#include <curl/mprintf.h>
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
  #include "curl_memory.h"
-/* The last #include file should be: */
  #include "memdebug.h"

  /* apply threading? */
  #if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
  #define THREADING_SUPPORT

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-24