1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
|
Building/Installing HDF-EOS2 using Autoconf/Automake
----------------------------------------------------
Prerequisite
------------
The HDF-EOS2 library requires HDF4 library version 4.2.10 or later. You can download HDF4
from the HDF Group:
https://confluence.hdfgroup.org/display/support/Download+HDF4
or, depending upon your system, you may be able to install it from a package. The HDF4
libary may depend upon other libraries, such as szip, jpeg, and z (compress). The HDF-EOS2
configure script will do its best to determine these dependencies and find the appropriate
libraries, but it may occasionally need help. Please refer to the troubleshooting section
at the bottom of this document.
Configuring
-----------
After downloading and unpacking the tar file, 'cd' into the hdfeos directory and type
./configure
This will run a series of tests to determine the necessary library dependencies, and
configure the makefiles accordingly. The configure script will output a summary of the
configuration options at completion. These can be useful for troubleshooting.
By default, the HDF-EOS2 libraries and include headers will be installed in /usr/local. This
can be changed by using the --prefix option when running configure, e.g.
./configure --prefix=/custom/install/location
A number of other options may be provided to the configure script. You can get details
of these options using the command:
./configure --help
Building
--------
To build HDF-EOS2, simply type
make
from the hdfeos directory.
Tests
-----
The HDF-EOS2 library comes with some tests. You can run these using the command
make check
from the hdfeos directory. These test are primarily for internal testing and are not
part of the official delivery. However, they may provide useful examples. USE AT YOUR
OWN RISK.
Installing
----------
To install HDF-EOS2, simply type
make install
from the hdfeos directory. You need to make sure you have the necessary permissions to
install the files in the chosen location.
Build HDF-EOS2 using Visual Studio
----------------------------------
For building on Windows, the HDF-EOS2 comes with a Visual Studio 2019 project that can be used to
build native Windows versions of the libraries. This combines both the GCTP and HDF-EOS2 code into
a single library. To build on Windows, after starting up Visual Studio load the HDF-EOS2 project
file in the vs2019/HDF-EOS2 directory. Then select Build -> Build HDF-EOS2 from the menu, or
type <ctrl> B.
Fortran API
-----------
The HDF-EOS2 library can build a FORTRAN API to provide access to HDF-EOS2 functions from FORTRAN
programs. By default, the FORTRAN API is disabled. To enable the FORTRAN API on Autoconf systems,
use the
--enable-fortran
option. The configure script will attempt to determine the appropriate API naming convention used
by the fortran compiler automatically. You can still build the FORTRAN API on Autotools systems
even if you do not have access to a FORTRAN compiler. To do this, do not use the --enable-fortran
option, but instead use the options listed below for enabling the API on windows. e.g.
./configure CPPFLAGS="-DFORTRAN_API -DFORTRAN_API_UPPERCASE -DFORTRAN_API_SUFFIX=_"
For building the FORTRAN API on Windows using Visual Studio, you will need to configure some
additional compiler options. These are:
FORTRAN_API Just add this as a preprocessor definition (it does not need a
specific value)
FORTRAN_API_UPPERCASE Add this as a preprocessor definition if your FORTRAN compiler uses
upper-case for external functions names (e.g. ifort)
FORTRAN_API_LOWERCASE Add this as a preprocessor definition if your FORTRAN compiler uses
lower-case for external functions names.
FORTRAN_API_PREFIX Add this as a preprocessor definition if your FORTRAN compiler adds
a prefix of any sort to external function names. The value of this
definition should be the character prefix (e.g. _)
FORTRAN_API_SUFFIX Add this as a preprocessor definition if your FORTRAN compiler adds
a suffix of any sort to external function names. The value of this
definition should be the character suffix (e.g. _)
The HDF-EOS2 Visual Studio project file is preconfigure with FORTRAN_API and FORTRAN_API_UPPERCASE,
to suit the Intel ifort compiler. Note that a FORTRAN compiler is not actually needed in order
to generate the FORTRAN API.
Troubleshooting
---------------
General
-------
This section contains general troubleshooting tips. Additional sections below detail
know issues for specific platforms.
* Determining HDF4 Dependencies
It can be difficult to find out what additional libraries HDF4 depends upon. This is usually
libjpeg, and libz, but may also include libsz. You can get an idea of the dependencies
by using the h4cc tool (you may have to search for this):
h4cc -show
This will produce output similar to the following:
cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -Wl,-z,relro
-L/usr/lib64/hdf /usr/lib64/hdf/libmfhdf.a /usr/lib64/hdf/libdf.a -ljpeg -lz
It lists the libraries that HDF4 (and hence HDF-EOS2) programs will need to link against.
In this case, -ljpeg (libjpeg) and -lz (libz). If HDF4 was built with szip support, it
will also show -lsz (libsz).
* Finding libraries
Most of the libraries need by HDF4 and HDF-EOS2 should be found automatically by
the configure script, but if it cannot find them, they can be found using a simple
command. e.g. To find the jpeg library:
find / -name 'libjpeg.*'
This might produce output as follows:
/usr/lib64/pkgconfig/libjpeg.pc
/usr/lib64/libjpeg.so.62
/usr/lib64/libjpeg.so.62.1.0
/usr/lib64/libjpeg.so
In this case, we have a dynamic (shared) jpeg library in /usr/lib64 We can tell configure
where to find it as follows:
./configure --with-jpeg=/usr/lib64
If you cannot find a particular library, you will need to install the appropriate
package.
* Installing missing packages
Linux distributions generally use a package manager to install software packages, though
the specific tool varies depending upon the distribution. For example, CentOS uses 'yum'
while Ubuntu uses 'apt'.
Max OSX systems, while linux like, do not have the 'OS ready' packages for most of the
dependencies needed by HDF-EOS2. However, there are independently developed tools such as
MacPorts (https://www.macports.org/) and HomeBrew (https://brew.sh/) which are just
as capable, and can provide everything you need.
Packages often come in two different 'flavors' - regular, and 'devel'. The regular versions
contain the libraries needed to run programs that use them. The 'devel' packages are
developer orientated packages that include headers files needed to compile your own
programs using that use the libraries. The following is a list of the key packages
needed by HDF-EOS2:
hdf The main HDF4 package. A 'devel' version is needed since HDF-EOS2 compiles
against this library and needs the header files.
libjpeg Only needed if hdf uses it, but this is almost always the case. A regular
version can be used since HDF-EOS2 does not explicity invoke jpeg functions.
zlib Compression library. As with libjpeg, a regular version can be used.
aec Adaptive Entropy Encoding library (szip). This may or may not be needed,
depending upon how HDF4 was built. If you have access to the h4cc commmand,
you can use 'h4cc -show' to determine whether or not it is needed. If
the output contains '-lsz', then you need aec. Most package versions of
HDF4 do not use aec.
Examples of command to install packages on some of the common linux distributions are
given below.
Linux (Ubuntu/Debian)
---------------------
* Finding/Installing packages
These distributions tend to use 'apt' as the package manager. You can search for packages
using apt as follows:
apt-cache search hdf
A package can be installed as follows:
apt-get install libhdf4-dev
One of the advantages of package manages is that if you install a package in this way, it
will also install all the depenencies required by the package. You can see which additional
packages a given package depends on as follows:
apt-cache depends libhdf4-dev
This is also a good way to determine whether or not aec is required.
Linux (Redhat/Centos)
---------------------
* Finding/Installing packages
These distributions tend to use 'yum' as the package manager. You can search for packages
using yum as follows:
yum search hdf
A package can be installed as follows:
yum install hdf-devel
One of the advantages of package manages is that if you install a package in this way, it
will also install all the depenencies required by the pacakge. You can see which additional
packages a given package depends on as follows:
yum deplist hdf-devel
This is also a good way to determine whether or not aec is required.
Mac OSX
-------
* Finding/Installing packages using MacPorts
You can search for packages using MacPorts as follows:
port search --name "*hdf*"
A package can be installed as follows (you may need to run this using sudo):
port install hdf4
As with Linux base package managers, MacPorts will also install all the depenencies required
by a pacakge. You can see which additional packages a given package depends on as follows:
port info hdf4
Look for a line beginning 'Library Dependencies'. You can ignore any line beginning with
'Build Dependences' since you will not be build HDF4.
* Missing library 'System'.
If your build fails with a message indicating it cannot find a library called 'System',
try adding the following configure option:
./configure LDFLAGS=-L/usr/local
This gives the location of the library to the linker.
Windows Cygwin
--------------
Building HDFEOS on Cygwin can be problematic because it depends on how the HDF4 library was built (refer
to HDF4-README for further details). In general, the following configure command should suffice:
./configure CPPFLAGS="-D__linux__ -D__x86_64__" LIBS="-lxdr" LDFLAGS="-L/usr/local/lib"
You will need to change the library location in LDFLAGS if you installed the HDF4 library in a different
location, and make sure the CPPFLAGS defines match those used to build the hdf4 library.
|