Build libxml2 from source under Windows environment - c++

Trying to build libxml2 from source from the current master branch:
https://github.com/GNOME/libxml2
I'm working in Windows 10 environment and trying to build the msvc variant. Following the readme here:
https://github.com/GNOME/libxml2/tree/master/win32
My steps for building are:
1. Open Developer Command Prompt for VS 2017 as admin.
2. Navigate to libxml2\win32.
3. Running the following command: cscript configure.js compiler=msvc prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes
4. nmake /f Makefile.msvc
5. Getting the following: LINK : fatal error LNK1104: cannot open file 'iconv.lib'
Note that i do have the required environment variables set for the libiconv that I use for other projects in my LIB and LIBPATH variable, I also tried adding to PATH even though it's not nececcasry as VS environment cmd reads the LIB and LIBPATH.
(C:\projects\libraries\libiconv\1.9.2-vc110-32bit\Release\lib)
I'm thinking the reason I get this linking error, is because libiconv needs to be build under msvc141(VS17) too?
https://git.savannah.gnu.org/git/libiconv.git
That would cool if it's not the case, as I might need to change a lot in the project if things are updated there, because when I tried building libxml2 with VS12 and VS15 developer command prompt, I got different error in code compatibility, as I guess the owner of the repo doesn't support these versions anymore or they just work in VS17 environment.
Thanks in advance for the help!
Full output:
C:\projects\libraries\libxml\2.7.8-vc110-32bit\Release\bin\libxmlNEW\libxml2\win32>nmake /f Makefile.msvc
Microsoft (R) Program Maintenance Utility Version 14.12.25835.0
Copyright (C) Microsoft Corporation. All rights reserved.
if not exist bin.msvc mkdir bin.msvc
if not exist int.msvc mkdir int.msvc
cl.exe /EP /nologo /I..\include /D "NOLIBTOOL" /D "_REENTRANT" libxml2.def.src > int.msvc\libxml2.def
libxml2.def.src
rc -Fo int.msvc\libxml2.res libxml2.rc
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
cl.exe /nologo /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W3 /wd4244 /wd4267 /MD /I.. /I..\include /Ic:\opt\include /D "_REENTRANT" /D "HAVE_WIN32_THREADS" /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /D "_DEBUG" /Od /Z7 /Foint.msvc\ /c ..\buf.c ..\c14n.c ..\catalog.c ..\chvalid.c ..\debugXML.c ..\dict.c ..\DOCBparser.c ..\encoding.c ..\entities.c ..\error.c ..\globals.c ..\hash.c ..\HTMLparser.c ..\HTMLtree.c ..\legacy.c ..\list.c ..\nanoftp.c ..\nanohttp.c ..\parser.c ..\parserInternals.c ..\pattern.c ..\relaxng.c ..\SAX2.c ..\SAX.c ..\schematron.c ..\threads.c ..\tree.c ..\uri.c ..\valid.c ..\xinclude.c ..\xlink.c ..\xmlIO.c ..\xmlmemory.c ..\xmlreader.c ..\xmlregexp.c ..\xmlmodule.c ..\xmlsave.c ..\xmlschemas.c ..\xmlschemastypes.c ..\xmlunicode.c ..\xmlwriter.c ..\xpath.c ..\xpointer.c ..\xmlstring.c
buf.c
c14n.c
catalog.c
chvalid.c
debugXML.c
dict.c
DOCBparser.c
encoding.c
entities.c
error.c
globals.c
hash.c
HTMLparser.c
HTMLtree.c
legacy.c
list.c
nanoftp.c
..\nanoftp.c(927): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winsock2.h(2218): note: see declaration of 'gethostbyname'
..\nanoftp.c(929): warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\winsock2.h(2218): note: see declaration of 'gethostbyname'
nanohttp.c
parser.c
parserInternals.c
Generating Code...
Compiling...
pattern.c
relaxng.c
SAX2.c
SAX.c
schematron.c
threads.c
tree.c
uri.c
valid.c
xinclude.c
xlink.c
xmlIO.c
xmlmemory.c
xmlreader.c
xmlregexp.c
xmlmodule.c
xmlsave.c
xmlschemas.c
xmlschemastypes.c
xmlunicode.c
Generating Code...
Compiling...
xmlwriter.c
xpath.c
xpointer.c
xmlstring.c
Generating Code...
link.exe /nologo /VERSION:2.9 /LIBPATH:bin.msvc /LIBPATH:c:\opt\lib /DEBUG /DLL /IMPLIB:bin.msvc\libxml2.lib /OUT:bin.msvc\libxml2.dll int.msvc\buf.obj int.msvc\c14n.obj int.msvc\catalog.obj int.msvc\chvalid.obj int.msvc\debugXML.obj int.msvc\dict.obj int.msvc\DOCBparser.obj int.msvc\encoding.obj int.msvc\entities.obj int.msvc\error.obj int.msvc\globals.obj int.msvc\hash.obj int.msvc\HTMLparser.obj int.msvc\HTMLtree.obj int.msvc\legacy.obj int.msvc\list.obj int.msvc\nanoftp.obj int.msvc\nanohttp.obj int.msvc\parser.obj int.msvc\parserInternals.obj int.msvc\pattern.obj int.msvc\relaxng.obj int.msvc\SAX2.obj int.msvc\SAX.obj int.msvc\schematron.obj int.msvc\threads.obj int.msvc\tree.obj int.msvc\uri.obj int.msvc\valid.obj int.msvc\xinclude.obj int.msvc\xlink.obj int.msvc\xmlIO.obj int.msvc\xmlmemory.obj int.msvc\xmlreader.obj int.msvc\xmlregexp.obj int.msvc\xmlmodule.obj int.msvc\xmlsave.obj int.msvc\xmlschemas.obj int.msvc\xmlschemastypes.obj int.msvc\xmlunicode.obj int.msvc\xmlwriter.obj int.msvc\xpath.obj int.msvc\xpointer.obj int.msvc\xmlstring.obj int.msvc\libxml2.res wsock32.lib ws2_32.lib iconv.lib kernel32.lib
LINK : fatal error LNK1104: cannot open file 'iconv.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\link.exe"' : return code '0x450'
Stop.

