I'm using the entire LLVM toolchain v12.0.0 to build my packages. ghostscript-gpl fails with `ld.lld: error: undefined symbol: ...`. It works fine with GCC and Gold or BFD linker. All undefined symbol errors are related to app-text/tesseract. Adding `--without-tesseract` to `src_configure()` fixes the problem and ghostscript-gpl builds without issue. Here is one excerpt from the log file: ld.lld: error: undefined symbol: std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream() >>> referenced by altorenderer.cpp >>> ./obj/tesseract_api_altorenderer.o:(tesseract::TessBaseAPI::GetAltoText(tesseract::ETEXT_DESC*, int)) >>> referenced by baseapi.cpp >>> ./obj/tesseract_api_baseapi.o:(tesseract::TessBaseAPI::GetOsdText(int)) >>> referenced by hocrrenderer.cpp >>> ./obj/tesseract_api_hocrrenderer.o:(tesseract::TessBaseAPI::GetHOCRText(tesseract::ETEXT_DESC*, int)) >>> referenced 9 more times Reproducible: Always
The full build.log and emerge —-info output is always needed. Could you provide that please? Also, how about Clang with the normal GNU ld? ldd often exposes other issues unrelated to the compiler
Created attachment 700881 [details] Output of `emerge --info`
Created attachment 700884 [details] `build.log` with Clang + LLD and LTO enabled
Created attachment 700887 [details] `build.log` with Clang + BFD without LTO
Sorry, in previous bug reports no one asked for `build.log` and the output of `emerge --info`. Now I included them. The build process also fails when using Clang and BFD. Whether or not I enable LTO makes no difference. app-text/tesseract is not installed and installing tesseract also did not fix the issue.
confirm bug. Adding `--without-tesseract' to EXTRA_ECONF solves it.
Note that app-text/ghostscript-gpl is bundling an own fork of tesseract since 9.53... so app-text/ghostscript-gpl does NOT use app-text/tesseract. I personally do not care about Clang/LLVM/LLD at this point. Please report upstream and report back the link to their issue tracker. Also, patches are welcome.
In Arch's PKGBUILD - https://github.com/archlinux/svntogit-packages/blob/packages/ghostscript/trunk/PKGBUILD#L25 ------------------------------------------------------------- # *** remove after final decision *** # new in 9.54.0: # https://www.ghostscript.com/doc/9.54.0/News.htm # 1) inclusion of the tesseract/leptonica sources for OCR capabilities # at the moment we do not support linking with tesseract/leptonica shared libraries. # As is normal with such included libraries, deleting those directories and (re)running # configure (on Unix like systems) will automatically build without the OCR functionality. # increases package size ghostpcl 2.7->4.9MB | ghostscript 18->23MB | ghostxps 2,7->4.9MB # https://www.ghostscript.com/doc/9.54.0/VectorDevices.htm#UseOCR - # this doesn't seem to be worth to keep enabled until linking with shared libs is supported rm -r tesseract leptonica ---------------------------------------------------------------
So, maybe just remove those directories as other internal copies ?
do you have libcxx enabled? probably caused by it linking against libstdc++ instead of libc++. the invocation has "-lstdc++"
This is an actual bug. ghostscript-gpl hard-codes -lstdc++ and -stdlib=stdc++ in the Makefile, so having USE="libcxx" for sys-devel/clang doesn't actually do anything for this particular package. ghostscript-gpl should honor this but it doesn't. I added a package.env conf file for it with the following: CFLAGS="-O2 -stdlib=libc++ -fPIC -fstack-protector-strong -fstack-clash-protection -fomit-frame-pointer -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" # ghostscript-gpl completely ignores CXXFLAGS # -stdlib must actually be in CFLAGS CXXFLAGS="-O2 -stdlib=libc++ -fPIC -fstack-protector-strong -fstack-clash-protection -fomit-frame-pointer -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" LDFLAGS="-Wl,-O1 -Wl,--as-needed -lc++ -fuse-ld=lld -Wl,-z,now -Wl,-z,relro -Wl,--strip-debug" And the package built. The only relevant part for the bug is: -stdlib=libc++ in CFLAGS -lc++ in LDFLAGS. Rest are all hardening flags, don't worry about that.
Created attachment 770678 [details, diff] Patch for building with libc++ I've been using this patch for a while to make ghostscript-gpl build with clang/libc++.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab42ea869b7ed7f8739f3620728a4b5bddee68c9 commit ab42ea869b7ed7f8739f3620728a4b5bddee68c9 Author: Sam James <sam@gentoo.org> AuthorDate: 2022-04-17 11:03:53 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-04-17 12:08:58 +0000 app-text/ghostscript-gpl: fix build w/ libcxx (don't force libstdc++) Closes: https://bugs.gentoo.org/784173 Signed-off-by: Sam James <sam@gentoo.org> .../files/ghostscript-gpl-9.55.0-no-force-libstdcxx.patch | 12 ++++++++++++ app-text/ghostscript-gpl/ghostscript-gpl-9.55.0-r1.ebuild | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=463ee510db265bbd373aadce60112eca3d062c8d commit 463ee510db265bbd373aadce60112eca3d062c8d Author: Sam James <sam@gentoo.org> AuthorDate: 2022-04-17 12:06:58 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-04-17 12:08:59 +0000 app-text/ghostscript-gpl: add 9.56.1 (Done the font bit anyway for 502566). Closes: https://bugs.gentoo.org/820164 Bug: https://bugs.gentoo.org/784173 Bug: https://bugs.gentoo.org/502566 Signed-off-by: Sam James <sam@gentoo.org> app-text/ghostscript-gpl/Manifest | 2 + .../ghostscript-gpl/ghostscript-gpl-9.56.1.ebuild | 180 +++++++++++++++++++++ 2 files changed, 182 insertions(+)