LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   compiling Epson scanning software needs libpng12/png.h (https://www.linuxquestions.org/questions/slackware-14/compiling-epson-scanning-software-needs-libpng12-png-h-4175579164/)

brobr 05-06-2016 02:25 PM

compiling Epson scanning software needs libpng12/png.h
 
Hi, I found some nice scripts to make Slackware packages for an Epson scanner (V330) we have at work at http://www.giustetti.net/wiki/index....re_14.1_update

On slackware64-current I ran into problems when compiling one of these packages, namely iscan, which needs an older version of libpng.

To cut a long story (see below) short: the program looks for a header file, png.h, that's no longer in the expected format on current so that compilation goes wrong.

Apart from the current libpng with its header, Slackware still ships a compiled 'outdated' libpng-library (as /usr/lib64/libpng.so.14) that might work with this software.

The latest Epson software I found for Linux is from February 2015. I emailed Epson with this error and asked if they have a solution that would make their code compatible with the current libpng api, but without that, does anyone have an idea how I can get around this??

Thanks in advance for any suggestions,

rob

LONG:

The iscan.Slackbuild comes with a patch that sets a header file for the required libpng library to use (to libpng12/png.h in Slackware 14.1).

Current has now libpng16, not libpng12, and there has been a API change in the libpng libs from 1.4 (libpng14) to 1.5 (libpng15) and onwards (see http://www.libpng.org/pub/png/libpng.html). Because of this, the compilation runs into errors:
Code:

make[3]: Entering directory '/tmp/sg/tmp-iscan/iscan-2.30.1/lib'
/bin/sh ../libtool --tag=CXX  --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I../include  -O2 -fPIC -MT libimage_stream_la-imgstream.lo -MD -MP -MF .deps/libimage_stream_la-imgstream.Tpo -c -o libimage_stream_la-imgstream.lo `test -f 'imgstream.cc' || echo './'`imgstream.cc
 g++ -DHAVE_CONFIG_H -I. -I.. -I../include -O2 -fPIC -MT libimage_stream_la-imgstream.lo -MD -MP -MF .deps/libimage_stream_la-imgstream.Tpo -c imgstream.cc  -fPIC -DPIC -o .libs/libimage_stream_la-imgstream.o
In file included from imgstream.cc:38:0:
pngstream.hh:48:26: fatal error: libpng12/png.h: No such file or directory
compilation terminated.
Makefile:430: recipe for target 'libimage_stream_la-imgstream.lo' failed
make[3]: *** [libimage_stream_la-imgstream.lo] Error 1

Changing libpn12/png.h to libpng14/png.h in the patch-file gives the same error (png.h not found) as only the compiled library is present for libpng14.

When I try to use libpng16/png.h it shows that the error is due to the api-change, as shown in the lines

Code:

pngstream.cc:86:36: error: invalid use of incomplete type 'png_struct {aka struct png_struct_def}'
in this compilation-error output
Code:

make[3]: Entering directory '/tmp/sg/tmp-iscan/iscan-2.30.1/lib'
/bin/sh ../libtool --tag=CXX  --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I../include  -O2 -fPIC -MT libimage_stream_la-pngstream.lo -MD -MP -MF .deps/libimage_stream_la-pngstream.Tpo -c -o libimage_stream_la-pngstream.lo `test -f 'pngstream.cc' || echo './'`pngstream.cc
 g++ -DHAVE_CONFIG_H -I. -I.. -I../include -O2 -fPIC -MT libimage_stream_la-pngstream.lo -MD -MP -MF .deps/libimage_stream_la-pngstream.Tpo -c pngstream.cc  -fPIC -DPIC -o .libs/libimage_stream_la-pngstream.o
pngstream.cc: In member function 'virtual iscan::basic_imgstream& iscan::pngstream::flush()':
pngstream.cc:86:36: error: invalid use of incomplete type 'png_struct {aka struct png_struct_def}'
    if (_header && !_footer && _png->num_rows == _png->flush_rows)
                                    ^
In file included from pngstream.hh:48:0,
                from pngstream.cc:34:
/usr/include/png.h:444:16: note: forward declaration of 'png_struct {aka struct png_struct_def}'
 typedef struct png_struct_def png_struct;
                ^
pngstream.cc:86:54: error: invalid use of incomplete type 'png_struct {aka struct png_struct_def}'
    if (_header && !_footer && _png->num_rows == _png->flush_rows)
                                                      ^
In file included from pngstream.hh:48:0,
                from pngstream.cc:34:
/usr/include/png.h:444:16: note: forward declaration of 'png_struct {aka struct png_struct_def}'
 typedef struct png_struct_def png_struct;
                ^
Makefile:458: recipe for target 'libimage_stream_la-pngstream.lo' failed
make[3]: *** [libimage_stream_la-pngstream.lo] Error 1


55020 05-06-2016 02:43 PM

Try https://git.archlinux.org/svntogit/c...packages/iscan

moesasji 05-06-2016 04:09 PM

This is cheating, but alienbob provides packages for iscan, see http://www.slackware.com/~alien/slackbuilds/. His packages work on current. Note that you probably need to install iscan-data and iscan-network-nt as well.

edit) If you want to build it yourself, just look through the patches he is using as those are in the build folder.

btw) I find that the only time I use iscan is when I need to scan two-sided as that is the only thing that doesn't work in xsane.

