Unidata / UDUNITS-2

API and utility for arithmetic manipulation of units of physical quantities
http://www.unidata.ucar.edu/software/udunits
Other
62 stars 36 forks source link

UDUNITS Visual Studio build errors #79

Open pedro-vicente opened 6 years ago

pedro-vicente commented 6 years ago

UDUNITS is a dependency of NCO and to build NCO we use a script that clones from github and builds witth CMake

Recently an error started to show

we use this script to build

https://github.com/nco/nco/blob/master/cmake/bld.bat

the relevant part is

:build_udunits
if exist %build%\UDUNITS-2\build\udunits.sln (
 echo skipping udunits build
 goto build_gsl
) else (
  echo building udunits
  pushd UDUNITS-2
  mkdir build
  pushd build
  cmake .. -G %MSVC_VERSION% ^
           -DMSVC_USE_STATIC_CRT=%STATIC_CRT% ^
           -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ^
           -DBUILD_SHARED_LIBS=OFF ^
           -DEXPAT_INCLUDE_DIR=%root%/libexpat/expat/lib ^
           -DEXPAT_LIBRARY=%root%/libexpat/expat/build/Debug/expatd.lib
  msbuild udunits.sln /target:build /property:configuration=debug /nologo /verbosity:minimal
  popd
  popd
  if errorlevel 1 goto :eof
)

the errors in UDUNITS are

the errors are

------ Build started: Project: libudunits2, Configuration: Debug x64 ------
  Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /I"G:\nco\cmake\build\UDUNITS-2\build" /I"G:\nco\cmake\build\UDUNITS-2\lib\." /IG:\nco\cmake\build\libexpat\expat\lib /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _CRT_SECURE_NO_WARNINGS /D YY_NO_UNISTD_H /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"libudunits2.dir\Debug\\" /Fd"libudunits2.dir\Debug\libudunits2.pdb" /Gd /TC /errorReport:prompt "G:\nco\cmake\build\UDUNITS-2\lib\parser.c"

  parser.c
parser.y(68): warning C4013: 'strspn' undefined; assuming extern returning int
parser.y(70): warning C4013: 'strlen' undefined; assuming extern returning int
parser.y(71): warning C4013: 'strchr' undefined; assuming extern returning int
parser.y(71): warning C4047: '==': 'int' differs in levels of indirection from 'void *'
parser.y(76): warning C4013: 'memmove' undefined; assuming extern returning int
parser.y(98): warning C4013: '_strdup' undefined; assuming extern returning int
parser.y(98): warning C4047: '=': 'char *' differs in levels of indirection from 'int'
parser.y(151): warning C4146: unary minus operator applied to unsigned type, result still unsigned
parser.c(1392): warning C4013: 'utlex' undefined; assuming extern returning int
parser.y(367): warning C4013: 'utGetPrefixByName' undefined; assuming extern returning int
parser.y(374): warning C4013: 'utGetPrefixBySymbol' undefined; assuming extern returning int
parser.y(447): warning C4013: '_stricmp' undefined; assuming extern returning int
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime_string.h(47): error C2373: 'memmove': redefinition; different type modifiers
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\vcruntime_string.h(67): error C2373: 'strchr': redefinition; different type modifiers
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(148): error C2373: '_strdup': redefinition; different type modifiers
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(189): error C2375: '_stricmp': redefinition; different linkage
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(215): error C2371: 'strlen': redefinition; different basic types
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(447): error C2371: 'strspn': redefinition; different basic types
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(552): error C2375: '_strdup': redefinition; different linkage
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(568): error C2375: '_stricmp': redefinition; different linkage
scanner.l(331): warning C4996: '_strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup. See online help for details.
<stdout>(2300): warning C4996: 'fileno': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fileno. See online help for details.
  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(2450): note: see declaration of 'fileno'
parser.y(640): warning C4090: 'function': different 'const' qualifiers
parser.y(655): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
------ Build started: Project: udunits2, Configuration: Debug x64 ------
  Building Custom Rule G:/nco/cmake/build/UDUNITS-2/prog/CMakeLists.txt
  CMake does not need to re-run because G:/nco/cmake/build/UDUNITS-2/build/prog/CMakeFiles/generate.stamp is up-to-date.
  Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /I"G:\nco\cmake\build\UDUNITS-2\build" /I"G:\nco\cmake\build\UDUNITS-2\lib" /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _CRT_SECURE_NO_WARNINGS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"udunits2.dir\Debug\\" /Fd"udunits2.dir\Debug\vc140.pdb" /Gd /TC /errorReport:prompt "G:\nco\cmake\build\UDUNITS-2\prog\udunits2.c" "G:\nco\cmake\build\UDUNITS-2\prog\XGetopt.c"

  udunits2.c
  XGetopt.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file '..\lib\Debug\udunits2.lib'
semmerson commented 6 years ago

Good to know. Thanks for sending this in.

You should know, however, cloning the GitHub repository doesn't necessarily result in a distribution that builds.

pedro-vicente commented 6 years ago

ok, I was able to build using the latest tag, thanks