Plotting Package: "cairo" undefined reference

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
MERHK
Posts: 1
Joined: Thu Oct 11, 2012 7:22 pm
Location: City University of Hong Kong

Plotting Package: "cairo" undefined reference

#1 Unread post by MERHK »

Hi everyone,

I successfully installed ROMS, NetCDF, NCL, but I am having troubles to install the Plotting Package under Ubuntu. There is a problem of missing references that seem to be called "cairo".

I use gfortran in the makefile, and the following configuration in the Linux-gfortran.mk file:

Code: Select all

               FC := gfortran
           FFLAGS := -frepack-arrays
              CPP := /usr/bin/cpp
         CPPFLAGS := -P -traditional
       NCARG_ROOT ?= /usr/local
          LDFLAGS :=
               AR := ar
          ARFLAGS := -r
            MKDIR := mkdir -p
               RM := rm -f
           RANLIB := ranlib
             PERL := perl
             TEST := test

        MDEPFLAGS := --cpp --fext=f90 --file=- --objdir=$(SCRATCH_DIR)

#
# Library locations, can be overridden by environment variables.
#

             LIBS := -L$(NCARG_ROOT)/lib -lncarg -lncarg_gks -lncarg_c
             LIBS += -L/usr/X11R6/lib64 -lX11
The problem when I try to make the file looks like this on the Terminal:

Code: Select all