Note for future readers.
There is a way to build libxml2 without iconv dependency.
For that you need to use:
cscript configure.js compiler=msvc prefix=c:\opt include=c:\opt\include lib=c:\opt\lib debug=yes iconv=no

first, you need to make sure all these packages are build under same arch, which is either all x86 or x64, then libxml2's makefile don't recognize custom INCLUDE and LIB folders, you need to add those folder's into INCLUDE and LIB enviroment variables.
set INCLUDE=%INCLUDE%;<your include dir>
set LIB=%LIB%;<your lib dir>
which should let you compile.

Related

VS2015 supports magic statics, so why this warning?

I'm upgrading from VS2013 to VS2015 and am getting the following warning. I thought VS2015 implemented magic statics so that the local static object should be thread-safe, so what is going on?
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(698): error C2220: warning treated as error - no 'object' file generated
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(704): note: see reference to function template instantiation '_Ty &std::_Immortalize<std::_Generic_error_category>(void)' being compiled
with
[
_Ty=std::_Generic_error_category
]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(698): warning C4640: '_Static': construction of local static object is not thread-safe
The error is in the system_error header from the VS installation folder. The error is in this function:
template<class _Ty> inline
_Ty& _Immortalize()
{ // return a reference to an object that will live forever
static _Immortalizer<_Ty> _Static;
return (*reinterpret_cast<_Ty *>(&_Static._Storage));
}
That's all the context there is in the error, and I can't see where system_error actually gets included.
Compiler flags are:
/Yu"stdafx.h" /GS /analyze /W3 /wd"4481" /wd"4251" /Zc:wchar_t
/Zi /Gm- /O2 /sdl /Fd"x64\Release\\Release_vc140.pdb" /Zc:inline /fp:precise
/errorReport:prompt /WX /Zc:forScope /Gd /MT /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\MyProj.pch"
Update
Sorry, it seems fixed now. It looks like I was on the v140_xp toolset and wrong TargetPlatformVersion. This one must have slipped through the net when I thought I'd replaced them all. I'm not quite sure why getting those wrong would result in this error though. Anyway, thanks for the help so far.
It looks like its caused by the bogus warning which is turned into an Error, read this connect bug:
https://connect.microsoft.com/VisualStudio/feedback/details/2539759/c4640-warning-cannot-be-disabled
The error C2220 indicates you have enables /WX switch, which tells the compiler to treat all warnings as errors.
you can turn this warning off with:
#pragma warning (disable : 4640)
btw. unrelated, but might be usefull to You. You use _Immortalizer as a name for your class which starts with underscore followed by uppercase latter. This is prohibited by standard: read here: What are the rules about using an underscore in a C++ identifier?.
It's caused by changes in MSBuild's toolset v140_xp. Issue appears when:
project builds with VS2015 Update 2, toolset v140_xp
project configuration is Dynamic Library
project was created with ATL App Wizard, so *.vcxproj contains tag <Keyword>AtlProj</Keyword>
There is workaround: open *.vcxproj file, find tag <Keyword>AtlProj</Keyword> and replace it with <Keyword>Win32Proj</Keyword>. Nothing will be changed while compiling, but warning will disappear.
If you want to know details, navigate to the directory C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\v140_xp, open Toolset.props and find comment <!-- Added /Zc:threadSafeInit- for ATL dll projects and enable the C4640 warnning -->. The line below it enables warning and disables "magic static" feature from C++11.
P.S. Please note that warning isn't useless: 'magic static' uses thread-local storage which suffers from ugly WindowsXP kernel bug: access to TLS from DLL causes crash when application built without TLS support. Any DLL plugins with WinXP support affected by this bug.

