Re: NCARG example compilation problems

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 17 Apr 2008 13:56:35 -0600 (MDT)

Hi Leon,

Sorry for the frustrations here. You can start by removing (or commenting
out) the "-lg2c" from the compile line. Try this:

    ng4ex -n vc01c

This copies the "vc01c.c file to your current directory.

Then, try compiling without the -lg2c:

  gcc -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped -DNeedFuncProto -fPIC -ansi -O -o vc01c vc01c.c -L/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/lib -L/usr/X11R6/lib64 -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include -I/usr/X11R6/include -lhlu -lncarg -lncarg_gks -lncarg_c -lX11 -lXext -lgcc -lm

If this seems to work, then use the above compile line to help with
the compile line for your other code. Part of what you were missing
were the actual NCAR Graphics libraries:

     -lhlu -lncarg -lncarg_gks -lncarg_c

(this should go on the end of your compile line) and then some
possible additional libraries you might need:

     -lX11 -lXext -lgcc -lm

(these should go after the above libraries). You just had the -L and
the -I options that point to where these libraries reside, but you
need the libraries themselves.

--Mary

  On Thu, 17 Apr 2008, L Tolstoy wrote:

> Hello,
> i'm new to ncarg. I've downloaded ncarg
> (ncl_ncarg-5.0.0.Linux_x86_64_gcc4.tar.gz) from the
> site,and installed it to 64 bit Linux server (uname
> shows x86_64 x86_64 x86_64 GNU/Linux), to my local
> folder.
> We use gcc version 4.1.1 20060525 (Red Hat 4.1.1-1).
>
> I'm trying to compile example file vc01c.c from
> https://www.nacs.uci.edu/dcslib/ncarg/ngdoc-4.1/ng4.1/qsg/exampletable.html
> , and i always got errors like these:
>
> using gcc:
> make
> gcc vc01c.c -g -O0 -Wall -o vc01c
> -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include
> -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include/ncarg/hlu
> -L/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/lib
> /tmp/cceXGZD3.o: In function `main':
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.c:64:
> undefined reference to `cos'
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.c:65:
> undefined reference to `cos'
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.c:73:
> undefined reference to `NhlInitialize'
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.c:79:
> undefined reference to `NhlRLCreate'
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.c:80:
> undefined reference to `NhlRLClear'
> ......
>
> or, using g++
> make
> g++ vc01c.cpp -g -O0 -Wall -o vc01c
> -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include
> -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include/ncarg/hlu
> -L/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/lib
> /tmp/ccz68Nhy.o: In function `main':
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.cpp:73:
> undefined reference to `NhlInitialize()'
> /top/students/GRAD/ECE/ltolstoy/home/workspace/vector/vc01c.cpp:79:
> undefined reference to `NhlRLCreate(NhlRLType_)'
> ......
> Make file that i used looks like this:
> include_dir1=/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include
> include_dir2=/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include/ncarg/hlu
> lib_dir1=/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/lib
>
> ccops=-g -O0 -Wall
> all:
> g++ vc01c.cpp $(ccops) -o vc01c -I$(include_dir1)
> -I$(include_dir2) -L$(lib_dir1)
>
> It seems that compiler couldn't find header files from
> include directory, even i wrote all the pathes there.
>
>
> On
> http://www.atmos.ucla.edu/~fovell/AOS180/contourex.html
> i found an example which was compiled with ncargcc, it
> doesn't work either:
> ncargcc vc01c.cpp
> gcc -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE
> -DByteSwapped -DNeedFuncProto -fPIC -ansi -O vc01c.cpp
> -L/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/lib
> -L/usr/X11R6/lib64
> -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include
> -lncarg -lncarg_gks -lncarg_c -lg2c -lgcc -lm -lX11
> -lXext
> /usr/bin/ld: cannot find -lg2c
> collect2: ld returned 1 exit status
>
> When i try to start this example with ng4ex vc01c, it
> doesn't work either:
> NCAR Graphics High Level Utility C Example <vc01c>
>
> Copying vc01c.c
> Copying vc01.res
>
> Compiling and linking...
> gcc -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE
> -DByteSwapped -DNeedFuncProto -fPIC -ansi -O -o vc01c
> vc01c.c
> -L/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/lib
> -L/usr/X11R6/lib64
> -I/top/students/GRAD/ECE/ltolstoy/home/workspace/ncarg/include
> -I/usr/X11R6/include -lhlu -lncarg -lncarg_gks
> -lncarg_c -lX11 -lXext -lg2c -lgcc -lm
> /usr/bin/ld: cannot find -lg2c
> collect2: ld returned 1 exit status
> Executing <vc01c>...
>
> ./vc01c: Command not found.
>
> Finished executing <vc01c>...
>
> Even starting ng4ex vc01n (not vc01c!) doesn't work on
> some servers! The reason is the same:
> cannot find -lg2c
> Just on one of the servers, starting this example like
> "ng4ex vc01n" i got the output image.
>
> Is it an package installation problem?
> I can't find lg2c library anywhere on my computer,
> probably it's not a part of the NCARG NCL package?
> Can somebody anvise something? How to compile these
> examples?
> Thanks in advance,
> Leon
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> _______________________________________________
> 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 Thu Apr 17 2008 - 13:56:35 MDT

This archive was generated by hypermail 2.2.0 : Sun Apr 20 2008 - 07:43:23 MDT