octave 找不到 fltk XGetUtf8FontAndGlyph 符号

标签 octave fltk

octave 3.8.2 在加载时产生此错误:

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

我获得了以下有关图形库配置的信息

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

虽然最初没有明显加载图形工具包,

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

我可以随后注册它们,

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
}

但尝试加载 fltk 会产生与初始警告一致的错误

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

当然,尝试绘制任何东西也会失败,

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

octave 和 fltk 都是从 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"

导致(对于 fltk 库)的配置开关:

./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

和( 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

如果我用 nm 检查 libfltk_gl.so.1.3,我看到导出了以下符号:

$ 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>

根据 nm 手册,U 表示该符号是全局(外部)但未知的。我的问题是这个未知的符号状态是否是 octave 报告的错误的来源,这表明问题在于 fltk 的编译方式,或者 octave 编译是否有某种错误。

编辑:通过启用 Xft 支持解决:请参阅下面的评论,我再次感谢 Andy 的帮助。

最佳答案

XGetUtf8FontAndGlyph 应该在 libfltk.so.1.3 中。

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

这很可能是您为 fltk 而不是 GNU Octave 配置标志的问题。请先使用默认设置进行尝试。

您可以通过“立方体”测试来测试 OpenGL 的 UTF8 内容是否正常。只需深入研究 fltk-source 目录测试:

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

GL窗口左下角的文字是否显示出来?

关于octave 找不到 fltk XGetUtf8FontAndGlyph 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27941384/

相关文章:

c++ - 如何将参数传递给 draw() 方法 - FLTK

c++ - FLTK 子窗口在 Linux 上不重绘

c++ - 如何在FLTK中远离Tab_Button?

python - 机器学习鸡尾酒会音频应用

cygwin - Octave 无法绘制加载到不同地址的 : cygoctave-1. dll

octave - lm_feasible 算法的自由度数有限制吗?如果是这样,限制是多少?

gradient - Octave:计算多维函数在特定点的梯度

c++ - FLTK C++ Fl_line 不绘制

c++ - 在 Linux 上使用 MinGW 交叉编译 C++ 代码,目标是 Windows : error happens