Re: [netcdfgroup] Make the Cmake Windows build static please !


Hi Ward

Can you be a little more specific about how this does not work?
Is the issue that the generated projects are configured to use the the dynamic instead of static CRT?

Yes, I meant that the the generated projects were all runtime library Multi-threaded Debug DLL (/MDd).

I was under the impression that if I do -D"BUILD_SHARED_LIBS=OFF", then the projects would be static CRT ? Or is this option, just relative to the netCDF library itself, netcdf.lib ? In this case, my bad, sorry for the confusion.


I see how this could be set as a user-configurable option when invoking cmake. I will try to add this in and, assuming there aren't any problems caused by using the static CRT, it will be an option available in the >>upcoming netCDF-4.3.1-RC3.

OK, great, thanks


Allen, maybe the HD5 Cmake could use the same ?

Pedro

------------
pvicente@xxxxxxx
Department of Earth System Science
3200 Croul Hall
University of California, Irvine
Irvine, CA 92697-3100







J:\netcdf-c-4.3.1-rc2>cd build

J:\netcdf-c-4.3.1-rc2\build>cmake -C ../cmake/ConfigUser.cmake -D"BUILD_SHARED_LIBS=OFF" -D"ENABLE_DLL=OFF" -D"HDF5_INCLUDE_DIR=I:\hdf5-1.8.11\src" -D"HDF5_LIB=I:\hdf5-1.8.11\build \bin\Debug\hdf5_D.lib" -D"HDF5_HL_LIB=I:\hdf5-1.8.11\build\bin\Debug\hdf5_hl_D.lib" -D"ZLIB_INCLUDE_DIR:PATH=I:\zlib-1.2.5" -D"ZLIB_LIBRARY:FILEPATH=I:\zlib-1.2.5\build\bin\Debug\l ibzlib_D.lib" -D"SZIP_INCLUDE_DIR:PATH=I:\szip-2.1\src" -D"SZIP_LIBRARY:FILEPATH=I:\szip-2.1\build\bin\Debug\libszip_D.lib" -D"ENABLE_DAP=ON" -D"CURL_LIBRARY=J:\curl-7.29.0\builds \libcurl-vc10-x86-debug-static-ipv6-sspi-spnego-winssl\lib\libcurl_a_debug.lib" -D"CURL_INCLUDE_DIR=J:\curl-7.29.0\builds\libcurl-vc10-x86-debug-static-ipv6-sspi-spnego-winssl\include" ..loading initial cache file ../cmake/ConfigUser.cmake-- Building for: Visual Studio 10-- The C compiler identification is MSVC 16.0.30319.1-- Check for working C compiler using: Visual Studio 10-- Check for working C compiler using: Visual Studio 10 -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Found ZLIB: I:/zlib-1.2.5/build/bin/Debug/libzlib_D.lib (found version"1.2.5")-- Found CURL:J:/curl-7.29.0/builds/libcurl-vc10-x86-debug-static-ipv6-sspi-spnego-winssl/lib/libcurl_a_debug.lib (found version "7.29.0")-- Looking for math.h-- Looking for math.h - found-- Looking for unistd.h-- Looking for unistd.h - not found-- Looking for alloca.h-- Looking for alloca.h - not found-- Looking for malloc.h-- Looking for malloc.h - found-- Looking for ctype.h-- Looking for ctype.h - found-- Looking for dirent.h-- Looking for dirent.h - not found-- !
Looking for dlfcn.h-- Looking for dlfcn.h - not found-- Looking for errno.h-- 
Looking for errno.h - found-- Looking for fcntl.h-- Looking for fcntl.h - 
found-- Looking for getopt.h-- Looking for getopt.h - not found-- Looking for 
stdbool.h-- Looking for stdbool.h - not found-- Looking for locale.h-- Looking 
for locale.h - found-- Looking for stdint.h-- Looking for stdint.h - found-- 
Looking for stdio.h-- Looking for stdio.h - found-- Looking for stdlib.h-- 
Looking for stdlib.h - found-- Looking for stdarg.h-- Looking for stdarg.h - 
found-- Looking for strings.h-- Looking for strings.h - not found-- Looking for 
signal.h-- Looking for signal.h - found-- Looking for sys/dir.h-- Looking for 
sys/dir.h - not found-- Looking for sys/ndir.h-- Looking for sys/ndir.h - not 
found-- Looking for sys/param.h-- Looking for sys/param.h - not found-- Looking 
for sys/stat.h-- Looking for sys/stat.h - found-- Looking for sys/time.h-- 
Looking for sys/time.h - not found-- Looking for sys/types.!
h-- Looking for sys/types.h - found-- Looking for sys/wait.h-- Looking
for sys/wait.h - not found-- Looking for sys/resource.h-- Looking for 
sys/resource.h - not found-- Looking for inttypes.h-- Looking for inttypes.h - 
not found-- Looking for pstdint.h-- Looking for pstdint.h - found-- Looking for 
endian.h-- Looking for endian.h - not found-- Looking for BaseTsd.h-- Looking 
for BaseTsd.h - found-- Looking for stddef.h-- Looking for stddef.h - found-- 
Check size of double-- Check size of double - done-- Check size of float-- 
Check size of float - done-- Check size of int-- Check size of int - done-- 
Check size of long-- Check size of long - done-- Check size of long long-- 
Check size of long long - done-- Check size of off_t-- Check size of off_t - 
done-- Check size of off64_t-- Check size of off64_t - failed-- Check size of 
short-- Check size of short - done-- Check size of size_t-- Check size of 
size_t - done-- Check size of ssize_t-- Check size of ssize_t - failed-- Check 
size of uchar-- Check size of uchar - failed-- Check size of int64_t-!
- Check size of int64_t - done-- Check size of uint64_t-- Check size of 
uint64_t - done-- Looking for fsync-- Looking for fsync - not found-- Looking 
for strlcat-- Looking for strlcat - not found-- Looking for strerror-- Looking 
for strerror - found-- Looking for snprintf-- Looking for snprintf - not 
found-- Looking for strchr-- Looking for strchr - found-- Looking for strrchr-- 
Looking for strrchr - found-- Looking for strcat-- Looking for strcat - found-- 
Looking for strcpy-- Looking for strcpy - found-- Looking for strdup-- Looking 
for strdup - found-- Looking for strcasecmp-- Looking for strcasecmp - not 
found-- Looking for strtod-- Looking for strtod - found-- Looking for strtoll-- 
Looking for strtoll - not found-- Looking for strtoull-- Looking for strtoull - 
not found-- Looking for strstr-- Looking for strstr - found-- Looking for 
mkstemp-- Looking for mkstemp - not found-- Looking for rand-- Looking for rand 
- found-- Looking for gettimeofday-- Looking for gettimeof!
day - not found-- Looking for MPI_Comm_f2C-- Looking for MPI_Comm_f2C - not found-- Looking for memmove-- Looking for memmove - found-- Looking for getpagesize-- Looking for getpagesize - not found-- Looking for sysconf-- Looking for sysconf - not found-- Looking for mremap-- Looking for mremap - not found-- Looking for getrlimit-- Looking for getrlimit - not found-- CMake Summary:-- Build Type: DEBUG-- Building Shared Libraries: OFF-- Building netCDF-4: ON-- Building DAP Support: ON-- Building Utilities: ON-- Using pnetcdf: OFF-- Using Parallel IO: OFF-- Linking against:I:\hdf5-1.8.11\build\bin\Debug\hdf5_D.lib;I:\hdf5-1.8.11\build\bin\Debug\hdf5_hl_D.lib;I:/zlib-1.2.5/build/bin/Debug/libzlib_D.lib;I:/szip-2.1/build/bin/Debug/libszip_D.lib;J:/curl-7.29.0/builds/libcurl-vc10-x86-debug-static-ipv6-sspi-spnego-winssl/lib/libcurl_a_debug.lib-- Configuring done-- Generating doneCMake Warning: Manually-specified variabl!
es were not used by the project:    SZIP_INCLUDE_DIR----- Original Message -----From: Ward FisherTo: Pedro VicenteCc: Allen D Byrne ; netcdfgroup@xxxxxxxxxxxx.eduSent: 
Wednesday, September 18, 2013 11:46 AMSubject: Re: [netcdfgroup] Make the Cmake Windows build static please !Hello Pedro,On 9/17/13 10:10 PM, Pedro Vicente wrote:Hi Ward, 
Allen>>> Building NetCDF statically is already an option, bypassing -DBUILD_SHARED_LIBS=OFF during configuration.Ward, this seems not to be working with the current 
release candidatenetcdf-4.3.1-rc2 (it was working for netcdf-4.3.0)I triedcd buildcmake -C../cmake/ConfigUser.cmake -D"BUILD_SHARED_LIBS=OFF" 
-D"ENABLE_DLL=OFF" -D"HDF5_INCLUDE_DIR=I:\hdf5-1.8.11\src" -D"HDF5_LIB=I:\hdf5-1.8.11\build\bin\Debug\hdf5_D.lib" 
-D"HDF5_HL_LIB=I:\hdf5-1.8.11\build\bin\Debug\hdf5_hl_D.lib" -D"ZLIB_INCLUDE_DIR:PATH=I:\zlib-1.2.5" 
-D"ZLIB_LIBRARY:FILEPATH=I:\zlib-1.2.5\build\bin\Debug\libzlib_D.lib" -D"SZIP_INCLUDE_DIR:PATH=I:\szip-2.1\src" -D"SZIP_LIBRARY!
:FILEPATH=I:\szip-2.1\build\bin\Debug\libszip_D.lib" -D"ENABLE_DAP=ON"
 