brobr 05-06-2016 04:24 PM

Fab, thanks for finding this fivefiveamsterdam. Will try it asap.

rob

brobr 05-06-2016 05:08 PM

@moerasji

Thanks for the pointer; didn't think looking there. One thing, that v330 scanner needs some proprietory plugin, as mentioned in the scripts I referred to; but no trace of those in Eric's scripts. Eric uses the same patch as 55020 linked to. That patch worked, only I have to get that plugin installed/built first

brobr 05-06-2016 05:19 PM

Epson sent their support: I should have sent the email to their UK office instead of the US.
They gave me a link ;-) http://www.epson.co.uk/support?produ...rs_and_manuals
Quote:


There are no drivers for your chosen operating system.
And I only used their website to contact them...

Next, their blame for the fault in their software -that could have been repaired for over a year- might also come this way

brobr 05-06-2016 07:15 PM

The Arch patch works, compilation goes but lateron chokes on libesmod:
Code:

make[2]: Leaving directory '/tmp/sg/tmp-iscan/iscan-2.30.1/backend'
Making install in non-free
make[2]: Entering directory '/tmp/sg/tmp-iscan/iscan-2.30.1/non-free'
make[3]: Entering directory '/tmp/sg/tmp-iscan/iscan-2.30.1/non-free'
rm -f libesmod.so
case x86_64 in \
  i?86)                arch=i386;; \
  x86_64)        arch=x86_64;; \
  *)        echo "unsupported architecture" 1>&2; \
        exit 1;; \
esac; \
ln -s ./libesmod-${arch}.so libesmod.so
/bin/sh ../mkinstalldirs /tmp/sg/package-iscan/usr/lib64
installing libesmod.so in /usr/lib64/libesmod.so...
/bin/sh /tmp/sg/tmp-iscan/iscan-2.30.1/install-sh -c -s ./libesmod.so /tmp/sg/package-iscan/usr/lib64/libesmod.so.2.0.0
/tmp/sg/tmp-iscan/iscan-2.30.1/install-sh: ./libesmod.so does not exist.
make[3]: Nothing to be done for 'install-data-am'.


Also with Alien's build script on his source-file:
Code:

make[2]: Entering directory '/tmp/build/tmp-iscan/iscan-2.30.1/non-free'
rm -f libesmod.so
case x86_64 in \
  i?86)                arch=i386;; \
  x86_64)        arch=x86_64;; \
  *)        echo "unsupported architecture" 1>&2; \
        exit 1;; \
