vs2010, wxwidgets 2.9.1 and TargetPath/OutputFile mismatch

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
kadesh
In need of some credit
In need of some credit
Posts: 2
Joined: Sat Nov 13, 2010 12:17 pm

vs2010, wxwidgets 2.9.1 and TargetPath/OutputFile mismatch

Post by kadesh » Sat Nov 13, 2010 1:21 pm

Trying to build 2.9.1 sources I get these:

Code: Select all

C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(C:\Program Files\wxWidgets-2.9.1\build\msw\.\..\..\lib\vc_dll\wxregex.lib) does not match the Library's OutputFile property value (C:\Program Files\wxWidgets-2.9.1\lib\vc_dll\wxregexu.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
As you can see: both values actually match (and the file exists) but the build script complains fataly. The very same stuff builds fine on a sister system with Visual Studio 2008.

The corresponding rules from the build script:

Code: Select all

  <Target Name="DoLibOutputFilesMatch" Condition="'@(Lib)' != ''">
    <ItemGroup>
      <_OutputFileFromLib Include="%(Lib.OutputFile)" />
    </ItemGroup>
    <VCMessage Condition="'%(_OutputFileFromLib.FullPath)' != '$([System.IO.Path]::GetFullPath($(TargetPath)))'" Code="MSB8012" Type="Warning" Arguments="TargetPath;$(TargetPath);Library;%(_OutputFileFromLib.FullPath);Lib"/>
    <VCMessage Condition="'%(_OutputFileFromLib.Extension)' != '$(TargetExt)'" Code="MSB8012" Type="Warning" Arguments="TargetExt;$(TargetExt);Library;%(_OutputFileFromLib.Extension);Lib"/>
    <VCMessage Condition="'%(_OutputFileFromLib.Filename)' != '$(TargetName)'" Code="MSB8012" Type="Warning" Arguments="TargetName;$(TargetName);Library;%(_OutputFileFromLib.Filename);Lib"/>
  </Target>
The steps:
- installed wxWidgets 2.9.1 using the Windows installer (I tried the 7zip version, too)
- copied wx291_msw_vc10.zip contents (VS 2010 solution files) from http://forums.wxwidgets.org/viewtopic.php?t=27630
- tried building wx_vc10.sln and failed (see message above)
- loaded/converted wx_dll.dsw, tried building and failed (msg above)

The system:
- Windows 7 32 bit
- VS 2010 default installation
Attachments
wx_wxexpat.log.txt
build log wx_dll.dsw version
(1.83 KiB) Downloaded 77 times

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2020
Joined: Sun Jan 03, 2010 5:45 pm

Re: vs2010, wxwidgets 2.9.1 and TargetPath/OutputFile mismat

Post by PB » Sat Nov 13, 2010 7:21 pm

kadesh wrote:Trying to build 2.9.1 sources I get these:

Code: Select all

C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(C:\Program Files\wxWidgets-2.9.1\build\msw\.\..\..\lib\vc_dll\wxregex.lib) does not match the Library's OutputFile property value (C:\Program Files\wxWidgets-2.9.1\lib\vc_dll\wxregexu.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
As you can see: both values actually match (and the file exists) but the build script complains fataly.
I'm new to wxWidgets, I use its static version and I have never used VS2010 so I shouldn't be giving advice, but still: do the values really match? TargetPath seems to refer to an ANSI library (wxregex.lib) and OutputFile to a Unicode one (wxregexu.lib). Paths don't seem to match either, but I don't know what they mean, so I guess that's OK.

wxLuis
In need of some credit
In need of some credit
Posts: 8
Joined: Sun Oct 05, 2008 10:53 am

Code Generation-Runtime Library switch /MD or /MDD

Post by wxLuis » Sun Nov 14, 2010 9:55 pm

I believe that all problems with MSVC++ 2010 creating wxWidgets libraries or Dlls come from the fact that all the 22 projects in a solution (wx_vc10.sln)
have the Code Generation-Runtime Library switch /MD or /MDD