VC12 Command Line Error when Linking .lib Files

I'm trying to compile a C++ program from the VS2013 command window with includes and linked libraries. Pretty standard stuff. However, Microsoft's website explaining the syntax is not very clear to me.
I'm trying the following command:
cl /EHsc program.cpp /I "\path\to\includes"
/LIBPATH:"\path\to\library\directory" /LINK libfile1.lib libfile2.lib
Note: It's all on one line when I execute it, but for readability I've split it here.
The quotes are because some of the directories in the paths have whitespace in them beyond my control (like Program Files).
I'm trying to adapt this command from a property sheet I made using the Visual Studio interface, so if it helps, the mapping I'm making is:
IncludePath --> /I
LibraryPath --> /LIBPATH:
AdditionalDependencies (under Link) --> /LINK
I am running this as an admin in the x64 Native Tools Command Prompt on a machine running 64-bit Windows 10. However, it gives me these warnings and errors:
cl: Command line warning D9002: ignoring unknown option '/LIBPATH:\path\to\library\directory'
cl: Command line warning D9002: ignoring unknown option '/LINK'
LINK : fatal error LNK1181: cannot open input file 'libfile1.lib'
Where am I going wrong?
The /link option must be lowercase and place the /LIBPATH option after it:
cl /EHsc program.cpp /I "\path\to\includes" /link /LIBPATH:"\path\to\library\directory" libfile1.lib libfile2.lib
try to add the lib's path to your Library Directories (Configuration Properties >> VC++ Directories).
and compile again

Visual Studio 2013 doesn't ignore disabled warnings