> Build_plt/xsection.f90
Bin/cpp_clean Build_plt/xsection.f90
cd Build_plt; /usr/bin/gfortran -c -frepack-arrays -O3 -ffast-math xsection.f90
/usr/bin/cpp -P -traditional -I/opt/gfortransoft/serial/netcdf3/include -DLINUX -DI686 -DGFORTRAN -DNCARG520 -Drmdocinc -IInclude -IUtility  Utility/yearday.F > Build_plt/yearday.f90
Bin/cpp_clean Build_plt/yearday.f90
cd Build_plt; /usr/bin/gfortran -c -frepack-arrays -O3 -ffast-math yearday.f90
/usr/bin/cpp -P -traditional -I/opt/gfortransoft/serial/netcdf3/include -DLINUX -DI686 -DGFORTRAN -DNCARG520 -Drmdocinc -IInclude -IUtility  Utility/zgrid.F > Build_plt/zgrid.f90
Bin/cpp_clean Build_plt/zgrid.f90
cd Build_plt; /usr/bin/gfortran -c -frepack-arrays -O3 -ffast-math zgrid.f90
/usr/bin/cpp -P -traditional -I/opt/gfortransoft/serial/netcdf3/include -DLINUX -DI686 -DGFORTRAN -DNCARG520 -Drmdocinc -IInclude -IUtility  Utility/zisopyc.F > Build_plt/zisopyc.f90
Bin/cpp_clean Build_plt/zisopyc.f90
cd Build_plt; /usr/bin/gfortran -c -frepack-arrays -O3 -ffast-math zisopyc.f90
ar -r Build_plt/libUTIL.a Build_plt/areafill.o Build_plt/areamask.o Build_plt/barlab.o Build_plt/bcintrp.o Build_plt/bernoulli.o Build_plt/box.o Build_plt/bv_freq.o Build_plt/caldate.o Build_plt/cfield.o Build_plt/cgrid.o Build_plt/checkstrm.o Build_plt/clrbox.o Build_plt/cntcolor.o Build_plt/cnt_frame.o Build_plt/cntint.o Build_plt/cntpack.o Build_plt/colorbar.o Build_plt/colram.o Build_plt/cpmpxy2d.o Build_plt/cpmpxz2d.o Build_plt/crash.o Build_plt/curlz.o Build_plt/cvector.o Build_plt/datenum.o Build_plt/dateref.o Build_plt/datestr.o Build_plt/datevec.o Build_plt/day_code.o Build_plt/dens.o Build_plt/depth_iso.o Build_plt/depth_lab.o Build_plt/dombox.o Build_plt/drawcl.o Build_plt/draw_line.o Build_plt/draw_user.o Build_plt/entropy.o Build_plt/ertel.o Build_plt/fdiag.o Build_plt/filter.o Build_plt/fldnam2id.o Build_plt/geodesic_dist.o Build_plt/get_2dfld.o Build_plt/get_3dfld.o Build_plt/get_ape.o Build_plt/get_bernoulli.o Build_plt/get_bvf.o Build_plt/get_date.o Build_plt/get_dpres.o Build_plt/get_entropy.o Build_plt/get_ertel.o Build_plt/get_hdiv.o Build_plt/get_hslope.o Build_plt/get_isosur.o Build_plt/get_jebar.o Build_plt/get_nc1dat.o Build_plt/get_nc2dat.o Build_plt/get_nc2pos.o Build_plt/get_nc3dat.o Build_plt/get_nc3pos.o Build_plt/get_ncobs.o Build_plt/get_pig.o Build_plt/get_pltday.o Build_plt/get_pv.o Build_plt/get_rig.o Build_plt/get_rvor.o Build_plt/get_scoor.o Build_plt/get_wcurl.o Build_plt/gksinit.o Build_plt/great_int.o Build_plt/hbackground.o Build_plt/hindices.o Build_plt/hordiv.o Build_plt/inside.o Build_plt/jebar.o Build_plt/landmask.o Build_plt/lenstr.o Build_plt/lintrp.o Build_plt/mapeod.o Build_plt/maptitles.o Build_plt/mskerr.o Build_plt/mskscl.o Build_plt/opencdf.o Build_plt/read_fname.o Build_plt/readpal.o Build_plt/readpar.o Build_plt/relvor.o Build_plt/ri_number.o Build_plt/sec_axis.o Build_plt/sec_frame.o Build_plt/sec_rotvec.o Build_plt/setcolpal.o Build_plt/slevels.o Build_plt/spline.o Build_plt/splint.o Build_plt/streamlines.o Build_plt/stumsl.o Build_plt/stumxy.o Build_plt/svel.o Build_plt/time_indx.o Build_plt/vbackground.o Build_plt/vecmag.o Build_plt/vecpack.o Build_plt/velocity.o Build_plt/viewport.o Build_plt/vindices.o Build_plt/vvumxy.o Build_plt/what_flds.o Build_plt/wind_barbs.o Build_plt/xhslice.o Build_plt/xsection.o Build_plt/yearday.o Build_plt/zgrid.o Build_plt/zisopyc.o
ar: creating Build_plt/libUTIL.a
ranlib Build_plt/libUTIL.a
/usr/bin/cpp -P -traditional -I/opt/gfortransoft/serial/netcdf3/include -DLINUX -DI686 -DGFORTRAN -DNCARG520 -Drmdocinc -IInclude -IUtility  Drivers/cnt.F > Build_plt/cnt.f90
Bin/cpp_clean Build_plt/cnt.f90
cd Build_plt; /usr/bin/gfortran -c -frepack-arrays -O3 -ffast-math cnt.f90
/usr/bin/gfortran -frepack-arrays -O3 -ffast-math  Build_plt/cnt.o Build_plt/cpmpxy2d.o Build_plt/mapeod.o Build_plt/stumsl.o Build_plt/stumxy.o Build_plt/vvumxy.o -o /home/tristan/bin/cnt Build_plt/libUTIL.a -L/usr/local/lib -lncarg -lncarg_gks -lncarg_c -L/usr/X11R6/lib64 -lX11 -L/opt/gfortransoft/serial/netcdf3/lib -lnetcdf 
/usr/local/lib/libncarg_gks.a(cro.o): In function `cro_SoftFill':
cro.c:(.text+0x104e): undefined reference to `cairo_move_to'
cro.c:(.text+0x107f): undefined reference to `cairo_line_to'
cro.c:(.text+0x108a): undefined reference to `cairo_stroke'
cro.c:(.text+0x118d): undefined reference to `cairo_move_to'
cro.c:(.text+0x11c0): undefined reference to `cairo_line_to'
cro.c:(.text+0x11cb): undefined reference to `cairo_stroke'
/usr/local/lib/libncarg_gks.a(cro.o): In function `cro_UpdateWorkstation':
cro.c:(.text+0x12a5): undefined reference to `cairo_surface_flush'
/usr/local/lib/libncarg_gks.a(cro.o): In function `GetCROClipping':
cro.c:(.text+0x12f9): undefined reference to `cairo_clip_extents'
/usr/local/lib/libncarg_gks.a(cro.o): In function `CROpict_init':
cro.c:(.text+0x13fb): undefined reference to `cairo_set_source_rgba'
cro.c:(.text+0x1436): undefined reference to `cairo_clip_extents'
cro.c:(.text+0x143e): undefined reference to `cairo_reset_clip'
cro.c:(.text+0x1450): undefined reference to `cairo_move_to'
cro.c:(.text+0x1476): undefined reference to `cairo_line_to'
.
.
.
.
/usr/local/lib/libncarg_gks.a(crodisplay.o): In function `croFreeNativeSurface':
crodisplay.c:(.text+0x299): undefined reference to `cairo_xlib_surface_get_display'
/usr/local/lib/libncarg_gks.a(crodisplay.o): In function `croCreateNativeDisplaySurface':
crodisplay.c:(.text+0x682): undefined reference to `cairo_xlib_surface_create'
collect2: error: ld returned 1 exit status
make: *** [/home/tristan/bin/cnt] Error 1
As it seems to be a "cairo" problem, I installed libcairo2-dev but it did not change anything.
I have to say that I am pretty new at compiling. I have looked everywhere for a solution but cannot find it, so any help would be greatly appreciated!
I actually managed to compile it with Cygwin on Windows after a lot of troubles (but decided to recompile everything on Linux), could I actually use the binaries from this Cygwin compilation on Linux? (even though I would prefer to understand what is the problem of this Linux compilation)

Cheers!
Tristan

Violeta
Posts: 6
Joined: Tue May 21, 2013 2:13 pm
Location: Swansea University

Re: Plotting Package: "cairo" undefined reference

#2 Unread post by Violeta »

Hi Tristan,

I wonder if you solved the problem, probabli did. I have not seen any replies to your post but I am having same dificulties when compiling, same error with cairo. I wonder how you sorted it. Thank you.

Kind Regards!

Violeta

User avatar
shchepet
Posts: 188
Joined: Fri Nov 14, 2003 4:57 pm

Re: Plotting Package: "cairo" undefined reference

#3 Unread post by shchepet »

The cause of your problem is the line in your makefile
LIBS := -L$(NCARG_ROOT)/lib -lncarg -lncarg_gks -lncarg_c
which is way outdated because this is how NCAR Graphics 4.4 used to be.

Basically the above line does not specify all the libraries NCAR graphics relies upon.

What version of NGAR Graphics you use? Did you compile it yourself
or you use pre-compiled binaries?

Modern-day version of NCAR graphics is 6.1.2 and it needs

Code: Select all

   libncar = -lncarg -lncarg_gks -lncarg_c -lXpm -lX11 -lXext \
             -lcairo -lfontconfig -lpixman-1 -lfreetype -lexpat \
             -lpng -lz -lpthread -lbz2 -lXrender


  LIBNCAR = -L$(NCARG_ROOT)/lib -L/usr/lib64 $(libncar)

     LIBS = $(LIBNCAR) $(LCDF)

which obviously depends on several other libraries beyond
-lncarg -lncarg_gks -lncarg_c. Note libcairo among them.

...in any case you may try to use command ncargf90 druring the linking
stage and see what exact set of libraries it requests.

...the best way is to compile NCAR graphics yourself: yes, it is a very
tedious trial-and-error process requiring several iterations. In doing
so you will have to install all the missing libraries which are typically
not installed by default with the operation system. This way you have
option to disable certain features which you may not need to simplify it.

Violeta
Posts: 6
Joined: Tue May 21, 2013 2:13 pm
Location: Swansea University

Re: Plotting Package: "cairo" undefined reference

#4 Unread post by Violeta »

Dear Shchepet,

thank you very much for your reply. I updated the Linux-gfortran.mk file with missing links to cairo lib and it make command worked! I got expected ccntG, cntG, csecG and secG icons. I do not think I would sort it if you have not advised me as I have not seen the notes on missing links on google or procedures. Thank you so much for your help, it is much appreciated.

Kind Regards!

Violeta

Post Reply