esac; \
ln -s ./libesmod-${arch}.so libesmod.so
/bin/sh ../mkinstalldirs /tmp/build/package-iscan/usr/lib64
installing libesmod.so in /usr/lib64/libesmod.so...
/bin/ginstall -c ./libesmod.so /tmp/build/package-iscan/usr/lib64/libesmod.so.2.0.0
/bin/ginstall: cannot stat './libesmod.so': No such file or directory

[EDIT] When I check the build-folders in both cases, there is a broken link for ./libesmod.so. This is supposed to link to ./libesmod-x86_64.so but in the folder there is only libesmod-x86_64.c2.so. Thus the difference is in that 'c2'.

Does anyone have an idea?

EDIT: this happens despite that other required packages, the iscan-data and the v330-specific plugin, have been installed

55020 05-06-2016 07:56 PM

From https://git.archlinux.org/svntogit/c...packages/iscan

Code:

  # add fix for CXX ABI different than 1002
  ln -s libesmod-x86_64.c2.so non-free/libesmod-x86_64.so

It's not plagiarism if you acknowledge your sources ;)

moesasji 05-07-2016 01:51 AM

Quote:

Originally Posted by brobr (Post 5541574)
@moerasji

Thanks for the pointer; didn't think looking there. One thing, that v330 scanner needs some proprietory plugin, as mentioned in the scripts I referred to; but no trace of those in Eric's scripts. Eric uses the same patch as 55020 linked to. That patch worked, only I have to get that plugin installed/built first

The missing plugin is on top of Alienbob's packages (although you need a modified iscan-data, which has a patch that adds an additional usb-id looking at the website you link to). After you get iscan to build you would have to add the plugin using the Slackbuild for the plugin that is on the website you link to in your startpost, so starting with this one: http://www.giustetti.net/resource/sl...-plugin.tar.gz

brobr 05-07-2016 06:54 AM

@55020: Thanks again, that extra link cured compiling iscan with Alien's build-script and also Simone's one got far until it tries to compile the frontend; then it stumbles:
Code:

make[2]: Entering directory '/tmp/sg/tmp-iscan/iscan-2.30.1/frontend'
/bin/sh ../libtool --tag=CXX  --mode=link g++ -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread -I/usr/include/gimp-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libdrm -I/usr/include/libpng16  -O2 -fPIC  -o iscan iscan-file-selector.o iscan-pisa_aleart_dialog.o iscan-pisa_change_unit.o iscan-pisa_configuration.o iscan-pisa_error.o iscan-pisa_gamma_correction.o iscan-pisa_gimp.o iscan-pisa_image_controls.o iscan-pisa_img_converter.o iscan-pisa_main.o iscan-pisa_main_window.o iscan-pisa_marquee.o iscan-pisa_preference.o iscan-pisa_preview_window.o iscan-pisa_progress_window.o iscan-pisa_sane_scan.o iscan-pisa_scan_manager.o iscan-pisa_scan_selector.o iscan-pisa_scan_tool.o iscan-pisa_settings.o iscan-pisa_tool.o iscan-pisa_view_manager.o iscan-xpm_data.o ../lib/libimage-stream.la -lsane -lltdl -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype ../non-free/libesmod.so -lsane
g++ -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread -I/usr/include/gimp-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libdrm -I/usr/include/libpng16 -O2 -fPIC -o iscan iscan-file-selector.o iscan-pisa_aleart_dialog.o iscan-pisa_change_unit.o iscan-pisa_configuration.o iscan-pisa_error.o iscan-pisa_gamma_correction.o iscan-pisa_gimp.o iscan-pisa_image_controls.o iscan-pisa_img_converter.o iscan-pisa_main.o iscan-pisa_main_window.o iscan-pisa_marquee.o iscan-pisa_preference.o iscan-pisa_preview_window.o iscan-pisa_progress_window.o iscan-pisa_sane_scan.o iscan-pisa_scan_manager.o iscan-pisa_scan_selector.o iscan-pisa_scan_tool.o iscan-pisa_settings.o iscan-pisa_tool.o iscan-pisa_view_manager.o iscan-xpm_data.o ../non-free/libesmod.so  ../lib/.libs/libimage-stream.a -lv4l1 /usr/lib64/libieee1284.so /usr/lib64/libtiff.so /usr/lib64/liblzma.so -lz /usr/lib64/libjpeg.so /usr/lib64/libgphoto2.so /usr/lib64/libgphoto2_port.so -ldl /usr/lib64/libexif.so /usr/lib64/libusb-1.0.so /usr/lib64/libudev.so -lpthread /usr/lib64/../lib64/libstdc++.so /usr/lib64/libltdl.so /usr/lib64/libgtk-x11-2.0.so /usr/lib64/libgdk-x11-2.0.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libatk-1.0.so /usr/lib64/libcairo.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libgio-2.0.so /usr/lib64/libpangoft2-1.0.so /usr/lib64/libpango-1.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libglib-2.0.so /usr/lib64/libfontconfig.so /usr/lib64/libfreetype.so /usr/lib64/libsane.so -Wl,--rpath -Wl,/usr/lib64/../lib64 -Wl,--rpath -Wl,/usr/lib64/../lib64
/usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../x86_64-slackware-linux/bin/ld: ../lib/.libs/libimage-stream.a(libimage_stream_la-pngstream.o): undefined reference to symbol 'png_set_longjmp_fn@@PNG16_0'
/usr/lib64/../lib64/libpng16.so.16: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:438: recipe for target 'iscan' failed

apparently -lpng could be missing from the link line (according to a remark I found here for a similar error http://mailman.speleo.sk/pipermail/t...er/005623.html. But why it does compile with Alien's script that configures with --enable-frontend and and not with Simone's one is beyond me.

@moesasji: Thanks for the pointers, but as I started with Simone's scripts, I had compiled iscan-data (incl. the usb-patch not present in Eric's build) and the extra plugin using his directions; that worked fine (although I was too tired last night to realize I had to rename some variables (prgnam, model etc. in the plugin-script) to the ones needed). Possibly copying the required rpm from the plugin-folder in the epson-download bundle and turn that into a slackware package with rpm2tgz might also get the stuff in place.

Anyway, thanks to all I have iscan working on my box; now I have to see whether I can scan my plates on Monday.

55020 05-07-2016 07:36 AM

Quote:

Originally Posted by brobr (Post 5541772)
apparently -lpng could be missing from the link line (according to a remark I found here for a similar error http://mailman.speleo.sk/pipermail/t...er/005623.html. But why it does compile with Alien's script that configures with --enable-frontend and and not with Simone's one is beyond me.

You are correct about needing to add an extra argument to the link. "Underlinking" is one of the annoying things that gcc has been tightening up with each major release over the last few years. It's a bug, for small values of bug, in the upstream link command.

Eric's script explictly fixes the bug by adding it to the linker flags, but Eric cleverly handles both Slackware-14.1 (which needs -lpng14) and Slackware-14.2 (which needs -lpng16). Look at http://www.slackware.com/~alien/slac...can.SlackBuild and observe what he does with PNG_LDFLAGS at various places in the script.

brobr 05-07-2016 09:21 AM

@55020: Thanks for the pointer. Iscan also compiles now with Simone's script after putting those LDFLAGS in...
Setting LDFLAGS..., I thought I could leave that behind after removing multilib ..;-)

Eric's package creates the possibility to scan from gimp; that's what i'll try.

If I get an image from that v330-scanner at work I can mark this thread as 'solved'.

rob

brobr 05-09-2016 10:16 AM

OK, no luck. dmesg sees the scanner, xsane as well and iscan too, but it's all very slow and it gets nowhere. I tried on my USB2 and USB3 ports of my laptop (maybe therefore the two identical scanners found??? see below).

xsane starts and eventually (it takes quite a while) sees the scanner and let's me chose it and then drops away into a cyber-black hole. Iscan does the same. From the command line sane-find-scanner shows a common permission problem (according to the number of times it pops up when googling it) but with no clear solution (it seems to go away by itself somehow as no clear answers are given on those posts how it got solved; mostly it seems by installing the binaries and the plugin; which I've done). Shame magic doesn't happen here..... Yes, me, as user is part of scanner, plugdev, lp in /etc/group. But also root has no joy finding a scanner; it gets the pipe error and then it stops (no permission problems there; note that one of the permission blocks is for a usb-hub the thing is plugged in to.)

Code:

bash-4.3$ scanimage -L
device `epkowa:usb:001:008' is a Epson (unknown model) flatbed scanner
device `epkowa:usb:001:008' is a Epson (unknown model) flatbed scanner
bash-4.3$ sane-find-scanner

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.
  # Also you need support for SCSI Generic (sg) in your operating system.
  # If using Linux, try "modprobe sg".

could not open USB device 0x1d6b/0x0002 at 002:001: Access denied (insufficient permissions)
found USB scanner (vendor=0x04b8 [EPSON], product=0x0142 [EPSON Perfection V33/V330]) at libusb:001:008
could not fetch string descriptor: Pipe error
could not fetch string descriptor: Pipe error
could not open USB device 0x1d6b/0x0002 at 001:001: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0003 at 004:001: Access denied (insufficient permissions)
could not open USB device 0x8087/0x07da at 003:002: Access denied (insufficient permissions)
could not open USB device 0x1d6b/0x0002 at 003:001: Access denied (insufficient permissions)
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.
bash-4.3$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 008: ID 04b8:0142 Seiko Epson Corp. GT-F730 [GT-S630/Perfection V33/V330 Photo]
Bus 001 Device 007: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 8087:07da Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
bash-4.3$

EDIT: I get the same output with scanimage -L after turning off the scanner or unplugging it. Only the line
Code:

found USB scanner (vendor=0x04b8 [EPSON], product=0x0142 [EPSON Perfection V33/V330]) at libusb:001:011
is then missing. So, all those pipe- and permission errors may not mean a thing; maybe it's just not working; that scanner-software I compiled ......


Syslog has this nearby...
Code:

May  9 14:41:27 knotsUL kernel: [  350.434847] usb 1-1.3: new high-speed USB device number 8 using ehci-pci
May  9 14:41:27 knotsUL kernel: [  350.523137] usb 1-1.3: New USB device found, idVendor=04b8, idProduct=0142
May  9 14:41:27 knotsUL kernel: [  350.523143] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
May  9 14:41:27 knotsUL kernel: [  350.523146] usb 1-1.3: Product: EPSON Perfection V33/V330
May  9 14:41:27 knotsUL kernel: [  350.523149] usb 1-1.3: Manufacturer: EPSON
May  9 14:41:27 knotsUL mtp-probe: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2"
May  9 14:41:27 knotsUL mtp-probe: bus: 1, device: 7 was not an MTP device

and yes that scanner is not a mp3-player.....

So I am not there yet...:-(

moesasji 05-09-2016 03:14 PM

The only thing I remember doing when installing my epson-scanner besides adding the software is editing /etc/sane.d/epkowa.conf as I needed to explicitly tell it what IP-address to use.

btw) you probably already did. Check that your user is in the correct groups, with "scanner" the obvious one.

brobr 05-09-2016 04:14 PM

@Moesasji: yes, my user is in the "scanner" [EDIT: and "lp", required for SANE to deal with multifunctional printer/scanners-see Changes&Hints] groups. I did edit that /etc/sane.d/epoka.conf-file; commented the scsi out (saved on an error message) and added the usb id for the scanner but that is not really making a difference. The V330 is usb-only, alas no network capacity (that might have made it working....)


All times are GMT -5. The time now is 12:08 PM.