Good morning all. So I'm attempting to disable Warning 4996 in our c++ projects. It seems to be included in the command line as shown below, but upon compiling, still pops up with the C4966 Warning. I've tried changing the warning level to 3, or using /w44996, but neither have worked. Does anyone know why this might be?
/Yu"stdafx.h" /GS- /W4 /wd"4100" /wd"4121" /wd"4201" /wd"4214" /wd"4244" /wd"4996" /Zc:wchar_t /I"C:\Program Files (x86)\MSBuild\..\Common Files\Microsoft Shared\MSEnv" /I"C:\Program Files (x86)\MSBuild\..\Common Files\Designer" /I"D:\Workspaces\MST_Sustaining_Second\Inc" /I"D:\Workspaces\MST_Sustaining_Second\Develop\Shared\Include" /Zi /Gm /Od /Fd"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\vc120.pdb" /fp:precise /D "_USRDLL" /D "ACE_DLL" /D "IQEDITOR_ENABLED" /D "_WINDOWS" /D "_DEBUG" /D "NTDDI_VERSION=NTDDI_WIN7" /D "_WIN32_WINNT=0x0601" /D "WINVER=0x0601" /D "_AFXDLL" /D "WIN32" /D "_SECURE_SCL=0" /D "_WINDLL" /D "_MBCS" /errorReport:prompt /GF- /WX- /Zc:forScope /RTC1 /Gd /Oi /MDd /Fa"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\" /EHs /nologo /Fo"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\" /Fp"D:\Workspaces\MST_Sustaining_Second\Develop\IDE\GrACE\Debug\ace.pch"
EDIT: Typo in description. I do mean Warning 4996, not 4966. 4996 is in the command line as /wd"4996"
For Warning:
warning C4996: 'MBCS_Support_Deprecated_In_MFC': MBCS support in MFC is deprecated and may be removed in a future version of MFC.
It looks like #pragma warning(disable: 4996) will not disable the MBCS deprecation warning due to the
#pragma warning(1: 4996) before the _declspec(deprecated) line in afx.h
For obscure reasons, you must use #define NO_WARN_MBCS_MFC_DEPRECATION to disable this instead.
see afx.h lines 28-33
#ifndef NO_WARN_MBCS_MFC_DEPRECATION
#ifdef _MBCS
// Warn about MBCS support being deprecated: see http://go.microsoft.com/fwlink/p/?LinkId=279048 for more information.
#pragma warning(push)
#pragma warning(1 : 4996)
inline __declspec(deprecated("MBCS support in MFC is deprecated and may be removed in a future version of MFC.")) void MBCS_Support_Deprecated_In_MFC() { }
In order to Pat Brenner (Visual C++ Libraries Development Team) mentioned in his blog ,
we are deprecating MBCS support in MFC for Visual Studio 2013. This
keeps MFC more closely aligned with the Windows SDK itself, because
many of the newest controls and messages are Unicode only
This warning can be eliminated by adding the
NO_WARN_MBCS_MFC_DEPRECATION preprocessor definition to your project
build definitions.
Then do this.
Go to Project Properties-> C\C++ ->Preprocessor->Preprocessor Definition and add NO_WARN_MBCS_MFC_DEPRECATION
I have had a similar issue but it was on some functions from io.h and string.h such as these:
source.cxx(713) : warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(215) : see declaration of 'stricmp'
source.cxx(2416) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(207) : see declaration of 'strdup'
source.cxx(2249) : warning C4996: 'isatty': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _isatty. See online help for det
ails.
Due to the need to have the exact same code run be built on other platforms, I had to find a solution without fiddling much in code as this occurred all over the project in a lot of files.
The solution was to add this compiler flag _CRT_NONSTDC_NO_DEPRECATE. This can be done in one of two ways:
Passing -D_CRT_NONSTDC_NO_DEPRECATE if you are using the cl command directly
Or from Visual Studio GUI if you use it for the building process. Add _CRT_NONSTDC_NO_DEPRECATE in Project Properties > C\C++ > Preprocessor > Preprocessor Definition

scons trying to link to wrong boost libs

