[ncl-install] OS X 10.6 build (gcc + ifort): ncl, ctrans, ictrans

Ted Mansell Ted.Mansell at noaa.gov
Mon Feb 14 09:02:26 MST 2011


Just thought I'd share some results of building ncl_ncarg_5.2.1 on OS X (10.6) with gcc 4.2.1 (build 5646) and Intel ifort 11 (089).  Ncl/ncarg were built 32-bit (not sure if hdf4 builds 64-bit easily yet), and then 64-bit non-ncl (to get 64-bit ncarg libs).

1.) ncl had to be linked by hand with ifort.  Even with "CtoFLibraries  -lifcore -lsvml -limf -lirc", gcc couldn't find "_flush_" or "_abort_".  So I used "ifort -m32 -nofor-main" instead.

2.) ctrans and ictrans both had the same kind of error:

gcc -ansi -m32  -O    -o ctrans main.o ../../../.././ncarview/src/lib/libctrans/libctrans.o -L../../../.././ncarview/src/lib/libcgm -lcgm -L../../../.././ncarview/src/lib/libncarg_ras -lncarg_ras -L../../../.././common/src/libncarg_c -lncarg_c -L/opt/local/ncarg521/lib -L/usr/X11/lib -L/opt/local/netcdf4m32/lib -L/opt/local/hdf5m32/lib -L/opt/local/lib -lXpm -lX11 -lXext   -lmfhdf -ldf -ljpeg -lz -lm   
ld: duplicate symbol start in ../../../.././ncarview/src/lib/libctrans/libctrans.o and /usr/lib/crt1.10.6.o
collect2: ld returned 1 exit status

So I looked at how libctrans.o and libictrans.o were being built, and noticed a warning:

gcc -m32 -bind_at_load -r -o libctrans.o bitops.o buffer.o clip.o ctrans.o default.o    fill.o fontlist.o format.o gcap.o gcread.o in.o rast.o  readfont.o rgbtohls.o text.o translate.o env.o  soft_fill.o cell.o commondev.o gcapdev.o gcaprast.o     rastdev.o hatch.o pal.o ctrans_api.o cgmmisc.o misc.o X11_class0.o X11_class1.o X11_class3.o    X11_class4.o X11_class6.o X11_class7.o  Xcrm.o xresources.o  clear_text.o         devices.o 
ld: warning: unexpected dylib (/usr/lib/libSystem.dylib) on link line
ld: warning: unexpected dylib (/usr/lib/system/libmathCommon.A.dylib) on link line

Since this looked like a library, really, I tried "ar vru" instead:

ar vru libctrans.o bitops.o buffer.o clip.o ctrans.o default.o fill.o fontlist.o format.o gcap.o gcread.o in.o rast.o readfont.o rgbtohls.o text.o translate.o env.o soft_fill.o cell.o commondev.o gcapdev.o gcaprast.o rastdev.o hatch.o pal.o ctrans_api.o cgmmisc.o misc.o X11_class0.o X11_class1.o X11_class3.o X11_class4.o X11_class6.o X11_class7.o Xcrm.o xresources.o clear_text.o devices.o

and that seemed to make the linking for ictrans happy.  (Same procedure for libictrans.o/ictrans)

I haven't tested ctrans and ictrans yet, but ictrans at least outputs a help message. (ncl does seem to be working.)  I don't recall this issue from 5.0.0, which is the previous version I compiled on OS X.

Site.local and Darwin_Intel files are copied below (32-bit).

- Ted

__________________________________________________________
| Edward Mansell <ted.mansell at noaa.gov>
| National Severe Storms Laboratory
| Norman, OK 73072
|
|----------------------------------------------------------------------------
|
| "The contents of this message are mine personally and 
| do not reflect any position of the U.S. Government or NOAA."
|
|----------------------------------------------------------------------------




shazam:config% more Site.local
/*
 *      This file was created by the Configure script.
 */

#ifdef FirstSite

#endif /* FirstSite */


#ifdef SecondSite

#define YmakeRoot /opt/local/ncarg521

#define NetCDFlib -lnetcdf

#define LibSearch -L/usr/X11/lib -L/opt/local/netcdf4m32/lib -L/opt/local/hdf5m32/lib -L/opt/local/lib
#define IncSearch -I/usr/X11/include -I/opt/local/netcdf4m32/include -I/opt/local/hdf5m32/include -I/opt/local/include



#define BuildTRIANGLE 0
#define BuildUdunits 0
#define UdUnitslib
#define BuildHDFEOS 0
#define HDFEOSlib
#define BuildHDFEOS5 0
#define HDFEOS5lib
#define BuildGRIB2 0
#define GRIB2lib
#define BuildV5D 0
#define V5Dlib


#endif /* SecondSite */



shazam:config% more Darwin_Intel
/*
 *      Description:    This file contains the configuration for an
 *                      ifort/gcc build on an Intel Mac system.
 *                      You may need to modify it to change or include
 *                      options.
 *
 *                      Copy this file over the "Darwin_Intel" file,
 *                      which is the one that will get used to help
 *                      create the NCL/NCAR Graphics Makefiles.
 *
 */
#define HdfDefines  -DDARWIN
#define StdDefines  -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped -D__UNIXOS2__
#define ByteSwapped
#define Cstatic 
#define Cdynamic 
#define CppCommand '/usr/bin/cpp -traditional'
#define CCompiler      gcc
#define FCompiler      ifort
#define CcOptions      -ansi -m32
#define FcOptions      -m32
#define CtoFLibraries  -lifcore -lsvml -limf -lirc
#define LdCommand      gcc -m32 -bind_at_load
#define XToolLibrary   -lXt -lSM -lICE
#define BuildShared    NO
#define XLibrary -lXpm -lX11 -lXext

#define ArchRecLibSearch    -L/usr/X11R6/lib 
#define ArchRecIncSearch    -I/usr/X11R6/include 

FC = $(F77)

/*************** Redefine Macros from Rules ********************************/

/*
 * Macro:       MakeDir
 *
 * Description: This rule creates a directory - if a parent dir doesn't exist
 *              it attempts to create it.
 */
#ifndef MakeDir
#define MakeDir(dir)    @if (test ! -d dir); then ($(MKDIRHIER) dir); fi
#endif





More information about the ncl-install mailing list