Closed ariep closed 6 years ago
Can you try building from the latest on either the master or glabels-3_4 branch. I believe this was fixed a while back.
Thanks for the quick response!
I tried compiling the master branch. I had trouble getting autoconf to work, so I took a shortcut and copied some generated files (configure
, depcomp
, and various Makefile.in
s) from the 3.4.0 release into the master branch instead – no idea if there are changes between the two that may make that go wrong.
After that, ./configure
, make
and sudo make install
. The new program has the same behaviour as the latest release, unfortunately:
$ glabels-3-batch -i input.csv -o output-rpi-master.pdf text.glabels
LibGlabels-Message: Duplicate template: Dymo 11355.
LABEL FILE = text.glabels
I let it run for two minutes, during which memory use steadily climbs, I killed it after that time.
I am not sure what is going on. I cut&pasted your two files, ran glabels-batch exactly as you ran it above -- it works as expected:
I am using the head of the glabels_3_4 branch.
Hm, I wonder what the difference could be. Debian jessie is rather old of course, and it's a headless server, so maybe some libraries or dependencies are either missing or too old.
What would be the best way to get some debugging output, so we can see where the program enters its endless loop?
Also, I'd like to exclude anything caused by my half-baked build procedure. I tried building the latest master on a more modern desktop machine, but when I run autoreconf --install
(is that even the right command? I couldn't find documentation on that in glabels), I get:
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:24: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:24: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:35: installing './compile'
configure.ac:35: installing './config.guess'
configure.ac:35: installing './config.sub'
configure.ac:24: installing './install-sh'
configure.ac:24: installing './missing'
Makefile.am: installing './INSTALL'
automake-1.15: error: cannot open < gtk-doc.make: No such file or directory
autoreconf-2.69: automake failed with exit status: 1
The gtk-doc
package is installed, if that's relevant.
gLabels 3.4.0-2 builds just fine in a jessie environment. Assuming you don't have sbuild
or pbuilder
in place:
apt-get install devscripts
dget -x http://deb.debian.org/debian/pool/main/g/glabels/glabels_3.4.0-2.dsc
cd glabels-3.4.0
apt-get install autotools-dev autoconf-archive cdbs intltool gnome-doc-utils gtk-doc-tools yelp-tools libglib2.0-dev libgtk-3-dev libxml2-dev librsvg2-dev libcairo2-dev libpango1.0-dev libebook1.2-dev barcode libqrencode-dev libiec16022-dev
dpkg-buildpackage -B
Thanks. I managed to build and install a glabels-3.4.0-2
Debian package (I needed to do glabels-data
first). That exhibits the same problem as the one I built from master source: its glabels-3-batch
with my inputs keeps eating cpu and memory, not producing any pdf output.
I just tried your example with 3.4.0-2 both on buster and jessie. It created a PDF just fine in both cases.
Thanks for trying, that further restricts the possible causes. Maybe it's the architecture then (raspberry pi, armhf), or the fact that it's a headless server missing some runtime component that glabels-3-batch depends on?
Is there a way to get debug output, so I can see what the program is trying to do when it hangs? I'll try running it under strace as well.
Here is some strace output of a hanging run. It first loads lots of libraries, templates and font files (I'm wondering why it tries to load so many template files by the way, when it has been given a template file to work with on the command line). Then:
[…]
gettimeofday({1522398409, 961034}, NULL) = 0
futex(0x762dbca0, FUTEX_WAKE, 2147483647) = 0
futex(0x762dbca0, FUTEX_WAKE, 2147483647) = 0
futex(0x762dbca0, FUTEX_WAKE, 2147483647) = 0
open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
read(3, "\3008\16\233\204\10[Q;Y\262\32\254T\242%", 16) = 16
close(3) = 0
futex(0x762dbca0, FUTEX_WAKE, 2147483647) = 0
open("/home/arie/labels/input.csv", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=8, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x72e80000
read(3, "text\nabc", 4096) = 8
read(3, "", 4096) = 0
read(3, "", 4096) = 0
read(3, "", 4096) = 0
read(3, "", 4096) = 0
read(3, "", 4096) = 0
read(3, "", 4096) = 0
[…]
And the read calls continue indefinitely.
It seems that it's trying to read more from the input file than available, for some reason.
(For this particular call, I used an input csv file without trailing newline. I also tried with single trailing newline, and an extra empty line at the end. That doesn't matter for the result.)
O.k. so we are continuously trying to read data even though the system read is telling us that it just read zero bytes. Unfortunately this part of the code is not instrumented well enough to see what is actually going on.
If you are ok with modifying source, can you do something like
printf( "c = %d\n", c);
after the line
c=gl_getc (merge_text);
in the file src/merge-text.c
? You should see something like:
c = 116
c = 101
c = 120
c = 116
c = 13
c = 97
c = 98
c = 99
c = -1
The -1
should terminate the reading. My guess is that somehow an architectural difference is causing the -1
to be interpreted as something else. This is usually due to missing prototypes or improper casts. It's also possible that the encoding detection code is messing up somehow.
Output from that:
LABEL FILE = text.glabels
c = 116
c = 101
c = 120
c = 116
c = 10
c = 97
c = 98
c = 99
c = 10
c = 10
c = 255
c = 255
c = 255
[…]
the last lines keep repeating of course.
That did it! Change the following
static gchar
gl_getc(glMergeText *merge_text) {
to
static gint
gl_getc(glMergeText *merge_text) {
At some point, getc
was wrapped by the function gl_getc
which returned char
instead of int
. This didn't cause any problems on Intel platforms since char
is signed by default. However, on ARM char
is unsigned by default, thus causing the EOF
(-1) to be interpreted as 255.
This is great news. Do you think this plus the other commits on glabels-3_4 justify a 3.4.1 release?
Indeed, that makes it work. Thanks a lot!
It's taking rather a long time (13 seconds) to produce a single pdf, but I'll make a separate issue for that.
Hi, I'm trying to run
glabels-3-batch
to create a pdf file from a template and csv file, contents added at the end.Printing to a pdf file from the glabels gui (version 3.4.0 from my laptop, amd64 with gentoo) works, and gives the expected result: text "abc" centered horizontally and vertically. However, running
glabels-3-batch -i input.csv -o output.pdf text.glabels
I'm not sure if there's something wrong with my input files or that these are various problems with glabels, any idea?
text.glabels (unzipped):
input.csv: