I tried to build curl-7.65.1 on Windows 2008R2 64bit.
The build for library is finished but for curl.exe the warning is displayed
with following.

cd winbuild
nmake /F Makefile.vc mode=static WITH_MBEDTLS=static MBEDTLS_PATH=..\..\mbedtls-2.7.10\build
...
link.exe /incremental:no /libpath:"..\builds\libcurl-vc-x64-release-static-mbedtls-static-ipv6-sspi\lib"
...
MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library


After then, I tried to build other application but error occurs.

V0@@Z) already defined in LIBCMT.lib(typinfo.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _strdup already defined in LIBCMT.lib(strdup.obj) MSVCRT.lib(MSVCR90.dll) : error LNK2005: _read already defined in LIBCMT.lib(read.obj) MSVCRT.lib(MSVCR90.dll) : error LNK2005: _write already defined in LIBCMT.lib(write.obj) MSVCRT.lib(MSVCR90.dll) : error LNK2005: _close already defined in LIBCMT.lib(close.obj) MSVCRT.lib(MSVCR90.dll) : error LNK2005: _open already defined in LIBCMT.lib(open.obj) LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library ..\..\..\bin\win64\xxx.exe : fatal error LNK1169: one or more multiply defined symbols found


In my research, the curl library with /MD option in spite of static.

https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=vs-2019


So, I made the patch. With it, for curl.exe no warning is
displayed and other application is built with no error.

Daiki
--- curl-7.65.1.orig/winbuild/Makefile.vc	2019-05-14 21:50:37.000000000 +0900
+++ curl-7.65.1/winbuild/Makefile.vc	2019-07-02 10:29:52.254305777 +0900
@@ -269,6 +269,7 @@ $(MODE):
 	@SET USE_WINSSL=$(USE_WINSSL)
 # compatibility bit
 	@SET WITH_NGHTTP2=$(WITH_NGHTTP2)
+	@SET RTLIBCFG=$(MODE)
 
 	@$(MAKE) /NOLOGO /F MakefileBuild.vc
 
--- curl-7.65.1.orig/winbuild/MakefileBuild.vc	2019-05-14 21:50:37.000000000 +0900
+++ curl-7.65.1/winbuild/MakefileBuild.vc	2019-07-02 12:12:05.245529791 +0900
@@ -178,7 +178,7 @@ NGHTTP2_LIBS     = nghttp2_static.lib
 
 !IFDEF MBEDTLS_PATH
 MBEDTLS_INC_DIR  = $(MBEDTLS_PATH)\include
-MBEDTLS_LIB_DIR  = $(MBEDTLS_PATH)\lib
+MBEDTLS_LIB_DIR  = $(MBEDTLS_PATH)\library
 MBEDTLS_LFLAGS   = $(MBEDTLS_LFLAGS) "/LIBPATH:$(MBEDTLS_LIB_DIR)"
 !ELSE
 MBEDTLS_INC_DIR  = $(DEVEL_INCLUDE)
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to