-D"CURL_LIBRARY=J:\curl-7.29.0\builds\libcurl-vc10-x86-debug-static-ipv6-sspi-spnego-winssl\lib\libcurl_a_debug.lib"
 
-D"CURL_INCLUDE_DIR=J:\curl-7.29.0\builds\libcurl-vc10-x86-debug-static-ipv6-sspi-spnego-winssl\include"
  ..and the generated projects were all runtime library Multi-threaded Debug DLL(/MDd)Can you be a 
little more specific about how this does not work?  I was ableto build the netCDF-C libraries 
statically using the latest developersnapshot and Visual Studio 10, with the resultant netcdf.lib 
file being aproper 'ar' archive. All tests ran properly.Is the issue that the generated projects 
are configured to use the thedynamic instead of static CRT?  This is as it was in the 
netcdf-4.3.0libraries, so if that was working for you I suspect this will as well.However, looking 
at the relevant CMake 
documentation,http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3FI
 see how this could be set as a user-configurable option whe!
n invokingcmake.  I will try to add this in and, assuming there aren't any problemscaused 
by using the static CRT, it will be an option available in theupcoming netCDF-4.3.1-RC3.  
In the meantime, you can replace '/MD' with'/MT' in the cache editor.If I have 
misunderstood the issue, or if you are seeing an outrighterror/unexpected behavior please 
let me know. Have a great day,-WardAllen,on the other hand, I managed to make the 
generated projects by HDF5 CMakeall runtime library  Multi-threaded Debug (/MTd)by using 
this posthttp://www.cmake.org/pipermail/cmake/2006-July/010121.htmland using the code in 
CMakeLists.txtI tried the same code in CMakeLists.txt of netCDF, but it did not make 
thesubstitution from /MD to /MTIs the next HDF5 version going to include theption  
-D"BUILD_SHARED_LIBS=OFF", like netCDF does now 
?Pedro------------pvicente@uci.eduDepartment of Earth System Science3200 Croul 
HallUniversity of California, IrvineIrvine, CA 92697-3100----- Original Message ----!
-From: Ward FisherTo: Pedro VicenteCc: netcdfgroup@xxxxxxxxxxxxxxxx ; Allen D ByrneSent: Wednesday, June 05, 2013 9:36 AMSubject: Re: [netcdfgroup] Make the Cmake Windows build static please !Good morning Pedro,Building NetCDF statically is already an option, bypassing -DBUILD_SHARED_LIBS=OFF during configuration. This will build thenetcdf libraries and utilities statically, avoiding the direct dependency onMSVCR100.dll. They will, however, still inherit any downstream .dlldependencies from the curl, hdf and zlib libraries. You might be able towork around this by downloading (or building) static versions of theselibraries. However, when I first investigated this process some months ago,it became obvious that this would require more time and effort on our endthan we can reasonably expend (particularly for 64-bit versions of thelibraries). Hence, we only provide shared libraries pre-built :).On a tangental note, I see from the NCO discussion you linked that your userwas able to resolve the issue by removing the MSVCR100D.dll from the c:\nco!
\directory.  On Windows, it is preferable to use the Release version of 
thenetcdf libraries (dependent on MSVCR100.dll) for the time being, due 
tocross-dll memory management situations which arise between the netcdf andhdf 
libraries.  This is a known issue which can be followed in our JIRAsystem at 
https://bugtracking.unidata.ucar.edu/browse/NCF-220 .  It ispossible to build 
and use the debug libraries, but running the unit testswill result in a handful 
of errors.I hope this clarifies the difficulty faced in providing purely 
staticlibraries for netcdf-4/DAP enabled builds; as always, I am open 
tosuggestions and work-arounds!Have a great day,-WardOn 6/5/13 12:24 AM, Pedro 
Vicente wrote:Hi Allen, WardI have a request regarding your new CMake Windows 
build system, could youadd an option to make the build static regarding the 
Microsoft libraries(MSVCR100D.dll) ?Starting with version 4.3.1, 
NCOhttp://nco.sourceforge.net/uses the HDF5 and netCDF Windows libraries made 
with your C!
Make system, andthis is causing problems for NCO users, as explained h
erehttps://sourceforge.net/projects/nco/forums/forum/9830/topic/8345151and 
herehttps://sourceforge.net/projects/nco/forums/forum/9829/topic/8417103This is 
just a matter of changing the compiler flag to 
/MT(d)http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspxUsing a dynamic 
build is just a bad idea, because of these DLL issues.I have some Windows 
executables from code I did in the early 90's , thatunfortunately I cannot run 
today,just because I linked them with DLLs, with the DLLs from the Visual 
Studiofrom that time, that do not exist anymore (it seems every new version 
theychange the Visual Studio Dlls).Because of this I do not use Dlls, I know 
that eventually something will gowrong :-)Pedro------Pedro Vicente, Earth 
System ScienceUniversity of California, 
Irvinehttp://www.ess.uci.edu/_______________________________________________netcdfgroup
 mailing listnetcdfgroup@xxxxxxxxxxxx.eduFor list information or to 
unsubscribe,  visit:http://www.unidata.ucar.edu/mailing_lists/



  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: