I've been using Linux for a while now and found an irritating problem with Perl Tk: if you compile Tk with XFT support, most all programs (specifically any program that uses the -font attribute on anything) will come to an untimely demise at the hands of "Segmentation fault."
If you compile Tk manually for Linux, in the fairly standard way (perl Makefile.pl; make; make install), it doesn't compile with XFT support, and therefore fonts are not anti-aliased. However, when compiled in this way, none of my Tk programs ever segfault unless I do something REALLY bad (i.e. a blatant syntax error in the code, to where Tk seems to think it's better to segfault than to tell me about the syntax error).
However, if you compile Tk with XFT (through "perl Makefile.pl XFT=1"), the fonts will be anti-aliased and look a lot better, however the programs will frequently segfault.
Example: perfectly valid code such as this would likely cause a segfault in Tk with XFT compiled in:
If you attempted to run that code and got a segfault, a little trial-and-error would turn up that the -font declaration is the cause of the segfault. It's perfectly valid Tk code and it would work fine on Win32 and Tk without XFT, but Tk+XFT would cause an inexplicable segfault because of it.
The segfaults aren't always 100% triggered by just any -font declaration, though. In some of my programs, I could get away with using several -font's in my widgets but then there'd be just one widget that pushes it over the edge (and even deleting that widget and retyping its code wouldn't help).
The only workaround I've found for writing Tk programs that don't crash under Linux is for me, as the developer, to work with Tk minus XFT, and release compiled versions of my program for Linux users.
Unfortunately for other Linux users though... if they didn't compile Tk manually, the one they install through their package manager (ex. yum or apt) is almost always compiled with XFT. So when I write a Tk program and release source code, a lot of my users complain that it segfaults on their system and I have to explain that they have to "yum remove perl-tk" and recompile Tk themselves, or use my compiled distribution of my program (which will use my version of Tk regardless of their version of Tk).
Anybody know about this issue or possibly any solution to it?
-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
If you compile Tk manually for Linux, in the fairly standard way (perl Makefile.pl; make; make install), it doesn't compile with XFT support, and therefore fonts are not anti-aliased. However, when compiled in this way, none of my Tk programs ever segfault unless I do something REALLY bad (i.e. a blatant syntax error in the code, to where Tk seems to think it's better to segfault than to tell me about the syntax error).
However, if you compile Tk with XFT (through "perl Makefile.pl XFT=1"), the fonts will be anti-aliased and look a lot better, however the programs will frequently segfault.
Example: perfectly valid code such as this would likely cause a segfault in Tk with XFT compiled in:
Code:
#!/usr/bin/perl -w
use Tk;
my $mw = MainWindow->new;
my $label = $mw->Label (
-text => 'Hello, world!',
-font => [
-family => 'Helvetica',
-size => 10,
-weight => 'bold',
],
)->pack;
MainLoop;
If you attempted to run that code and got a segfault, a little trial-and-error would turn up that the -font declaration is the cause of the segfault. It's perfectly valid Tk code and it would work fine on Win32 and Tk without XFT, but Tk+XFT would cause an inexplicable segfault because of it.
The segfaults aren't always 100% triggered by just any -font declaration, though. In some of my programs, I could get away with using several -font's in my widgets but then there'd be just one widget that pushes it over the edge (and even deleting that widget and retyping its code wouldn't help).
The only workaround I've found for writing Tk programs that don't crash under Linux is for me, as the developer, to work with Tk minus XFT, and release compiled versions of my program for Linux users.
Unfortunately for other Linux users though... if they didn't compile Tk manually, the one they install through their package manager (ex. yum or apt) is almost always compiled with XFT. So when I write a Tk program and release source code, a lot of my users complain that it segfaults on their system and I have to explain that they have to "yum remove perl-tk" and recompile Tk themselves, or use my compiled distribution of my program (which will use my version of Tk regardless of their version of Tk).
Anybody know about this issue or possibly any solution to it?
-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog