On 2013-03-16 14:56+0100 Arjen Markus wrote:

> Hi Alan,
>
> On Fri, 15 Mar 2013 09:48:03 -0700 (PDT)
> "Alan W. Irwin" <[email protected]> wrote:
>
>
>> 
>> Yes, a static runtime (a user decision concerning which Microsoft core
>> libraries should be used) is a completely different issue than whether
>> the PLplot libraries are built as shared or static.  If PLplot
>> libraries are built as static, you are going to see a problematic
>> mixture of code compiled from both C and C++ sources in libplplotd
>> (until someone fixes that issue for the PLplot static libraries'
>> case). If PLplot libraries are built as shared then they should
>> contain nothing but code compiled from C sources.
>> 
>
> Oh, my mistake. But still, dropping that option I still
> get these error messages:
>
> [ 34%] Built target plplotd
> Scanning dependencies of target plplotcxxd
> [ 34%] Building CXX object 
> bindings/c++/CMakeFiles/plplotcxxd.dir/plstream.cc.obj
> plstream.cc
> Linking CXX shared library ..\..\dll\plplotcxxd.dll
>   Creating library ..\..\dll\plplotcxxd.lib and object 
> ..\..\dll\plplotcxxd.exp
>
> [ 34%] Built target plplotcxxd
> Scanning dependencies of target plplotwxwidgetsd
> [ 35%] Building CXX object 
> bindings/wxwidgets/CMakeFiles/plplotwxwidgetsd.dir/wxPLplotstream.cpp.obj
> wxPLplotstream.cpp
> [ 35%] Building CXX object 
> bindings/wxwidgets/CMakeFiles/plplotwxwidgetsd.dir/wxPLplotwindow.cpp.obj
> wxPLplotwindow.cpp
> d:\tmp\plplot\bindings\wxwidgets\wxPLplotwindow.h(36) : warning C4275: non 
> dll-interface class 'wxWindow' used as base for dll-interface class 
> 'wxPLplotwindow'
>        D:\wxWidgets\include\wx/msw/window.h(32) : see declaration of 
> 'wxWindow'
>        d:\tmp\plplot\bindings\wxwidgets\wxPLplotwindow.h(35) : see 
> declaration of 'wxPLplotwindow'
> Linking CXX shared library ..\..\dll\plplotwxwidgetsd.dll
> msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl 
> std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already 
> defined in libcpmt.lib(xthrow.obj)
>
> msvcprt.lib(MSVCP100.dll) : error LNK2005: "void __cdecl 
> std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) already 
> defined in libcpmt.lib(xthrow.obj)
> ...
>
> I think I need to recompile wxWidgets with the /MT flag to
> get rid of this incompatibility. Hopefully that is not too
> much work - there are dozens of "projects" in the wxWidgets
> "solution".

To Phil and Arjen:

I think that build experiment is worth trying eventually.
However, note that shapelib is a much simpler direct dependency of
libplplotd than the complicated wxWidgets dependency of the
plplotwxwidgetsd library.  So I suggest both of you set
-DPLD_wxwidgets=OFF for now and first try some simple build
experiments with shapelib before getting into wxWidgets build
complications.

According to
http://lists-archives.com/mingw-users/00123-mingw-msvc-md-mt-ml.html,
/MT links to LIBCMT.LIB while /MD links to MSVCRT.LIB.  So the
question is whether libraries built with /MT and therefore linked to
LIBCMT.LIB can be linked to a library built with /MD and therefore
linked to MSVCRT.LIB?

To build shapelib you only need to follow the
directions at cmake/external/shapelib which work
fine for MinGW and which presumably will also work
fine for both of you for the MSVC case.

When the PLplot build links libplplotd (linked to LIBCMT.LIB for the
-DSTATIC_RUNTIME=ON case) with shapelib (linked to MSVCRT.LIB by
default) do you get similar linking errors to the ones Arjen got above
for the plplotwxwidgetsd library?  If not, then probably the above
error you have discovered is some wxWidgets idiosyncracy rather than a
general problem with incompatibility of /MT and /MD compiler flags. If
so, does changing cmake/external/shapelib/CMakeLists.txt to provide
the STATIC_RUNTIME=ON option (with the same logic used in
cmake/modules/plplot.cmake) for the shapelib build solve the issue? If
the answer to that question is yes, then it would appear the
STATIC_RUNTIME=ON option for PLplot is only useful if _all_ PLplot
dependencies are compiled with /MT, and that is a pretty huge burden
if the MSVC user wants a fully functional PLplot (for example, if they want
to try our cairo or qt device drivers with their dependencies on the
pango/cairo libraries and the Qt4 libraries).

In sum a whole lot rides on the question of whether a library built
with /MT can be linked to a library built with /MD, and I think the
simplest way to investigate that question is doing build experiments
such as suggested above with shapelib and plplot.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to