I'm trying to compile my project as a shared library using scons. I'm using Windows 7, and the Visual Studio 2013 RC. In the project, I'm using boost.
The project compiles fine. However, when it tries to link, I get the following:
scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly
scons: Reading SConscript files ...
Compiling Glr
scons: Reading SConscript files ...
Parsing Shaders into header ShaderData.h
Done parsing Shaders into header ShaderData.h
scons: done reading SConscript files.
scons: Building targets ...
Using tempfile c:\users\jarrett\appdata\local\temp\tmpecwym3.lnk for command line:
link /nologo /dll /out:build\glr.dll /implib:build\glr.lib /LIBPATH:build /LIBPATH:src /LIBPATH:C:\Users\Jarrett\projects\angelscript-sdk\angelscript\lib /LIBPATH:C:\Users\Jarrett\projects\sqlite3 /LIBPATH:C:\Users\Jarrett\projects\berkelium-win32\lib /LIBPATH:C:\Users\Jarrett\projects\SFML\lib "/LIBPATH:C:\Program Files\Assimp\lib\x86" "/LIBPATH:C:\Program Files (x86)\Boost\lib" /LIBPATH:C:\Users\Jarrett\projects\FreeImage\Dist "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib" opengl32.lib glew32.lib berkelium.lib sfml-system.lib sfml-window.lib assimp.lib freeimage.lib libboost_log-vc120-mt-1_54.lib libboost_log_setup-vc120-mt-1_54.lib libboost_date_time-vc120-mt-1_54.lib libboost_thread-vc120-mt-1_54.lib libboost_wave-vc120-mt-1_54.lib libboost_regex-vc120-mt-1_54.lib libboost_filesystem-vc120-mt-1_54.lib libboost_system-vc120-mt-1_54.lib build\BasicSceneManager.obj build\BasicSceneNode.obj build\Camera.obj build\GlrProgram.obj build\GraphicsEngine.obj build\Light.obj build\Window.obj build\common\math\Math.obj build\common\io\File.obj build\BasicSceneManager.obj build\BasicSceneNode.obj build\Camera.obj build\GlrProgram.obj build\GraphicsEngine.obj build\Light.obj build\Window.obj build\exceptions\Exception.obj build\exceptions\FormatException.obj build\exceptions\GlException.obj build\exceptions\IoException.obj build\gui\CallbackParameter.obj build\gui\GUI.obj build\gui\GUIObject.obj build\gui\HtmlGuiComponent.obj build\models\Animation.obj build\models\AssImpLoader.obj build\models\Model.obj build\models\ModelLoader.obj build\models\ModelManager.obj build\glw\Animation.obj build\glw\AnimationManager.obj build\glw\Constants.obj build\glw\Material.obj build\glw\MaterialManager.obj build\glw\Mesh.obj build\glw\MeshManager.obj build\glw\OpenGlDevice.obj build\glw\Texture.obj build\glw\TextureManager.obj build\glw\shaders\CPreProcessor.obj build\glw\shaders\GlrParser.obj build\glw\shaders\GlrPreProcessor.obj build\glw\shaders\GlrShader.obj build\glw\shaders\GlrShaderProgram.obj build\glw\shaders\GlslShader.obj build\glw\shaders\GlslShaderProgram.obj build\glw\shaders\ShaderProgramManager.obj
link #c:\users\jarrett\appdata\local\temp\tmpecwym3.lnk
Using tempfile c:\users\jarrett\appdata\local\temp\tmpep9gzl.lnk for command line:
link /nologo /dll /out:build\glr.dll /implib:build\glr.lib /LIBPATH:build /LIBPATH:src /LIBPATH:C:\Users\Jarrett\projects\angelscript-sdk\angelscript\lib /LIBPATH:C:\Users\Jarrett\projects\sqlite3 /LIBPATH:C:\Users\Jarrett\projects\berkelium-win32\lib /LIBPATH:C:\Users\Jarrett\projects\SFML\lib "/LIBPATH:C:\Program Files\Assimp\lib\x86" "/LIBPATH:C:\Program Files (x86)\Boost\lib" /LIBPATH:C:\Users\Jarrett\projects\FreeImage\Dist "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib" opengl32.lib glew32.lib berkelium.lib sfml-system.lib sfml-window.lib assimp.lib freeimage.lib libboost_log-vc120-mt-1_54.lib libboost_log_setup-vc120-mt-1_54.lib libboost_date_time-vc120-mt-1_54.lib libboost_thread-vc120-mt-1_54.lib libboost_wave-vc120-mt-1_54.lib libboost_regex-vc120-mt-1_54.lib libboost_filesystem-vc120-mt-1_54.lib libboost_system-vc120-mt-1_54.lib build\BasicSceneManager.obj build\BasicSceneNode.obj build\Camera.obj build\GlrProgram.obj build\GraphicsEngine.obj build\Light.obj build\Window.obj build\common\math\Math.obj build\common\io\File.obj build\BasicSceneManager.obj build\BasicSceneNode.obj build\Camera.obj build\GlrProgram.obj build\GraphicsEngine.obj build\Light.obj build\Window.obj build\exceptions\Exception.obj build\exceptions\FormatException.obj build\exceptions\GlException.obj build\exceptions\IoException.obj build\gui\CallbackParameter.obj build\gui\GUI.obj build\gui\GUIObject.obj build\gui\HtmlGuiComponent.obj build\models\Animation.obj build\models\AssImpLoader.obj build\models\Model.obj build\models\ModelLoader.obj build\models\ModelManager.obj build\glw\Animation.obj build\glw\AnimationManager.obj build\glw\Constants.obj build\glw\Material.obj build\glw\MaterialManager.obj build\glw\Mesh.obj build\glw\MeshManager.obj build\glw\OpenGlDevice.obj build\glw\Texture.obj build\glw\TextureManager.obj build\glw\shaders\CPreProcessor.obj build\glw\shaders\GlrParser.obj build\glw\shaders\GlrPreProcessor.obj build\glw\shaders\GlrShader.obj build\glw\shaders\GlrShaderProgram.obj build\glw\shaders\GlslShader.obj build\glw\shaders\GlslShaderProgram.obj build\glw\shaders\ShaderProgramManager.obj
build\BasicSceneManager.obj : warning LNK4042: object specified more than once; extras ignored
build\BasicSceneNode.obj : warning LNK4042: object specified more than once; extras ignored
build\Camera.obj : warning LNK4042: object specified more than once; extras ignored
build\GlrProgram.obj : warning LNK4042: object specified more than once; extras ignored
build\GraphicsEngine.obj : warning LNK4042: object specified more than once; extras ignored
build\Light.obj : warning LNK4042: object specified more than once; extras ignored
build\Window.obj : warning LNK4042: object specified more than once; extras ignored
LINK : fatal error LNK1104: cannot open file 'libboost_log-vc110-mt-1_54.lib'
scons: building terminated because of errors.
scons: *** [build/glr.dll] Error 1104
I'm curious why it's trying to link to libboost_log-vc110-mt-1_54.lib instead of libboost_log-vc120-mt-1_54.lib, which is what I specified in the link command. Also, as far as I can tell, vcxxx is the compiler tag boost uses to tell what version of the compiler built the boost library...so it's almost like scons thinks boost was built using Visual Studio 2012, which would be vc110...I'm not sure.
Turns out, this is an issue with boost 1.54 not being aware of MSVC 2013.
I downloaded the boost trunk (1.55), compiled, and it linked properly.

