Re: Compilation Problem Fedora Core 6

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 2 Nov 2007 09:48:45 -0600 (MDT)

Michael,

These undefined references should be defined in the libncarg_c.a
library. So either this library didn't get built to completion, or
else NCAR Graphics was built with an option telling the Fortran
compiler not to append underscores at the end of routine names (while
at the same time the NGCALLF macro was set up to expect the
underscores).

Did you change the $NCARG/config/LINUX file and add any compile
options that might affect how Fortran routine names are compiled into
the library?

Also, can you type:

   nm /usr/lib/libncarg_c.a

and email me the output.

Also, and this is just an FYI, it is cleaner to link in libraries
using the "-l" option rather than the full path to the library:

   gcc -o ncarg ncarg.c -lngmath -lncarg_c -lncarg_gks -lncarg -lg2c

If your compiler can't find the NCAR Graphics libraries and/or the g2c
library, then you may need to "help" it with the -L option:

   gcc -o ncarg ncarg.c -L/usr/lib -lngmath -lncarg_c -lncarg_gks -lncarg
       -L/usr/lib/gcc/i386-redhat-linux/3.4.6 -lg2c

--Mary

On Thu, 1 Nov 2007, Michael Irl Zimmerman wrote:

> Hello all,
>
> I am trying to learn how to use NCARG in a C code. I compiled
> NCARG-4.4.2 from source and copied the libraries and header files into
> /usr/lib and /usr/include/ncarg, respectively.
>
> Now I am adding lines to my code step by step to see if I can work out
> the bugs. Here is my c code that compiles and runs:
>
> #include <ncarg/gks.h>
> int main(void)
> {
> gopen_gks(0,0);
> // gopen_ws(1,NULL,1);
> return 0;
> }
>
> The following modification does not compile:
>
> #include <ncarg/gks.h>
>
> int main(void)
> {
> gopen_gks(0,0);
> gopen_ws(1,NULL,1);
> return 0;
> }
>
> My makefile looks like this:
>
> ncarg: ncarg.c
> gcc -o ncarg ncarg.c /usr/lib/libngmath.a /usr/lib/libncarg_c.a
> /usr/lib/libncarg_gks.a /usr/lib/libncarg.a
> /usr/lib/gcc/i386-redhat-linux/3.4.6/libg2c.a
>
> and I get these errors:
>
> [mike_at_localhost ncarg]$ rm -f ncarg && make
> gcc -o ncarg ncarg.c /usr/lib/libngmath.a /usr/lib/libncarg_c.a
> /usr/lib/libncarg_gks.a /usr/lib/libncarg.a
> /usr/lib/gcc/i386-redhat-linux/3.4.6/libg2c.a
> /usr/lib/libncarg_gks.a(gesc.o): In function `gesc_':
> gesc.f:(.text+0x87c): undefined reference to `i1mach_'
> /usr/lib/libncarg_gks.a(g01wdr.o): In function `.L24':
> g01wdr.f:(.text+0x35b): undefined reference to `i1mach_'
> g01wdr.f:(.text+0x593): undefined reference to `gbytes_'
> g01wdr.f:(.text+0x70c): undefined reference to `gbytes_'
> g01wdr.f:(.text+0x743): undefined reference to `gbytes_'
> /usr/lib/libncarg_gks.a(g01wdr.o): In function `.L26':
> g01wdr.f:(.text+0x91a): undefined reference to `i1mach_'
> /usr/lib/libncarg_gks.a(wks.o): In function `delfil_':
> wks.c:(.text+0x50): undefined reference to `GetNCARGPath'
> /usr/lib/libncarg_gks.a(wks.o): In function `rdwks_':
> wks.c:(.text+0x6b2): undefined reference to `bcopyswap'
> /usr/lib/libncarg_gks.a(wks.o): In function `wrtwks_':
> wks.c:(.text+0x87b): undefined reference to `bcopyswap'
> wks.c:(.text+0x949): undefined reference to `bcopyswap'
> /usr/lib/libncarg_gks.a(wks.o): In function `opnwks_':
> wks.c:(.text+0xd10): undefined reference to `GetNCARGPath'
> /usr/lib/libncarg_gks.a(gwiwdr.o): In function `.L20':
> gwiwdr.f:(.text+0x2a8): undefined reference to `i1mach_'
> /usr/lib/libncarg_gks.a(fort_c.o): In function `.L16':
> fort_c.c:(.text+0x108): undefined reference to `ErrGetNum'
> fort_c.c:(.text+0x10f): undefined reference to `ErrGetMsg'
> fort_c.c:(.text+0x1bb): undefined reference to `ErrGetMsg'
> fort_c.c:(.text+0x228): undefined reference to `ErrGetMsg'
> fort_c.c:(.text+0x2eb): undefined reference to `ErrGetMsg'
> /usr/lib/libncarg_gks.a(gksc.o): In function `.L39':
> gksc.c:(.text+0x297): undefined reference to `ESprintf'
> /usr/lib/libncarg_gks.a(gksc.o): In function `.L46':
> gksc.c:(.text+0x383): undefined reference to `ESprintf'
> /usr/lib/libncarg_gks.a(gksc.o): In function `.L47':
> gksc.c:(.text+0x3fb): undefined reference to `ESprintf'
> /usr/lib/libncarg_gks.a(gksc.o): In function `.L48':
> gksc.c:(.text+0x470): undefined reference to `ESprintf'
> /usr/lib/libncarg_gks.a(gksc.o): In function `.L49':
> gksc.c:(.text+0x50e): undefined reference to `ESprintf'
> /usr/lib/libncarg_gks.a(gksc.o):gksc.c:(.text+0x586): more undefined
> references to `ESprintf' follow
> /usr/lib/libncarg_gks.a(g01flb.o): In function `g01flb_':
> g01flb.f:(.text+0x8b): undefined reference to `sbytes_'
> g01flb.f:(.text+0xb4): undefined reference to `sbytes_'
> g01flb.f:(.text+0x108): undefined reference to `sbytes_'
> /usr/lib/libncarg_gks.a(gflcnv.o): In function `gflcnv_':
> gflcnv.f:(.text+0xa1): undefined reference to `ishift_'
> /usr/lib/libncarg_gks.a(gmflod.o): In function `gmflod_':
> gmflod.f:(.text+0x96): undefined reference to `sbytes_'
> /usr/lib/libncarg_gks.a(gwiflb.o): In function `gwiflb_':
> gwiflb.f:(.text+0x98): undefined reference to `sbytes_'
> gwiflb.f:(.text+0xbf): undefined reference to `sbytes_'
> gwiflb.f:(.text+0xe7): undefined reference to `sbytes_'
> /usr/lib/libncarg_gks.a(gks_device.o): In function `GKS_GetDevByName':
> gks_device.c:(.text+0x173): undefined reference to `ESprintf'
> /usr/lib/libncarg_gks.a(xattribute.o): In function `X11_SetClipIndicator':
> xattribute.c:(.text+0x336): undefined reference to `XSetClipRectangles'
> xattribute.c:(.text+0x36c): undefined reference to `XSetClipRectangles'
> xattribute.c:(.text+0x3a2): undefined reference to `XSetClipRectangles'
> xattribute.c:(.text+0x3d8): undefined reference to `XSetClipRectangles'
> xattribute.c:(.text+0x40e): undefined reference to `XSetClipRectangles'
> /usr/lib/libncarg_gks.a(xattribute.o):xattribute.c:(.text+0x444): more
> undefined references to `XSetClipRectangles' follow
> /usr/lib/libncarg_gks.a(xattribute.o): In function `X11_SetClipIndicator':
> xattribute.c:(.text+0x460): undefined reference to `XSetClipMask'
> xattribute.c:(.text+0x477): undefined reference to `XSetClipMask'
> xattribute.c:(.text+0x48e): undefined reference to `XSetClipMask'
> xattribute.c:(.text+0x4a5): undefined reference to `XSetClipMask'
> xattribute.c:(.text+0x4bc): undefined reference to `XSetClipMask'
> /usr/lib/libncarg_gks.a(xattribute.o):xattribute.c:(.text+0x4d3): more
> undefined references to `XSetClipMask' follow
> /usr/lib/libncarg_gks.a(xattribute.o): In function
> `X11_SetLineWidthScaleFactor':
> xattribute.c:(.text+0x5bc): undefined reference to `XChangeGC'
> /usr/lib/libncarg_gks.a(xattribute.o): In function `X11_free_ci':
> xattribute.c:(.text+0x683): undefined reference to `XFreeColors'
> /usr/lib/libncarg_gks.a(xattribute.o): In function
> `X11_SetColorRepresentation':
> xattribute.c:(.text+0x8fb): undefined reference to `XStoreColor'
> xattribute.c:(.text+0x963): undefined reference to `XAllocColor'
> xattribute.c:(.text+0xb80): undefined reference to `XSetWindowBackground'
> xattribute.c:(.text+0xb92): undefined reference to `XClearWindow'
> xattribute.c:(.text+0xbcc): undefined reference to `XChangeGC'
> xattribute.c:(.text+0xbea): undefined reference to `XChangeGC'
> xattribute.c:(.text+0xc08): undefined reference to `XChangeGC'
> xattribute.c:(.text+0xc26): undefined reference to `XChangeGC'
> xattribute.c:(.text+0xc44): undefined reference to `XChangeGC'
> /usr/lib/libncarg_gks.a(xattribute.o):xattribute.c:(.text+0xcaa): more
> undefined references to `XChangeGC' follow
> /usr/lib/libncarg_gks.a(xattribute.o): In function `set_foreground_color':
> xattribute.c:(.text+0xf27): undefined reference to `XSetForeground'
> /usr/lib/libncarg_gks.a(xattribute.o): In function `X11_SetLinetype':
> xattribute.c:(.text+0x125e): undefined reference to `XSetDashes'
> xattribute.c:(.text+0x1298): undefined reference to `XSetDashes'
> .
> .
> .
> .
> .
>
> The errors go on for many lines. Any thoughts or suggestions as to a
> solution?
>
> Best regards,
> Mike
> _______________________________________________
> ncarg-talk mailing list
> ncarg-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
>
_______________________________________________
ncarg-talk mailing list
ncarg-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
Received on Fri Nov 02 2007 - 09:48:45 MDT

This archive was generated by hypermail 2.2.0 : Wed Jan 23 2008 - 14:22:51 MST