#1055567 Error: gscan2pdf fails to compile

#1055567#5
Date:
2023-11-08 08:20:05 UTC
From:
To:
Version: 2.13.2-0~ppa1focal

OS: Kubuntu 20.04

Other details: No scanner is attached with the computer. I use gscan2pdf
for stitching images scanned by a handheld scanner. The program worked
perfectly till last Aug'23.

Problem: gscan2pdf fails at command with the following error message. No
logfile is generated.

Error Message:

Bareword "SANE_NAME_SCAN_TL_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 128.
Bareword "SANE_NAME_SCAN_TL_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 143.
Bareword "SANE_NAME_SCAN_TL_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 145.
Bareword "SANE_NAME_SCAN_BR_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 146.
Bareword "SANE_NAME_SCAN_BR_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 149.
Bareword "SANE_NAME_SCAN_TL_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 130.
Bareword "SANE_NAME_SCAN_BR_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 131.
Bareword "SANE_NAME_SCAN_BR_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 134.
Bareword "SANE_NAME_PAGE_HEIGHT" not allowed while "strict subs" in use
at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 116.
Bareword "SANE_NAME_PAGE_WIDTH" not allowed while "strict subs" in use
at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 122.
Compilation failed in require at /usr/share/perl5/Gscan2pdf/Document.pm
line 12.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Document.pm line 12.
Compilation failed in require at
/usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7.
Compilation failed in require at /usr/bin/gscan2pdf line 61.
BEGIN failed--compilation aborted at /usr/bin/gscan2pdf line 61.


Please help to resolve the problem.
------------------------------------------------------------------------
*URL:* http://www.soumyanath.in *Ph:* +91 33 46004248(R)    +91 98318
04223(M) *ORCiD:* 0000-0003-4411-0669
<https://orcid.org/0000-0003-4411-0669>

#1055567#10
Date:
2023-11-08 18:08:49 UTC
From:
To:
How are you starting gscan2pdf?

What does the following return?

apt list libimage-sane-perl

Regards

Jeff

#1055567#15
Date:
2023-11-10 08:33:19 UTC
From:
To:
Thank you for your prompt reply. I run gscan2pdf from command prompt to
get the error list.

Here is the output you wanted:

$apt list libimage-sane-perl
Listing... Done
libimage-sane-perl/focal,now 5-1 amd64 [installed,automatic]

Please note: I do not have any scanner connected with my computer.


Regards

Soumyanath Chatterjee /  FIE, FIIE/
Prod. Dev & SCM coach
Former TVS Motors Chair Professor, IIT Kharagpur, INDIA
------------------------------------------------------------------------ *URL:* http://www.soumyanath.in *Ph:* +91 33 46004248(R)    +91 98318 04223(M) *ORCiD:* 0000-0003-4411-0669 <https://orcid.org/0000-0003-4411-0669>
#1055567#20
Date:
2023-11-12 09:46:07 UTC
From:
To:
Please start gscan2pdf from the command line with the --log option:

gscan2pdf --log=log

then quit, and post the log file, which gscan2pdf should have compressed
with xz.

#1055567#25
Date:
2023-11-12 10:57:39 UTC
From:
To:
Tried running it  but no log file is generated. Here is the console output:

soumyanath@ganak-desktop:~$ gscan2pdf --log=log
Bareword "SANE_NAME_SCAN_TL_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 128.
Bareword "SANE_NAME_SCAN_TL_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 143.
Bareword "SANE_NAME_SCAN_TL_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 145.
Bareword "SANE_NAME_SCAN_BR_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 146.
Bareword "SANE_NAME_SCAN_BR_Y" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 149.
Bareword "SANE_NAME_SCAN_TL_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 130.
Bareword "SANE_NAME_SCAN_BR_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 131.
Bareword "SANE_NAME_SCAN_BR_X" not allowed while "strict subs" in use at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 134.
Bareword "SANE_NAME_PAGE_HEIGHT" not allowed while "strict subs" in use
at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 116.
Bareword "SANE_NAME_PAGE_WIDTH" not allowed while "strict subs" in use
at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 122.
Compilation failed in require at /usr/share/perl5/Gscan2pdf/Document.pm
line 12.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Document.pm line 12.
Compilation failed in require at
/usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7.
Compilation failed in require at /usr/bin/gscan2pdf line 61.
BEGIN failed--compilation aborted at /usr/bin/gscan2pdf line 61.


