[gdal-dev] compile error on windows

Ryan Grout rgrout at continuum.io
Mon May 2 14:21:04 PDT 2016


Thanks, again Christoph.  You're a lifesaver.

For the benefit of the gdal-dev list.
Applying the below patch to GDAL fixed my build issues with HDF5 1.8.16
-----------------------------------------------------------------------------
diff --git frmts/hdf5/makefile.vc frmts/hdf5/makefile.vc
index e2e695d..02f006f 100644
--- frmts/hdf5/makefile.vc
+++ frmts/hdf5/makefile.vc
@@ -7,7 +7,7 @@ OBJ        =    hdf5dataset.obj  hdf5imagedataset.obj \

 PLUGIN_DLL     =    gdal_HDF5.dll

-EXTRAFLAGS     =     -I$(HDF5_DIR)\include -DWIN32 -D_HDF5USEDLL_
+EXTRAFLAGS     =     -I$(HDF5_DIR)\include -DWIN32
-DH5_BUILT_AS_DYNAMIC_LIB

 !IF "$(HDF5_PLUGIN)" == "YES"
 EXTRAFLAGS = $(EXTRAFLAGS) -DHDF5_PLUGIN
------------------------------------------------------------------------------


On Fri, Apr 29, 2016 at 4:28 PM, Christoph Gohlke <cgohlke at uci.edu> wrote:

> Check the compile options. To use shared libraries of HDF5-1.8.16 on
> Windows with Visual Studio you must specify the H5_BUILT_AS_DYNAMIC_LIB
> compile definition (see <
> https://www.hdfgroup.org/HDF5/release/obtain5.html>).
>
> Christoph
>
>
>
> On 4/29/2016 1:17 PM, Ryan Grout wrote:
>
>> Hello,
>>
>> I'm attempting to build GDAL for windows using Visual Studio 2008.
>> I've included the output of the build failure below.
>>
>> I don't see anything wrong with the linking command (hdf5 library is
>> there).  I've double checked the exported symbols of hdf5.lib and it
>> definitely exports the symbols that gdal complains it can't find.
>>
>> I get this failure on Windows 10 with Visual Studio 2008 and gdal 2.0.0
>> through 2.1.0 RC4.  I suspect it might have something to do with HDF
>> 1.8.16 (since the problem only manifested itself since updating HDF5).
>>
>>
>> Searching this mailing list, I couldn't find similar failures.  Any help
>> would be appreciated.
>>
>> Thanks,
>> Ryan
>>
>> The compile fails with the following output:
>>         cd ..
>>         if exist gdal.lib del gdal.lib
>>         lib /nologo /out:gdal.lib port\*.obj gcore\*.obj alg\*.obj
>> frmts\o\*.obj ogr\ogrsf_frmts\ogrsf_frmts.lib ogr\ogr.lib gnm\*.obj
>> gnm\gnm_frmts\o\*.obj   apps\commonutils.obj apps\gdalinfo_lib.obj
>> apps\gdal_translate_lib.obj apps\gdalwarp_lib.obj apps\ogr2ogr_lib.obj
>> apps\gdaldem_lib.obj apps\nearblack_lib.obj apps\gdal_grid_lib.obj
>> apps\gdal_rasterize_lib.obj apps\gdalbuildvrt_lib.obj
>> ogrsf_frmts.lib(ogrjmllayer.obj) : warning LNK4221: no public symbols
>> found; archive member will be inaccessible
>> ogr.lib(ograpispy.obj) : warning LNK4221: no public symbols found;
>> archive member will be inaccessible
>> nitf_gcprpc.obj : warning LNK4221: no public symbols found; archive
>> member will be inaccessible
>> cpl_recode_iconv.obj : warning LNK4221: no public symbols found; archive
>> member will be inaccessible
>>         link /nologo /dll /INCLUDE:OSRValidate
>> /INCLUDE:OPTGetProjectionMethods  /INCLUDE:OGR_G_GetPointCount
>> /INCLUDE:OGRRegisterAll /INCLUDE:GDALSimpleImageWarp
>> /INCLUDE:GDALReprojectImage  /INCLUDE:GDALComputeMedianCutPCT
>> /INCLUDE:GDALDitherRGB2PCT  /INCLUDE:OCTNewCoordinateTransformation
>> port\*.obj gcore\*.obj alg\*.obj frmts\o\*.obj
>> ogr\ogrsf_frmts\ogrsf_frmts.lib ogr\ogr.lib gnm\*.obj
>> gnm\gnm_frmts\o\*.obj   apps\commonutils.obj apps\gdalinfo_lib.obj
>> apps\gdal_translate_lib.obj apps\gdalwarp_lib.obj apps\ogr2ogr_lib.obj
>> apps\gdaldem_lib.obj apps\nearblack_lib.obj apps\gdal_grid_lib.obj
>> apps\gdal_rasterize_lib.obj apps\gdalbuildvrt_lib.obj
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\xerces-c_3.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\hdf.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\mfhdf.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\xdr.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\netcdf.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\geos_c.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\hdf5.lib
>> C:\Users\builder\Miniconda2\envs\_build\Library\lib\libkea.lib
>> odbc32.lib odbccp32.lib user32.lib                        ws2_32.lib
>> gcore\Version.res  /out:gdal201.dll /implib:gdal_i.lib
>>    Creating library gdal_i.lib and object gdal_i.exp
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_DOUBLE_g referenced in function "bool __cdecl
>> GH5_FetchAttribute(int,char const *,double &,bool)"
>> (?GH5_FetchAttribute@@YA_NHPEBDAEAN_N at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_DOUBLE_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_FLOAT_g referenced in function "bool __cdecl
>> GH5_FetchAttribute(int,char const *,double &,bool)"
>> (?GH5_FetchAttribute@@YA_NHPEBDAEAN_N at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_FLOAT_g
>> hdf5imagedataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_FLOAT_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_INT_g referenced in function "bool __cdecl
>> GH5_FetchAttribute(int,char const *,double &,bool)"
>> (?GH5_FetchAttribute@@YA_NHPEBDAEAN_N at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_INT_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_ULLONG_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_ULLONG_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_LLONG_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_LLONG_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_ULONG_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_ULONG_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_LONG_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_LONG_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_UINT_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_UINT_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_USHORT_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_USHORT_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_SHORT_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_SHORT_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_UCHAR_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_UCHAR_g
>> gh5_convenience.obj : error LNK2019: unresolved external symbol
>> H5T_NATIVE_SCHAR_g referenced in function "enum GDALDataType __cdecl
>> GH5_GetDataType(int)" (?GH5_GetDataType@@YA?AW4GDALDataType@@H at Z)
>> hdf5dataset.obj : error LNK2001: unresolved external symbol
>> H5T_NATIVE_SCHAR_g
>> gdal201.dll : fatal error LNK1120: 12 unresolved externals
>> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
>> Studio 9.0\VC\BIN\amd64\link.EXE"' : return code '0x460'
>> Stop.
>>
>>
>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160502/454745ac/attachment-0001.html>


More information about the gdal-dev mailing list