Re: Compile NCARG shared libraries?

From: Mark Van Moer <mvanmoer_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 15 2011 - 09:32:49 MST

Hi Mary,
Building shared libs came up when I was troubleshooting a problem for one of our users that was fixed by compiling static libs with -shared-intel -mcmodel=medium. I was curious about this, though.

I just tried the below edits to ncargf77 and got ld errors about hidden symbols and nonrepresentable section on output. I'm now going to quit while I'm ahead.

Thanks again for looking into this,
Mark

----- Original Message -----
From: "Mary Haley" <haley@ucar.edu>
To: "Mark Van Moer" <mvanmoer@ncsa.illinois.edu>
Cc: "ncl-install" <ncl-install@ucar.edu>
Sent: Tuesday, February 15, 2011 9:44:30 AM
Subject: Re: Compile NCARG shared libraries?

Hi Mark,

I honestly don't think anybody here has tried building a user program using the NCARG shared libraries, so I'm not sure it will actually work. This stuff was meant to be internal to allow us to link the "ncl" program much quicker through the use of shared libraries.

The three basic (static) libraries that you need to build any NCAR Graphics program are:

 -lncarg -lncarg_gks -lncarg_c

If you are calling routines in the Ngmath library, then you need:

-lncarg -lncarg_gks -lncarg_c -lngmath

If you are calling HLU routines, then you need:

 -lhlu -lncarg -lncarg_gks -lncarg_c

Given this information, and by looking at the $NCARG/config/Project file, my guess is that you need one of these sets libraries (corresponding with the three scenarios above):

 -lNGc -lNGgks -lNGllu -lNGlluC

 -lNGc -lNGgks -lNGllu -lNGlluC -lNGmath

 -lNGhlu -lNGc -lNGgks -lNGllu -lNGlluC

I believe the ligNGgksPDF.so, libNGcn.so, libNGff.so, etc, are partial versions of various libraries, and shouldn't be used.

To use these libraries in "ncargex", you actually want to edit "ncargf77" and not "ncargex". This file is in $NCARG_ROOT/bin, and I believe you simply need to change the lines that look like:

set libncarg = "-lncarg"
set libgks = "-lncarg_gks"
set libncarg_c = "-lncarg_c"

and

    case "-ngmath":
      set libmath = "-lngmath"
      set NGMATH_LD
      breaksw

to:

set libncarg = "-lNGllu -lNGlluC"
set libgks = "-lNGgks"
set libncarg_c = "-lNGc"

and

    case "-ngmath":
      set libmath = "-lNGmath"
      set NGMATH_LD
      breaksw

You will also want to be sure -fPIC is included on the "loadflags" line.

--Mary

On Feb 14, 2011, at 9:52 AM, Mark Van Moer wrote:

> Hi Mary,
> I got .so libs to build by following your suggestion below and also adding -fPIC to CcOptions and FcOptions (I use LINUX.64.INTEL as my base config file).
>
> I have a couple of questions. All the .so names differ in style from the .a:
>
> libNGcn.so libNGc.so libNGff.so libNGgksCTXT.so libNGgksPDF.so libNGgksPS.so libNGgks.so libNGgksX.so libNGhlu.so libNGlluC.so libNGllu.so libNGmath.so libNGmisc2.so libNGmisc.so libNGmp.so libNGnfp.so
>
> I was trying to figure out which ones to link against and found that ldd returns
> statically linked for some of them:
> $ ldd libNGcn.so
> statically linked
>
> The ones ldd returns statically linked for are:
> libNGcn.so, libNGff.so, libNGgksCTXT.so, libNGgksPDF.so, libNGgksPS.so, libNGgksX.so, libNGlluC.so, libNGmath.so, libNGmisc2.so, libNGmisc.so, libNGmp.so
>
> Ones where ldd returns list -
> libNGc.so, libNGgks.so, libNGhlu.so, libNGllu.so, libNGnfp.so
>
> I'm guessing this means I just need to link against the second list? Is there a way to get ncargex to test against the shared libs?
>
> Thanks,
> Mark
>
> ----- Original Message -----
> From: "Mary Haley" <haley@ucar.edu>
> To: "Mark Van Moer" <mvanmoer@ncsa.illinois.edu>
> Cc: "ncl-install" <ncl-install@ucar.edu>
> Sent: Thursday, February 3, 2011 5:29:17 PM
> Subject: Re: Compile NCARG shared libraries?
>
> Hi Mark,
>
> We have some hooks in the build system to build shared libraries, but I've never
> actually tried it, and I'm not sure what state it's in.
>
> Look for this line in your config file in the $NCARG/config directory:
>
> #define BuildShared NO
>
> Try removing it (since I think it is YES by default), and then rerunning "make Everything".
>
> --Mary
>
> On Feb 3, 2011, at 2:48 PM, Mark Van Moer wrote:
>
>> Hello,
>>
>> Is it possible to create shared versions of the NCARG libs? E.g. libncl.so in addition to libncl.a, etc? I don't see anything in the build instructions about this.
>>
>> Thanks,
>> Mark
>> _______________________________________________
>> ncl-install mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-install
>
Received on Tue Feb 15 09:32:52 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 02 2011 - 09:19:21 MST