Regards

Soumyanath Chatterjee /  FIE, FIIE/
Prod. Dev & SCM coach
Former TVS Motors Chair Professor, IIT Kharagpur, INDIA
------------------------------------------------------------------------ *URL:* http://www.soumyanath.in *Ph:* +91 33 46004248(R)    +91 98318 04223(M) *ORCiD:* 0000-0003-4411-0669 <https://orcid.org/0000-0003-4411-0669>
#1055567#30
Date:
2023-11-12 17:22:21 UTC
From:
To:
Please start an interactive Perl session with:

perl -d -e 1

Then execute the following:

use Image::Sane ':all';
print SANE_NAME_PAGE_HEIGHT, "\n";

and report the response.

Afterwards, you can quit with q<return>

#1055567#35
Date:
2023-11-13 15:24:12 UTC
From:
To:
Please find the output:

Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(-e:1):   l
  DB<1> use Image::Sane ':all';
Can't load
'/usr/lib/x86_64-linux-gnu/perl5/5.30/auto/Image/Sane/Sane.so' for
module Image::Sane: /usr/lib/x86_64-linux-gnu/libsane.so.1: undefined
symbol: l
ibusb_set_option at /usr/share/perl/5.30/XSLoader.pm line 93.
at /usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 144.
Compilation failed in require at (eval
10)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
at (eval 10)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
        main::BEGIN() called at (eval
10)[/usr/share/perl/5.30/perl5db.pl:738] line 2
        eval {...} called at (eval
10)[/usr/share/perl/5.30/perl5db.pl:738] line 2
        eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) =
@DB::saved;package main; $^D = $^D | $DB::db_stop;
use Image::Sane \':all\';;
' called at /usr/share/perl/5.30/perl5db.pl line 738
        DB::eval called at /usr/share/perl/5.30/perl5db.pl line 3138
        DB::DB called at -e line 1
BEGIN failed--compilation aborted at (eval
10)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
at (eval 10)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
        eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) =
@DB::saved;package main; $^D = $^D | $DB::db_stop;
use Image::Sane \':all\';;
' called at /usr/share/perl/5.30/perl5db.pl line 738
        DB::eval called at /usr/share/perl/5.30/perl5db.pl line 3138
        DB::DB called at -e line 1

  DB<2> print SANE_NAME_PAGE_HEIGHT, "\n";
No comma allowed after filehandle at (eval
15)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
at (eval 15)[/usr/share/perl/5.30/perl5db.pl:738] line 2.
        eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) =
@DB::saved;package main; $^D = $^D | $DB::db_stop;
print SANE_NAME_PAGE_HEIGHT, "\\n";;
' called at /usr/share/perl/5.30/perl5db.pl line 738
        DB::eval called at /usr/share/perl/5.30/perl5db.pl line 3138
        DB::DB called at -e line 1

  DB<3>

#1055567#40
Date:
2023-11-13 17:16:00 UTC
From:
To:
If that failed, my first question is why you didn't see the same failure
from the same line in /usr/share/perl5/Gscan2pdf/Scanner/Options.pm ?
What do you see in line 8 of that file?

What do you get from

ldd /usr/lib/x86_64-linux-gnu/perl5/5.30/auto/Image/Sane/Sane.so

ls -l /usr/lib/x86_64-linux-gnu/perl5/5.30/auto/Image/Sane/Sane.so

ls -l /usr/lib/x86_64-linux-gnu/libsane.so.1

?

#1055567#45
Date:
2023-11-15 11:19:21 UTC
From:
To:
Please find response to your questions below (in blue )



Regards

Soumyanath Chatterjee /  FIE, FIIE/

/----------------
/

I find line 8 is commented out

package Gscan2pdf::Scanner::Options;

use strict;
use warnings;
no if $] >= 5.018, warnings => 'experimental::smartmatch';
use Carp;
use Glib qw(TRUE FALSE);    # To get TRUE and FALSE
# use Image::Sane ':all';     # For enums

linux-vdso.so.1 (0x00007ffc2831c000)
        libsane.so.1 => /usr/lib/x86_64-linux-gnu/libsane.so.1
(0x00007f3ae5f7b000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ae5d89000)
        libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0
(0x00007f3ae5b7b000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3ae5b75000)
        libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2
(0x00007f3ae59bb000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3ae5fd4000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3ae59b1000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f3ae598c000)
        libicuuc.so.66 => /usr/lib/x86_64-linux-gnu/libicuuc.so.66
