3

octave 3.8.2 produces this error on loading:

error: /usr/lib64/octave/3.8.2/oct/x86_64-pc-linux-gnu/PKG_ADD: /usr/lib64/octave/3.8.2/oct/x86_64-pc-linux-gnu/__init_fltk__.oct: failed to load: /usr/lib64/fltk/libfltk_gl.so.1.3: undefined symbol: XGetUtf8FontAndGlyph
error: called from:
error:   /usr/lib64/octave/3.8.2/oct/x86_64-pc-linux-gnu/PKG_ADD at line 6, column 1
GNU Octave, version 3.8.2

I obtain the following information about configuration of graphics libraries

octave:1> octave_config_info().GRAPHICS_LIBS
ans = -L/usr/lib64/fltk -Wl,-rpath,/usr/lib64/fltk -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -lfltk_gl -lGLU -lGL -lfltk -lXcursor -lXfixes -lXext -ldl -lm -lX11

and although no graphic toolkits are evidently loaded initially,

octave:2> available_graphics_toolkits
ans = {}(1x0)

I can register them subsequently,

octave:3> register_graphics_toolkit("gnuplot")
octave:4> available_graphics_toolkits
ans = 
{
  [1,1] = gnuplot
}
octave:5> register_graphics_toolkit("fltk")
octave:6> available_graphics_toolkits
ans = 
{
  [1,1] = fltk
  [1,2] = gnuplot
}

but attempting to load fltk produces an error consistent with the initial warning

octave:7> graphics_toolkit("fltk")
error: feval: /usr/lib64/octave/3.8.2/oct/x86_64-pc-linux-gnu/__init_fltk__.oct: failed to load: /usr/lib64/fltk/libfltk_gl.so.1.3: undefined symbol: XGetUtf8FontAndGlyph
error: called from:
error:   /usr/share/octave/3.8.2/m/plot/util/graphics_toolkit.m at line 74, column 5

and of course attempting to plot anything also fails,

octave:8> plot(1:10)
error: feval: /usr/lib64/octave/3.8.2/oct/x86_64-pc-linux-gnu/__init_fltk__.oct: failed to     load: /usr/lib64/fltk/libfltk_gl.so.1.3: undefined symbol: XGetUtf8FontAndGlyph
error: called from:
error:   /usr/share/octave/3.8.2/m/plot/util/graphics_toolkit.m at line 74, column 5
error: failed to load fltk graphics toolkit
error: base_graphics_toolkit::initialize: invalid graphics toolkit
error:   /usr/share/octave/3.8.2/m/plot/util/figure.m at line 94, column 9
error:   /usr/share/octave/3.8.2/m/plot/util/gcf.m at line 63, column 9
error:   /usr/share/octave/3.8.2/m/plot/util/newplot.m at line 113, column 8
error:   /usr/share/octave/3.8.2/m/plot/draw/plot.m at line 219, column 9

Both octave and fltk were compiled from source under gentoo:

x11-libs/fltk-1.3.3-r2:1  USE="opengl -cairo -debug -doc -examples -games -pdf -static-libs -threads -xft -xinerama"
sci-mathematics/octave-3.8.2:0/3.8.2  USE="X doc glpk gnuplot gui imagemagick opengl qhull qrupdate readline sparse zlib -curl -fftw -hdf5 -java -jit -postscript -static-libs"

resulting in configure switches of (for the fltk library):

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --includedir=/usr/include/fltk --libdir=/usr/lib64/fltk --docdir=/usr/share/doc/fltk-1.3.3-r2/html --enable-largefile --enable-shared --enable-xdbe --disable-localjpeg --disable-localpng --disable-localzlib --disable-debug --disable-cairo --enable-gl --disable-threads --disable-xft --disable-xinerama

and (for octave)

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-silent-rules --disable-dependency-tracking --docdir=/usr/share/doc/octave-3.8.2 --enable-shared --disable-static --localstatedir=/var/state/octave --with-blas=-L/usr/lib64/blas/reference -lblas   --with-lapack=-llapack -L/usr/lib64/blas/reference -lblas   --enable-docs --disable-java --enable-gui --disable-jit --enable-readline --without-curl --without-fftw3 --without-fftw3f --disable-fftw-threads --with-glpk --without-hdf5 --with-opengl --with-qhull --with-qrupdate --with-arpack --with-umfpack --with-colamd --with-ccolamd --with-cholmod --with-cxsparse --with-x --with-z --with-magick=GraphicsMagick