Embed POCO static library into another one

I'm developing an SDK (as dynamic and static lib) using Poco, and I would like to embed the Poco static libs into my one to avoid the end user to setup and link the Poco enviroment.
The C/C++ settings for the MySDKd.LIB are:
/I"..\..\..\include"
/I"..\..\..\src"
/I"D:\lib\boost_1_53_0\"
/I"..\..\..\thirdparty"
/I"..\..\..\thirdparty\protobuf\include\"
/ZI /nologo /W3 /WX- /Od /Oy-
/D "WIN32" /D "_DEBUG" /D "_LIB"
/D "WIN32_LEAN_AND_MEAN" /D "_MBCS"
/D "POCO_STATIC" /D "POCO_NO_AUTOMATIC_LIBS"
/D "IBPP_WINDOWS"
/Gm /EHa /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope
/Fp"Debug\MySDKd.pch" /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb"
/Gd /analyze- /errorReport:queue
And the linker settings are:
/OUT:"D:\src\MySDK\win32\VS2010\..\..\..\bin\static\MySDKd.lib"
"libprotobufd.lib"
"PocoFoundationmdd.lib"
"PocoUtilmdd.lib"
"PocoNetmdd.lib"
"PocoXMLmdd.lib"
/LIBPATH:"D:\lib\boost_1_53_0\stage\lib"
/LIBPATH:"D:\lib\poco-1.5.1-all\lib"
/LIBPATH:"D:\src\MySDK\lib"
/NOLOGO /NODEFAULTLIB
Now, when I build a simple test project (which use the sdk), I get the linker error:
LINK : fatal error LNK1104: cannot open file 'PocoFoundationmdd.lib'
unless I add to the linker path of my test project the Poco\lib folder.
But this lib should now be a part of my MySDKd.lib, right?
When I build my SDK, moreover, I get this linker warning:
PocoFoundationmdd.lib(ByteOrder.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoFoundationmdd.lib(String.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoFoundationmdd.lib(SignalHandler.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoFoundationmdd.lib(WS2_32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in PocoFoundationmdd.lib(IPHLPAPI.DLL); second definition ignored
PocoFoundationmdd.lib(WS2_32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
PocoXMLmdd.lib(XMLString.obj) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
Searching around, I found this article (see the section 'Build a static library with other static libraries') but referring to this case, I don't understand why this happen.
Is this warning may be the cause to my problem?
Regards,
Daniele
I may be wrong but did you put *.lib file into your project D:\src\MySDK\win32\VS2010 if not than put them into your project.
It seems that feature was changed in VS 2010. What you are trying to do seems not to work since VS 2010. See this question and related MSDN blog for more details. I have no first hand experience with it, but make-it-so provides a tool that allegedly can do what you're trying to do.