(0x00007f3ae57a6000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3ae578a000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5
(0x00007f3ae5761000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3ae5612000)
        libicudata.so.66 => /usr/lib/x86_64-linux-gnu/libicudata.so.66
(0x00007f3ae3b51000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(0x00007f3ae396d000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f3ae3952000)

lrwxrwxrwx 1 root root 17 Sep 17  2020
/usr/lib/x86_64-linux-gnu/libsane.so.1-> libsane.so.1.0.29
---- I tried to remove the comment in line 8 of /usr/share/perl5/Gscan2pdf/Scanner/Options.pm and run gscan2pdf both as normal user and as su. Here is the output from that: soumyanath@ganak-desktop:~$ gscan2pdf Can't load '/usr/lib/x86_64-linux-gnu/perl5/5.30/auto/Image/Sane/Sane.so' for module Image::Sane: /usr/lib/x86_64-linux-gnu/libsane.so.1: undefined symbol: l ibusb_set_option at /usr/share/perl/5.30/XSLoader.pm line 93. at /usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 144. Compilation failed in require at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 8. BEGIN failed--compilation aborted at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 8. Compilation failed in require at /usr/share/perl5/Gscan2pdf/Document.pm line 12. BEGIN failed--compilation aborted at /usr/share/perl5/Gscan2pdf/Document.pm line 12. Compilation failed in require at /usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7. BEGIN failed--compilation aborted at /usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7. Compilation failed in require at /usr/bin/gscan2pdf line 61. BEGIN failed--compilation aborted at /usr/bin/gscan2pdf line 61. Undefined subroutine &Image::Sane::_exit called at /usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 190. END failed--call queue aborted at /usr/bin/gscan2pdf line 61. soumyanath@ganak-desktop:~$ sudo gscan2pdf Can't load '/usr/lib/x86_64-linux-gnu/perl5/5.30/auto/Image/Sane/Sane.so' for module Image::Sane: /usr/lib/x86_64-linux-gnu/libsane.so.1: undefined symbol: l ibusb_set_option at /usr/share/perl/5.30/XSLoader.pm line 93. at /usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 144. Compilation failed in require at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 8. BEGIN failed--compilation aborted at /usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 8. Compilation failed in require at /usr/share/perl5/Gscan2pdf/Document.pm line 12. BEGIN failed--compilation aborted at /usr/share/perl5/Gscan2pdf/Document.pm line 12. Compilation failed in require at /usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7. BEGIN failed--compilation aborted at /usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7. Compilation failed in require at /usr/bin/gscan2pdf line 61. BEGIN failed--compilation aborted at /usr/bin/gscan2pdf line 61. Undefined subroutine &Image::Sane::_exit called at /usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 190. END failed--call queue aborted at /usr/bin/gscan2pdf line 61. soumyanath@ganak-desktop:~$
#1055567#50
Date:
2023-11-15 20:52:46 UTC
From:
To:
I take it, therefore, that you didn't comment out the line yourself
sometime in the past?

How did you install gscan2pdf?

What about

ls -l /usr/lib/x86_64-linux-gnu/libsane.so.1.0.29

?

#1055567#55
Date:
2023-11-16 10:58:05 UTC
From:
To:
Please find the responses in red.


I am not very sure. I think I installed it from ubuntu repository or
might have taken it from sourceforge

#1055567#60
Date:
2023-11-19 10:45:01 UTC
From:
To:
Please reinstall the packages:

sudo apt reinstall libsane1 libimage-sane-perl

and try to start gscan2pdf again.

#1055567#65
Date:
2023-11-19 15:13:33 UTC
From:
To:

This is what I get

soumyanath@ganak-desktop:~$ gscan2pdf
Can't load
'/usr/lib/x86_64-linux-gnu/perl5/5.30/auto/Image/Sane/Sane.so' for
module Image::Sane: /usr/lib/x86_64-linux-gnu/libsane.so.1: undefined
symbol: l
ibusb_set_option at /usr/share/perl/5.30/XSLoader.pm line 93.
at /usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 144.
Compilation failed in require at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 8.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Scanner/Options.pm line 8.
Compilation failed in require at /usr/share/perl5/Gscan2pdf/Document.pm
line 12.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Document.pm line 12.
Compilation failed in require at
/usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7.
BEGIN failed--compilation aborted at
/usr/share/perl5/Gscan2pdf/Dialog/Renumber.pm line 7.
Compilation failed in require at /usr/bin/gscan2pdf line 61.
BEGIN failed--compilation aborted at /usr/bin/gscan2pdf line 61.
Undefined subroutine &Image::Sane::_exit called at
/usr/lib/x86_64-linux-gnu/perl5/5.30/Image/Sane.pm line 190.
END failed--call queue aborted at /usr/bin/gscan2pdf line 61.
---
#1055567#70
Date:
2023-11-19 16:05:53 UTC
From:
To:
It looks like the version of libusb libsane was built against is not the
same as the one you are running with.

There are some similarities here:
https://askubuntu.com/questions/1264001/error-installing-xsane-sane-hplip-etc-with-undefined-symbol-libusb-set-optio

What does the following return?

apt-cache policy libsane1 libsane-common libimage-sane-perl libusb-1.0

#1055567#75
Date:
2023-11-19 16:18:47 UTC
From:
To:

soumyanath@ganak-desktop:~$ apt-cache policy libsane1 libsane-common
libimage-sane-perl libusb-1.0
libsane1:
  Installed: 1.0.29-0ubuntu5.2
  Candidate: 1.0.29-0ubuntu5.2
  Version table:
*** 1.0.29-0ubuntu5.2 500
        500 http://in.archive.ubuntu.com/ubuntu focal-updates/universe
amd64 Packages
        100 /var/lib/dpkg/status
     1.0.29-0ubuntu5.1 500
        500 http://security.ubuntu.com/ubuntu focal-security/universe
amd64 Packages
     1.0.29-0ubuntu5 500
        500 http://in.archive.ubuntu.com/ubuntu focal/universe amd64
Packages
libsane-common:
  Installed: 1.0.29-0ubuntu5.2
  Candidate: 1.0.29-0ubuntu5.2
  Version table:
*** 1.0.29-0ubuntu5.2 500
        500 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64
Packages
        500 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386
Packages
        100 /var/lib/dpkg/status
     1.0.29-0ubuntu5.1 500
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64
Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main i386
Packages
     1.0.29-0ubuntu5 500
        500 http://in.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        500 http://in.archive.ubuntu.com/ubuntu focal/main i386 Packages
libimage-sane-perl:
  Installed: 5-1
  Candidate: 5-1
  Version table:
*** 5-1 500
        500 http://in.archive.ubuntu.com/ubuntu focal/universe amd64
Packages
        100 /var/lib/dpkg/status
libusb-1.0-0:
  Installed: 2:1.0.23-2build1
  Candidate: 2:1.0.23-2build1
  Version table:
*** 2:1.0.23-2build1 500
        500 http://in.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
libusb-1.0-0-dev:
  Installed: (none)
  Candidate: 2:1.0.23-2build1
  Version table:
     2:1.0.23-2build1 500
        500 http://in.archive.ubuntu.com/ubuntu focal/main amd64 Packages
libusb-1.0-doc:
  Installed: (none)
  Candidate: 2:1.0.23-2build1
  Version table:
     2:1.0.23-2build1 500
        500 http://in.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        500 http://in.archive.ubuntu.com/ubuntu focal/main i386 Packages

#1055567#80
Date:
2023-11-20 11:33:55 UTC
From:
To:
What about:

sudo ldconfig

cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf

If you start gscan2pdf as follows:

LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/ gscan2pdf

?

Can you start xsane, simple-scan or scanimage ?

#1055567#85
Date:
2023-11-20 16:51:44 UTC
From:
To:

soumyanath@ganak-desktop:~$ sudo ldconfig
[sudo] password for soumyanath:
soumyanath@ganak-desktop:~$ cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
soumyanath@ganak-desktop:~$ LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/
gscan2pdf

This one works.

Please suggest what changes I need to make to run it normally

#1055567#90
Date:
2023-11-20 21:17:08 UTC
From:
To:
For me, this isn't a problem with gscan2pdf, but with the way that
libsane was compiled (or better, linked) against libusb.

i.e. the problem can only be fixed by a new version of libsane.

As you are using Ubuntu, I suggest you raise a bug against the libsane
package:

https://packages.ubuntu.com/search?keywords=libsane

#1055567#95
Date:
2023-11-21 16:14:23 UTC
From:
To:
Thank you Jeff for your persistent effort in tracking down the bug. It
has given me a workaround to run gscan2pdf.

As advised, I will raise a separate request for libsane.