2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 <2016> 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Fix for building 3.15.4 on windows-x64-static |
From: | Mark Rivers <[email protected]> |
To: | "'Andrew Johnson'" <[email protected]>, EPICS core-talk <[email protected]> |
Date: | Wed, 7 Sep 2016 03:37:01 +0000 |
Folks,
3.15.4 configure/os/CONFIG_SITE.windows-x64 contains these lines: # 64-bit Visual Studio 2010 builds fail when built optimized. # If you are using a newer version you can try removing this: HOST_OPT = NO
These lines are present because src/ioc/rsrv/online_notify.c crashes the linker when it is compiled with optimization. The problem with setting HOST_OPT=NO is that programs will
then be compiled with the /MTd switch, which causes them to be linked by default with the LIBCMTD library. LIBCMTD is incompatible with the LIBCMT library that the hdf5 library and other “vendor libraries” may use. HOST_OPT=NO also disables optimization when
compiling all files, which is not necessary.
I have fixed the problem by doing the following: corvette:src/ioc/rsrv>diff -U3 online_notify.c.orig online_notify.c --- online_notify.c.orig 2016-09-06 17:26:02.828605405 -0500 +++ online_notify.c 2016-09-06 18:16:52.955345453 -0500 @@ -35,6 +35,11 @@ #define epicsExportSharedSymbols #include "server.h" +/* Turn off global optimization for 64-bit MSVC builds on Visual Studio 2010 */ +#if defined(_WIN32) && defined(_M_X64) && _MSC_VER==1600 && !defined(_MINGW) +# pragma optimize("g", off) +#endif + /* * RSRV_ONLINE_NOTIFY_TASK */
Note that this patch is very similar to the code already present in src/libCom/calc/calcPerform.c, except that calcPerform.c does not restrict the optimization suppression to Visual
Studio 2010. I am not certain what versions of Visual Studio cause problems with calcPerform.c. /* Turn off global optimization for 64-bit MSVC builds */ #if defined(_WIN32) && defined(_M_X64) && !defined(_MINGW) # pragma optimize("g", off) #endif
Both of these workarounds could probably be further improved by only disabling optimization for static builds, not for dynamic builds.
These changes allow building base 3.15.4, and all of the required code for ADCore and ADExample for windows-x64-static with no errors. Mark |