Projects Code Generation-Runtime Library Switch = /MD or /MDD in the solution (wx_vc10.sln) for all configurations.

Available configurations in the solution.

DLL Release /MD Output: MultiThreaded Release Dll's and import libraries

DLL Debug /MDD Output MultiThreaded Debug Dll's and import libraries

Debug /MDD Output: MultiThreaded Debug static libraries // DO NOT WORK WITH MDD SWITCH CHANGE ALL PROJECTS TO MTD

Release /MD Output: MultiThreaded Release static libraries //DO NOT WORK WITH MD SWITCH CHANGE ALL PROJECTS TO MT

DLL Universal Debug /MDD Output: MultiThreaded Debug Dll's and import libraries

DLL Universal Release /MD Output: MultiThreaded Release DLL's and import libraries

Universal Debug /MDD Output: MultiThreaded Debug static Libraries //DO NOT WORK WITH MDD SWITCH CHANGE ALL PROJECTS TO MTD

Universal Release /MD Output: MultiThreaded Release static Libraries //DO NOT WORK WITH MD SWITCH CHANGE ALL PROJECTS TO MT

Compiler Option for MSVC++2010
Description

/MD
Causes your application to use the multithread- and DLL-specific version of the run-time library.
Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.

Applications compiled with this option are statically linked to MSVCRT.lib.
This library provides a layer of code that allows the linker to resolve external references.
The actual working code is contained in MSVCR100.DLL
which must be available at run time to applications linked with MSVCRT.lib.

/MDd
Defines _DEBUG, _MT, and _DLL and causes your application to use the debug multithread- and DLL-specific version of the run-time library.
It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.
A DLL like MSVCRTD100.DLL from Microsoft must be available at run time to applications linked with MSVCRTD.lib.

/MT
Causes your application to use the multithread, static version of the run-time library.
Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib
to resolve external symbols.

/MTd
Defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib
into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols.

:roll:
If you want static libraries change Code Generation-Runtime Library switch to /MT (Release) or MTD (debug).

Rigth click in the project for example adv select Properties, the select C/C++, then select Code Generation then select Runtime Library
and change the Run Time Library switch to /MT for (Release) or MTD for (Debug). Do this for all 22 projects.

if you want dlls and import libraries for that dlls only use the configurations DLL Release, DLL Debug, DLL Universal Release or DLL Universal Debug

When Microsoft says Debug it implies that it will use Multithreaded STATIC Debug Libraries creating your application or your WxWidgtes libraries.
When it says Release it implies that it will use Multithreaded STATIC Release Libraries creating your application or your WxWidgtes libraries.

And when it refers to DLL Release or DLL Debug it implies that it will use Multithreaded DLL Release import Libraries creating your application or your WxWidgtes libraries.
It will injets code in your objects files (*.obj) LIBCMT.lib or LIBCMTD.lib that will required later the presence of a DLL in your system
MSVCR100.DLL or MSVCRD100.DLL

So that if you compile for example with the Release configuration you will creating statics objects files (*.obj). All the code will be localized
in the obj file, but if at the same time you use the switch /MD you will injecting MSVCRT.lib into your obj file. When the linker phase came
the Linker will complain something about importing the code of a Dynamic Link Library or DLL in a static obj file. It will says something
about a mismatch between LIBCMT.lib and MSVCRTD.lib and your application or wxWidgets libaries will not be created.

So for Debug always use MTD, for Release always use MT in all the 22 projects of the solution (wx_vc10.sln) for all others DLL configurations use MD or MDD.

Always us this:

DLL Release /MD
DLL Debug /MDD
Debug /MTD
Release /MT

DLL Universal Debug /MDD
DLL Universal Release /MD
Universal Debug /MTD
Universal Release /MT
:D
Hope that this will help you and others.

Post Reply