While working on the port for FreeBSD, I'd like to remove the inlined Tesseract and Leptonica and use extenal ones: * https://www.freshports.org/graphics/tesseract/ * https://www.freshports.org/graphics/leptonica/ (transitive) This makes updating and security issue maintenance much much easier. Ideally, it would work like the rest, if tesseract/ isn't present it will try to link against external one, if not found disable it. I have almost everything external now: 14 LIB_DEPENDS= \ 15 libfontconfig.so:x11-fonts/fontconfig \ 16 libfreetype.so:print/freetype2 \ 17 libidn.so:dns/libidn \ 18 libjbig2dec.so:graphics/jbig2dec \ 19 liblcms2.so:graphics/lcms2 \ 20 libopenjp2.so:graphics/openjpeg \ 21 libpaper.so:print/libpaper \ 22 libpng.so:graphics/png \ 23 libtiff.so:graphics/tiff 68 CUPS_LIB_DEPENDS= libcupsimage.so:print/cups 72 IJS_LIB_DEPENDS= libijs.so:print/libijs Using FreeBSD 12 and 10.01.0rc2.
Updated lib list: LIB_DEPENDS= \ libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 \ libidn.so:dns/libidn \ libjbig2dec.so:graphics/jbig2dec \ libjpeg.so:graphics/jpeg-turbo \ liblcms2.so:graphics/lcms2 \ libopenjp2.so:graphics/openjpeg \ libpaper.so:print/libpaper \ libpng16.so:graphics/png \ libtiff.so:graphics/tiff CUPS_LIB_DEPENDS= libcups.so:print/cups IJS_LIB_DEPENDS= libijs.so:print/libijs # No TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract # See https://bugs.ghostscript.com/show_bug.cgi?id=706490
I have a sneaky suspicion that the reason we don't permit using system shared libraries is because we have changes in our fork. Another one for Robin to clarify.
(In reply to Ken Sharp from comment #2) > I have a sneaky suspicion that the reason we don't permit using system > shared libraries is because we have changes in our fork. > > Another one for Robin to clarify. If so, this would be clear then there is an inconsistency with lcms. You bundle it, along with doc/WhyIsThisAFork, yet configure.ac allows we me to link lcms from a system-installed one. A contradiction, no?
(In reply to Ken Sharp from comment #2) > I have a sneaky suspicion that the reason we don't permit using system > shared libraries is because we have changes in our fork. > > Another one for Robin to clarify. I have made changes in Tesseract for speed, but those have all been passed back upstream. As such, there is no reason why we can't build against suitable system ones. Michael Osipov says: > If so, this would be clear then there is an inconsistency with lcms. You bundle it, > along with doc/WhyIsThisAFork, yet configure.ac allows we me to link lcms from a > system-installed one. A contradiction, no? Ah, no. We contain 2 blobs of interface code within gs. One is used when building with our lcms2 fork. Another is used when building with system provided lcms2 libraries. The latter has to take additional care and use additional locking. It will not be as fast in some cases. This sounds like it's just a build system change now, so I'm going to pass this over to Chris who maintains our builds. Please note, this is not an indication that Chris will necessarily be able to get to it any time soon!
This should do it, if you could give it a try, please? A second tester would be appreciated: https://git.ghostscript.com/?p=user/chrisl/ghostpdl.git;a=commitdiff;h=115c54944a5b
(In reply to Chris Liddell (chrisl) from comment #5) > This should do it, if you could give it a try, please? A second tester would > be appreciated: > > https://git.ghostscript.com/?p=user/chrisl/ghostpdl.git;a=commitdiff; > h=115c54944a5b Will happily try on the FreeBSD port.
While testing, I see a stray 'yes': checking for c++ option to enable C++11 features... none needed yes checking supported C++ compiler flags... checking for tesseract >= 4.1.0 with pkg-config... yes
So, I have applied the following patch: > # git diff print/ghostscript10/Makefile > diff --git a/print/ghostscript10/Makefile b/print/ghostscript10/Makefile > index e03209a9eaa3..de62f3a54034 100644 > --- a/print/ghostscript10/Makefile > +++ b/print/ghostscript10/Makefile > @@ -38,8 +38,10 @@ EXTRACT_AFTER_ARGS= --exclude cups/libs \ > --exclude jbig2dec \ > --exclude jpeg \ > --exclude lcms2mt \ > + --exclude leptonica \ > --exclude libpng \ > --exclude openjpeg \ > + --exclude tesseract \ > --exclude tiff \ > --exclude zlib > > @@ -81,8 +83,8 @@ IJS_LIB_DEPENDS= libijs.so:print/libijs > IJS_CONFIGURE_WITH= ijs > > TESSERACT_USES= compiler:c++17-lang > +TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract > TESSERACT_CONFIGURE_WITH= tesseract > -# No TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract > # See https://bugs.ghostscript.com/show_bug.cgi?id=706490 > > X11_CONFIGURE_WITH= x along with the changes in 115c54944a5b locally to the ports repository. This is how it looks like with linked libleptonica and libtesseract: > /usr/local/bin/gs: > libgs.so.10 => /usr/local/lib/libgs.so.10 (0x80024d000) > libc.so.7 => /lib/libc.so.7 (0x80184c000) > libXt.so.6 => /usr/local/lib/libXt.so.6 (0x801c40000) > libSM.so.6 => /usr/local/lib/libSM.so.6 (0x801cab000) > libICE.so.6 => /usr/local/lib/libICE.so.6 (0x801cb5000) > libXext.so.6 => /usr/local/lib/libXext.so.6 (0x801cd1000) > libX11.so.6 => /usr/local/lib/libX11.so.6 (0x801ce6000) > libtiff.so.5 => /usr/local/lib/libtiff.so.5 (0x801e2f000) > libcups.so.2 => /usr/local/lib/libcups.so.2 (0x801eba000) > libijs.so.1 => /usr/local/lib/libijs.so.1 (0x801f53000) > libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x801f5b000) > libjbig2dec.so.0 => /usr/local/lib/libjbig2dec.so.0 (0x801f9a000) > libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x801fba000) > libz.so.6 => /lib/libz.so.6 (0x802062000) > liblcms2.so.2 => /usr/local/lib/liblcms2.so.2 (0x80207f000) > libm.so.5 => /lib/libm.so.5 (0x8020eb000) > libdl.so.1 => /usr/lib/libdl.so.1 (0x802122000) > libidn.so.12 => /usr/local/lib/libidn.so.12 (0x802126000) > libpaper.so.1 => /usr/local/lib/libpaper.so.1 (0x80215d000) > libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x802163000) > libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x8021b1000) > libopenjp2.so.7 => /usr/local/lib/libopenjp2.so.7 (0x80227a000) > libthr.so.3 => /lib/libthr.so.3 (0x8022e0000) > libtesseract.so.5 => /usr/local/lib/libtesseract.so.5 (0x80230e000) > libarchive.so.13 => /usr/local/lib/libarchive.so.13 (0x802647000) > libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x802718000) > libleptonica.so.5 => /usr/local/lib/libleptonica.so.5 (0x8027c6000) > libc++.so.1 => /usr/lib/libc++.so.1 (0x802a92000) > libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x802b69000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x802b8b000) > libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x802ba5000) > libzstd.so.1 => /usr/local/lib/libzstd.so.1 (0x802bd2000) > liblzma.so.5 => /usr/lib/liblzma.so.5 (0x802cbd000) > libjbig.so.2 => /usr/local/lib/libjbig.so.2 (0x802ce9000) > libdeflate.so.0 => /usr/local/lib/libdeflate.so.0 (0x802cf9000) > libavahi-common.so.3 => /usr/local/lib/libavahi-common.so.3 (0x802d12000) > libavahi-client.so.3 => /usr/local/lib/libavahi-client.so.3 (0x802d21000) > libgnutls.so.30 => /usr/local/lib/libgnutls.so.30 (0x802d34000) > libcrypt.so.5 => /lib/libcrypt.so.5 (0x802f50000) > libintl.so.8 => /usr/local/lib/libintl.so.8 (0x802f71000) > libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x802f7f000) > libbz2.so.4 => /usr/lib/libbz2.so.4 (0x802faf000) > libbrotlidec.so.1 => /usr/local/lib/libbrotlidec.so.1 (0x802fc4000) > libcrypto.so.111 => /lib/libcrypto.so.111 (0x802fd3000) > liblz4.so.1 => /usr/local/lib/liblz4.so.1 (0x8032c7000) > libnghttp2.so.14 => /usr/local/lib/libnghttp2.so.14 (0x8032f9000) > libssh2.so.1 => /usr/local/lib/libssh2.so.1 (0x80332b000) > libpsl.so.5 => /usr/local/lib/libpsl.so.5 (0x80336e000) > libssl.so.111 => /usr/lib/libssl.so.111 (0x803382000) > libheimntlm.so.11 => /usr/lib/libheimntlm.so.11 (0x803426000) > libhx509.so.11 => /usr/lib/libhx509.so.11 (0x80342f000) > libcom_err.so.5 => /usr/lib/libcom_err.so.5 (0x803480000) > libasn1.so.11 => /usr/lib/libasn1.so.11 (0x803485000) > libwind.so.11 => /usr/lib/libwind.so.11 (0x803528000) > libheimbase.so.11 => /usr/lib/libheimbase.so.11 (0x803553000) > libroken.so.11 => /usr/lib/libroken.so.11 (0x80355a000) > libkrb5.so.11 => /usr/lib/libkrb5.so.11 (0x803570000) > libgssapi.so.10 => /usr/lib/libgssapi.so.10 (0x8035f2000) > libgssapi_krb5.so.10 => /usr/lib/libgssapi_krb5.so.10 (0x8035fe000) > libgif.so.7 => /usr/local/lib/libgif.so.7 (0x803620000) > libwebp.so.7 => /usr/local/lib/libwebp.so.7 (0x80362c000) > libwebpmux.so.3 => /usr/local/lib/libwebpmux.so.3 (0x8036b0000) > libXau.so.6 => /usr/local/lib/libXau.so.6 (0x8036bd000) > libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x8036c3000) > libmd.so.6 => /lib/libmd.so.6 (0x8036cb000) > libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x8036e9000) > libp11-kit.so.0 => /usr/local/lib/libp11-kit.so.0 (0x803743000) > libidn2.so.0 => /usr/local/lib/libidn2.so.0 (0x80386f000) > libunistring.so.5 => /usr/local/lib/libunistring.so.5 (0x8038a3000) > libtasn1.so.6 => /usr/local/lib/libtasn1.so.6 (0x803a81000) > libnettle.so.8 => /usr/local/lib/libnettle.so.8 (0x803a98000) > libhogweed.so.6 => /usr/local/lib/libhogweed.so.6 (0x803aec000) > libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x803b36000) > libbrotlicommon.so.1 => /usr/local/lib/libbrotlicommon.so.1 (0x803bbc000) > libprivateheimipcc.so.11 => /usr/lib/libprivateheimipcc.so.11 (0x803be0000) > libsharpyuv.so.0 => /usr/local/lib/libsharpyuv.so.0 (0x803be6000) > libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x803bef000) > libffi.so.8 => /usr/local/lib/libffi.so.8 (0x803bf5000) > libelf.so.2 => /lib/libelf.so.2 (0x803c00000) without libtesseract: > /usr/local/bin/gs: > libgs.so.10 => /usr/local/lib/libgs.so.10 (0x80024d000) > libc.so.7 => /lib/libc.so.7 (0x801828000) > libXt.so.6 => /usr/local/lib/libXt.so.6 (0x801c1c000) > libSM.so.6 => /usr/local/lib/libSM.so.6 (0x801c87000) > libICE.so.6 => /usr/local/lib/libICE.so.6 (0x801c91000) > libXext.so.6 => /usr/local/lib/libXext.so.6 (0x801cad000) > libX11.so.6 => /usr/local/lib/libX11.so.6 (0x801cc2000) > libtiff.so.5 => /usr/local/lib/libtiff.so.5 (0x801e0b000) > libcups.so.2 => /usr/local/lib/libcups.so.2 (0x801e96000) > libijs.so.1 => /usr/local/lib/libijs.so.1 (0x801f2f000) > libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x801f37000) > libjbig2dec.so.0 => /usr/local/lib/libjbig2dec.so.0 (0x801f76000) > libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x801f96000) > libz.so.6 => /lib/libz.so.6 (0x80203e000) > liblcms2.so.2 => /usr/local/lib/liblcms2.so.2 (0x80205b000) > libm.so.5 => /lib/libm.so.5 (0x8020c7000) > libdl.so.1 => /usr/lib/libdl.so.1 (0x8020fe000) > libidn.so.12 => /usr/local/lib/libidn.so.12 (0x802102000) > libpaper.so.1 => /usr/local/lib/libpaper.so.1 (0x802139000) > libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x80213f000) > libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x80218d000) > libopenjp2.so.7 => /usr/local/lib/libopenjp2.so.7 (0x802256000) > libthr.so.3 => /lib/libthr.so.3 (0x8022bc000) > libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x8022ea000) > libzstd.so.1 => /usr/local/lib/libzstd.so.1 (0x802317000) > liblzma.so.5 => /usr/lib/liblzma.so.5 (0x802402000) > libjbig.so.2 => /usr/local/lib/libjbig.so.2 (0x80242e000) > libdeflate.so.0 => /usr/local/lib/libdeflate.so.0 (0x80243e000) > libavahi-common.so.3 => /usr/local/lib/libavahi-common.so.3 (0x802457000) > libavahi-client.so.3 => /usr/local/lib/libavahi-client.so.3 (0x802466000) > libgnutls.so.30 => /usr/local/lib/libgnutls.so.30 (0x802479000) > libcrypt.so.5 => /lib/libcrypt.so.5 (0x802695000) > libintl.so.8 => /usr/local/lib/libintl.so.8 (0x8026b6000) > libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x8026c4000) > libbz2.so.4 => /usr/lib/libbz2.so.4 (0x8026f4000) > libbrotlidec.so.1 => /usr/local/lib/libbrotlidec.so.1 (0x802709000) > libXau.so.6 => /usr/local/lib/libXau.so.6 (0x802718000) > libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x80271e000) > libmd.so.6 => /lib/libmd.so.6 (0x802726000) > libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x802744000) > libp11-kit.so.0 => /usr/local/lib/libp11-kit.so.0 (0x80279e000) > libidn2.so.0 => /usr/local/lib/libidn2.so.0 (0x8028ca000) > libunistring.so.5 => /usr/local/lib/libunistring.so.5 (0x8028fe000) > libtasn1.so.6 => /usr/local/lib/libtasn1.so.6 (0x802adc000) > libnettle.so.8 => /usr/local/lib/libnettle.so.8 (0x802af3000) > libhogweed.so.6 => /usr/local/lib/libhogweed.so.6 (0x802b47000) > libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x802b91000) > libbrotlicommon.so.1 => /usr/local/lib/libbrotlicommon.so.1 (0x802c17000) > libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x802c3b000) > libffi.so.8 => /usr/local/lib/libffi.so.8 (0x802c41000) > libelf.so.2 => /lib/libelf.so.2 (0x802c4c000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x802c67000) libtesseract brings a ton of dependencies with it. Please find the entire poudriere build log file attached. From my PoV the patch looks good.
Created attachment 24390 [details] Poudriere build log
A few remarks though: > # A little naff: because we ultimately link through gcc (rather than g++) I think that gcc and g++ should be replaced with cc and c++ to portray generic C and C++ compilers, don't expect GCC to be available or used everywhere. I need to check these: > ====> Running Q/A tests (stage-qa) > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libarchive.so.13 from archivers/libarchive but it is not declared as a dependency > Warning: you need USES+=libarchive > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libcurl.so.4 from ftp/curl but it is not declared as a dependency > Warning: you need LIB_DEPENDS+=libcurl.so:ftp/curl > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libleptonica.so.5 from graphics/leptonica but it is not declared as a dependency > Warning: you need LIB_DEPENDS+=libleptonica.so:graphics/leptonica Looking back at the chageset, I see: > nobody@124-release-amd64-default-head:/usr/local/libdata/pkgconfig % pkg-config --libs tesseract lept > -L/usr/local/lib -ltesseract -larchive -lcurl -lleptonica so this should do: > +TESSERACT_USES= compiler:c++17-lang libarchive > +TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract \ > + libleptonica.so:graphics/leptonica \ > + libcurl.so:ftp/curl
(In reply to Michael Osipov from comment #10) > A few remarks though: > > > # A little naff: because we ultimately link through gcc (rather than g++) > > I think that gcc and g++ should be replaced with cc and c++ to portray > generic C and C++ compilers, don't expect GCC to be available or used > everywhere. Well, it is only a comment that I don't expect many to see. And I'm not at all clear how this would work with Sun cc, IBM xlc etc, etc.... I've changed it to "CC" and "CXX". I'd note that this doesn't work for clang/clang++ and I don't know how to make it work for those. > I need to check these: > > ====> Running Q/A tests (stage-qa) > > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libarchive.so.13 from archivers/libarchive but it is not declared as a dependency > > Warning: you need USES+=libarchive > > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libcurl.so.4 from ftp/curl but it is not declared as a dependency > > Warning: you need LIB_DEPENDS+=libcurl.so:ftp/curl > > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libleptonica.so.5 from graphics/leptonica but it is not declared as a dependency > > Warning: you need LIB_DEPENDS+=libleptonica.so:graphics/leptonica > > Looking back at the chageset, I see: > > nobody@124-release-amd64-default-head:/usr/local/libdata/pkgconfig % pkg-config --libs tesseract lept > > -L/usr/local/lib -ltesseract -larchive -lcurl -lleptonica > so this should do: > > +TESSERACT_USES= compiler:c++17-lang libarchive > > +TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract \ > > + libleptonica.so:graphics/leptonica \ > > + libcurl.so:ftp/curl I don't follow... we don't have either TESSERACT_USES nor TESSERACT_LIB_DEPENDS.
(In reply to Chris Liddell (chrisl) from comment #11) > (In reply to Michael Osipov from comment #10) > > A few remarks though: > > > > > # A little naff: because we ultimately link through gcc (rather than g++) > > > > I think that gcc and g++ should be replaced with cc and c++ to portray > > generic C and C++ compilers, don't expect GCC to be available or used > > everywhere. > > Well, it is only a comment that I don't expect many to see. And I'm not at > all clear how this would work with Sun cc, IBM xlc etc, etc.... I've changed > it to "CC" and "CXX". > > I'd note that this doesn't work for clang/clang++ and I don't know how to > make it work for those. I can tell how it works with HP aCC on HP-UX :-D. One links with the compiler you have invoked: aCC. > > I need to check these: > > > ====> Running Q/A tests (stage-qa) > > > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libarchive.so.13 from archivers/libarchive but it is not declared as a dependency > > > Warning: you need USES+=libarchive > > > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libcurl.so.4 from ftp/curl but it is not declared as a dependency > > > Warning: you need LIB_DEPENDS+=libcurl.so:ftp/curl > > > Error: /usr/local/lib/libgs.so.10.01 is linked to /usr/local/lib/libleptonica.so.5 from graphics/leptonica but it is not declared as a dependency > > > Warning: you need LIB_DEPENDS+=libleptonica.so:graphics/leptonica > > > > Looking back at the chageset, I see: > > > nobody@124-release-amd64-default-head:/usr/local/libdata/pkgconfig % pkg-config --libs tesseract lept > > > -L/usr/local/lib -ltesseract -larchive -lcurl -lleptonica > > so this should do: > > > +TESSERACT_USES= compiler:c++17-lang libarchive > > > +TESSERACT_LIB_DEPENDS= libtesseract.so:graphics/tesseract \ > > > + libleptonica.so:graphics/leptonica \ > > > + libcurl.so:ftp/curl > > I don't follow... we don't have either TESSERACT_USES nor > TESSERACT_LIB_DEPENDS. No need to, this is FreeBSD port specific. I have already solved it. libtesseract requires you to link directly to libarchive, libcurl and libleptonica via pkg-config. That's it. So all is good.
Note: I cannot try on HP-UX because the compiler does not even support C++11.
Commit pushed: https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=d3a14aea7d7 I suspect there will be future massaging required for other environments, we'll address those as they arise.
(In reply to Chris Liddell (chrisl) from comment #14) > Commit pushed: > > https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=d3a14aea7d7 > > I suspect there will be future massaging required for other environments, > we'll address those as they arise. Thanks Chris, looking forward to the new release!
I have noticed that this is not part of 10.01.2. Is this on purpose?
*** Bug 705764 has been marked as a duplicate of this bug. ***