Skip to content

Commit e4e3614

Browse files
committed
Merge branch 'baagaard/fix-setup-darwin'
* baagaard/fix-setup-darwin: Update netcdf to patched version. Fixes clang build issue with ncgen3/load.c. See INSTALL for details on this known issue. Add comments about incompatibilities for OS X 10.10 (Yosemite). Added error message for netcdf build error with clang. Add note on fixing ncgen3 for clang.
2 parents 095ccbc + df6498f commit e4e3614

File tree

2 files changed

+100
-7
lines changed

2 files changed

+100
-7
lines changed

INSTALL

Lines changed: 99 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,29 @@ DESKTOP-DARWIN
242242

243243
Apple does not include a Fortran compiler with XCode. Although it is
244244
possible to sometimes install a binary version of the compiler or
245-
use a Darwin package manager, such as Fink or MacPorts, these have
245+
use a Darwin package manager, such as Fink or MacPorts, these can have
246246
their own sets of problems (e.g., incompatibilities, additional
247-
dependencies, etc). A more robust solution is to build the gfortran
248-
compiler. We also build openmpi in this case because we want a
249-
Fortran compiler setup for MPI. Installing MPI, in turn, forces
250-
installtion of Python to insure compatibility in link flags between
251-
MPI and Python. Finally, we use curl to download files because it is
247+
dependencies, etc).
248+
249+
Prior to OS X 10.10 (Yosemite) a more robust solution is to build
250+
the gfortran compiler.
251+
252+
For OS X 10.10 (Yosemite), gcc may not be able to build Python due
253+
to incompatiblities between gcc and clang in the system header
254+
files. In this case, it is best to use clang and build PyLith with
255+
Fortran support.
256+
257+
We also build openmpi in this case because we want a Fortran
258+
compiler setup for MPI. Installing MPI, in turn, forces installtion
259+
of Python to insure compatibility in link flags between MPI and
260+
Python. Finally, we use curl to download files because it is
252261
included in OS X but wget is not.
253262

254263
We assume you have
255264
* C/C++ compilers
256265

266+
With Fortran support:
267+
257268
mkdir -p $HOME/build/pylith
258269
$HOME/src/pylith/pylith-installer-2.1.0-0/configure \
259270
--enable-gcc=fortran \
@@ -263,6 +274,16 @@ DESKTOP-DARWIN
263274
--with-make-threads=2 \
264275
--prefix=$HOME/pylith
265276

277+
Without Fortran support:
278+
279+
mkdir -p $HOME/build/pylith
280+
$HOME/src/pylith/pylith-installer-2.0.3-0/configure \
281+
--enable-mpi=openmpi \
282+
--with-fetch=curl \
283+
--with-make-threads=2 \
284+
--with-petsc-options="--download-chaco=1 --download-fblaslapack=1" \
285+
--prefix=$HOME/pylith
286+
266287
-------
267288
CLUSTER
268289
-------
@@ -448,3 +469,75 @@ In the netcdf build directory do "make clean" and then "make" to
448469
regenerate the object files with these flags. After the build
449470
succeeds, run "touch installed_netcdf" in the top-level directory.
450471

472+
----------------------------------------------------------------------
473+
The clang compiler detects error building ncgen3
474+
----------------------------------------------------------------------
475+
476+
From http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#clang-ncgen3
477+
478+
The clang compiler (default on OSX 10.9 Mavericks) detects an error
479+
building ncgen3
480+
481+
Building the netCDF C library with the clang C compiler, the default
482+
/usr/bin/cc on OSX 10.9 Mavericks, detects an error in compiling
483+
ncgen3/load.c:
484+
485+
In file included from ../../netcdf-4.1.3/ncgen3/load.c:14:
486+
../../netcdf-4.1.3/ncgen3/genlib.h:85:15: error: expected parameter declarator
487+
extern size_t strlcat(char *dst, const char *src, size_t siz);
488+
^
489+
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
490+
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
491+
^
492+
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
493+
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
494+
^
495+
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
496+
# define _USE_FORTIFY_LEVEL 2
497+
^
498+
In file included from ../../netcdf-4.1.3/ncgen3/load.c:14:
499+
../../netcdf-4.1.3/ncgen3/genlib.h:85:15: error: expected ')'
500+
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
501+
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
502+
^
503+
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
504+
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
505+
^
506+
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
507+
# define _USE_FORTIFY_LEVEL 2
508+
^
509+
../../netcdf-4.1.3/ncgen3/genlib.h:85:15: note: to match this '('
510+
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
511+
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
512+
^
513+
/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
514+
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
515+
^
516+
In file included from ../../netcdf-4.1.3/ncgen3/load.c:14:
517+
../../netcdf-4.1.3/ncgen3/genlib.h:85:15: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
518+
extern size_t strlcat(char *dst, const char *src, size_t siz);
519+
^
520+
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
521+
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
522+
^
523+
/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
524+
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
525+
^
526+
In file included from ../../netcdf-4.1.3/ncgen3/load.c:14:
527+
../../netcdf-4.1.3/ncgen3/genlib.h:85:15: error: conflicting types for '__builtin___strlcat_chk'
528+
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
529+
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
530+
^
531+
../../netcdf-4.1.3/ncgen3/genlib.h:85:15: note: '__builtin___strlcat_chk' is a builtin with type 'unsigned long (char *, const char *, unsigned
532+
long, unsigned long)'
533+
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
534+
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
535+
^
536+
1 warning and 3 errors generated.
537+
make: *** [load.o] Error 1
538+
539+
540+
A fix is to insert the line
541+
542+
#include <config.h>
543+
above the "#include <stdlib.h>" statement near the beginning of ncgen3/genlib.h.

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ PROJ4_VER=4.8.0
4949
HDF5_VER=1.8.11
5050
H5PY_VER=2.2.1
5151

52-
NETCDF_VER=4.1.3
52+
NETCDF_VER=4.1.3-p1
5353
NETCDFPY_VER=1.0.7
5454

5555
SCIENTIFICPYTHON_VER=2.9.1

0 commit comments

Comments
 (0)