If I examine libfltk_gl.so.1.3 with nm, I see that the following symbols are exported:

$ nm -D /usr/lib64/fltk/libfltk_gl.so.1.3
                 U XCreateColormap
                 U XGetUtf8FontAndGlyph
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 w _Jv_RegisterClasses
                 U _Z10fl_measurePKcRiS1_i
000000000000e170 T _Z10gl_descentv
000000000000e590 T _Z10gl_measurePKcRiS1_
... <snip>

According to nm manual, the U designates that the symbol is global (external) but unknown. My question is whether this unknown symbol status is the origin of the error reported from octave, suggesting that the problem lies with how fltk was compiled, or whether the octave compilation is somehow at fault.

Edit: Solved by enabling Xft support: Please see comments below, and I thank Andy again for his help.

Rolf
  • 139
  • 1
  • 9

2 Answers2

3

XGetUtf8FontAndGlyph should be in libfltk.so.1.3.

nm -D /usr/lib/x86_64-linux-gnu/libfltk.so.1.3 |grep XGetU
00000000000c2fc0 T XGetUtf8FontAndGlyph

It's very likely that this is a problem with your configure flags for fltk and not GNU Octave. Just try it with the default settings first.

You can test if the UTF8 stuff with OpenGL is okay with the "cube" test. Just digg into the fltk-source dir tests:

cd fltk-1.3.3/test
make cube && ./cube

Does the text in the lower left of the GL window show up?

Andy
  • 7,931
  • 4
  • 25
  • 45
  • thanks so much for the quick answer and insight, I will compile fltk source and report results ... //rolf – Rolf Jan 14 '15 at 12:54
  • Andy- I did compile fltk sources with a default configure (i.e., just using `./configure`), and was successful in terms of getting live output from the cube test program, and the text does show up. – Rolf Jan 14 '15 at 14:57
  • 1
    Results from the plainjane configure are [here](https://copy.com/OoFPtua83Z4yHvnA). However, if I configure using `./configure --enable-gl --enable-shared`, the resulting `./src/libfltk.so.1.3` library lacks any exported `XGetUtf8FontAndGlyph` symbol; alternatively, configuring and making using the additional switches described in the original post, while giving the same cube output (with font), produces a library which also lacks *any* mention of a `XGetUtf8FontAndGlyph` symbol. Do you happen to know how your `libfltk.so.1.3` was compiled? Thanks -- – Rolf Jan 14 '15 at 15:37
  • 1
    OK, the problem was xft, or rather the lack of it (xft was disabled in the original configure). Enabling xft in configure (`--enable-xft`) removed the dependency on finding the XGetUtf8FontAndGlyph symbol ... and octave is able to use libfltk.so.1.3 without error :-) – Rolf Jan 14 '15 at 16:28
0

Had a similar problem. Was getting the following error while trying to run octave (undefined symbol: _ZN18Fl_XFont_On_Demand5valueEv):

bash-4.3$ octave
error: /usr/local/lib/octave/4.0.2/oct/i686-pc-linux-gnu/PKG_ADD: /usr/local/lib/octave/4.0.2/oct/i686-pc-linux-gnu/__init_fltk__.oct: failed to load: /usr/lib/libfltk_gl.so.1.3: undefined symbol: _ZN18Fl_XFont_On_Demand5valueEv
error: called from
    /usr/local/lib/octave/4.0.2/oct/i686-pc-linux-gnu/PKG_ADD at line 3 column 1

Command nm -D /usr/lib/libfltk_gl.so.1.3 showed that symbol _ZN18Fl_XFont_On_Demand5valueEv is undefined (with U):

0000a3d4 T _ZN14Fl_Glut_WindowD1Ev
0000a3d4 T _ZN14Fl_Glut_WindowD2Ev
         U _ZN18Fl_Font_DescriptorD1Ev
         U _ZN18Fl_Graphics_Driver11clip_regionEP8_XRegion
         U _ZN18Fl_XFont_On_Demand5valueEv

The solution was to apply a patch file mentioned here to some files inside source directory of FLTK-1.3.3 and then recompile and reinstall FLTK. Now octave works with FLTK without any problem.

Megidd
  • 7,089
  • 6
  • 65
  • 142