Bug 234221 - print/tex-luatex: Fails to link after switch to internal libpoppler
Summary: print/tex-luatex: Fails to link after switch to internal libpoppler
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hiroki Sato
URL:
Keywords: regression
: 236882 237902 239608 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-12-20 16:32 UTC by John Hein
Modified: 2019-08-28 18:15 UTC (History)
7 users (show)

See Also:
tcberner: maintainer-feedback-


Attachments
[log] manual link invocation (with -v) (6.66 KB, text/plain)
2018-12-20 16:47 UTC, John Hein
no flags Details
[build log] log of build failure with gcc (302.35 KB, text/plain)
2018-12-31 23:58 UTC, John Hein
no flags Details
[patch] fix for mixed clang/gcc mismatch triggering link failure (368 bytes, patch)
2019-05-24 14:11 UTC, John Hein
jcfyecrayz: maintainer-approval? (hrs)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2018-12-20 16:32:47 UTC
After r487226, building print/tex-luatex is failing with a linker error on 11-stable/amd64.

 .
 .
 .
c++ -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wno-write-strings -O2 -pipe -fstack-protector -fno-strict-aliasing -fstack-protector -o luatex luatexdir/luatex-luatex.o mplibdir/luatex-lmplib.o -fstack-protector -Wl,--export-dynamic libluatex.a libff.a libluamisc.a libluasocket.a -L/usr/local/lib -ltexlua52 libmplib.a -lmpfr -lgmp -lcairo -lpthread -lpixman-1 -lzzip -lpng16 -lz /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a lib/lib.a -lkpathsea libmputil.a libunilib.a libmd5.a -lm
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a(Form.o): In function `_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE16_M_insert_uniqueIRKiEESt4pairISt17_Rb_tree_iteratorIiEbEOT_':
Form.cc:(.text._ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE16_M_insert_uniqueIRKiEESt4pairISt17_Rb_tree_iteratorIiEbEOT_[_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE16_M_insert_uniqueIRKiEESt4pairISt17_Rb_tree_iteratorIiEbEOT_]+0x90): undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
Form.cc:(.text._ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE16_M_insert_uniqueIRKiEESt4pairISt17_Rb_tree_iteratorIiEbEOT_[_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEE16_M_insert_uniqueIRKiEESt4pairISt17_Rb_tree_iteratorIiEbEOT_]+0xcf): undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
/usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a(Gfx.o): In function `Gfx::opXObject(Object*, int)':
Gfx.cc:(.text+0x12a99): undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
Comment 1 John Hein 2018-12-20 16:33:26 UTC
Adding committer.
Comment 2 John Hein 2018-12-20 16:47:58 UTC
Created attachment 200309 [details]
[log] manual link invocation (with -v)

Attached is a copy of the output of the c++ link command that is failing (with -v).
Comment 3 Tobias C. Berner freebsd_committer 2018-12-20 18:38:08 UTC
Moin moin


I cannot reproduce this in my 11 jail.


mfg Tobias
Comment 4 Rainer Hurling 2018-12-20 18:48:03 UTC
Same here on HEADamd64 r342007:

/bin/sh ./libtool  --tag=CXX    --mode=link c++ -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wno-write-strings  -O2 -pipe -fstack-protector -fno-strict-aliasing -export-dynamic -fstack-protector -o luatex luatexdir/luatex-luatex.o  mplibdir/luatex-lmplib.o libluatex.a libff.a libluamisc.a libluasocket.a -L/usr/local/lib -ltexlua52 libmplib.a -L/usr/local/lib -lmpfr -L/usr/local/lib -lgmp -L/usr/local/lib -lcairo -lpthread  -L/usr/local/lib -lpixman-1 -L/usr/local/lib -fstack-protector -lzzip -lz -L/usr/local/lib -lpng16 -lz -lz  /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a lib/lib.a -L/usr/local/lib -lkpathsea libmputil.a libunilib.a libmd5.a   -lm
libtool: link: c++ -Wimplicit -Wreturn-type -Wno-unknown-pragmas -Wno-write-strings -O2 -pipe -fstack-protector -fno-strict-aliasing -fstack-protector -o luatex luatexdir/luatex-luatex.o mplibdir/luatex-lmplib.o -fstack-protector -Wl,--export-dynamic  libluatex.a libff.a libluamisc.a libluasocket.a -L/usr/local/lib -ltexlua52 libmplib.a -lmpfr -lgmp -lcairo -lpthread -lpixman-1 -lzzip -lpng16 -lz /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a lib/lib.a -lkpathsea libmputil.a libunilib.a libmd5.a -lm
ld: error: undefined symbol: std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)
>>> referenced by stl_tree.h:1771 (/usr/local/lib/gcc8/include/c++/bits/stl_tree.h:1771)
>>>               Form.o:(std::pair<std::_Rb_tree_iterator<int>, bool> std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_insert_unique<int const&>(int const&)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::_Rb_tree_decrement(std::_Rb_tree_node_base*)
>>> referenced by stl_tree.h:302 (/usr/local/lib/gcc8/include/c++/bits/stl_tree.h:302)
>>>               Form.o:(std::pair<std::_Rb_tree_iterator<int>, bool> std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_insert_unique<int const&>(int const&)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)
>>> referenced by stl_tree.h:2491 (/usr/local/lib/gcc8/include/c++/bits/stl_tree.h:2491)
>>>               Gfx.o:(Gfx::opXObject(Object*, int)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1643 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:1643)
>>>               CachedFile.o:(std::vector<CachedFile::Chunk, std::allocator<CachedFile::Chunk> >::_M_default_append(unsigned long)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_out_of_range_fmt(char const*, ...)
>>> referenced by stl_vector.h:960 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:960)
>>>               StructElement.o:(StructElement::findAttribute(Attribute::Type, bool, Attribute::Owner) const) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_out_of_range_fmt(char const*, ...)
>>> referenced by stl_vector.h:960 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:960)
>>>               StructElement.o:(StructElement::findAttribute(Attribute::Type, bool, Attribute::Owner) const) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_out_of_range_fmt(char const*, ...)
>>> referenced by stl_vector.h:960 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:960)
>>>               StructElement.o:(StructElement::parseAttributes(Dict*, bool)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_out_of_range_fmt(char const*, ...)
>>> referenced by stl_vector.h:960 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:960)
>>>               StructElement.o:(StructElement::parse(Dict*)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_out_of_range_fmt(char const*, ...)
>>> referenced by stl_vector.h:960 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:960)
>>>               StructElement.o:(StructElement::appendSubTreeText(GooString*, bool) const) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)
>>> referenced by stl_tree.h:1771 (/usr/local/lib/gcc8/include/c++/bits/stl_tree.h:1771)
>>>               StructElement.o:(std::pair<std::_Rb_tree_iterator<int>, bool> std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_insert_unique<int>(int&&)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::_Rb_tree_decrement(std::_Rb_tree_node_base*)
>>> referenced by stl_tree.h:302 (/usr/local/lib/gcc8/include/c++/bits/stl_tree.h:302)
>>>               StructElement.o:(std::pair<std::_Rb_tree_iterator<int>, bool> std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_insert_unique<int>(int&&)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1643 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:1643)
>>>               StructTreeRoot.o:(std::vector<std::vector<StructTreeRoot::Parent, std::allocator<StructTreeRoot::Parent> >, std::allocator<std::vector<StructTreeRoot::Parent, std::allocator<StructTreeRoot::Parent> > > >::_M_default_append(unsigned long)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a

ld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1643 (/usr/local/lib/gcc8/include/c++/bits/stl_vector.h:1643)
>>>               StructTreeRoot.o:(std::vector<StructTreeRoot::Parent, std::allocator<StructTreeRoot::Parent> >::_M_default_append(unsigned long)) in archive /usr/ports/print/tex-luatex/work/texlive-20150521-source/libs/poppler/libpoppler.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/print/tex-luatex/work/texlive-20150521-source/texk/web2c
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/print/tex-luatex/work/texlive-20150521-source/texk/web2c
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/print/tex-luatex/work/texlive-20150521-source/texk/web2c
*** Error code 1

Stop.
make: stopped in /usr/ports/print/tex-luatex
Comment 5 Tobias C. Berner freebsd_committer 2018-12-20 19:55:50 UTC
Moin moin


I reproduce this on neither

* Jail OSVERSION: 1102000 (11.2-RELEASE-p7 i386)
* Jail OSVERSION: 1300005 (13-CURRENT r342109)

Please, update your systems/packages and try again.


mfg Tobias
Comment 6 Rainer Hurling 2018-12-20 20:53:32 UTC
(In reply to Tobias C. Berner from comment #5)

Hi Tobias,

Thanks for your work and suggestion.

I just rebuilt the whole dependencies tree for print/tex-luatex with recent ports tree and unfortunately it fails like before:

portmaster pixman-0.34.0_1 texlive-texmf-20150523_4 tex-formats-20150521_2 mpfr-4.0.1_2 poppler-0.72.0 png-1.6.35 cairo-1.15.12,2 zziplib-0.13.69_1 tex-web2c-20150521_3 tex-libtexluajit-2.0.3 tex-libtexlua-5.2.4 tex-kpathsea-6.2.1_2 tex-luatex-0.80.0_9
Comment 7 Tobias C. Berner freebsd_committer 2018-12-21 13:19:25 UTC
Hi Rainer

I now also tried it with a CURRENT jail at r42007. Still builds fine. So my guess still is, that your package are way out of sync with each other and the tree underlying it.

Please try to update your ports tree and *all* the installed packages to the latest version -- not selectively only the dependencies of tex-luatex. 

Then try again.



mfg Tobias
Comment 8 Rainer Hurling 2018-12-22 08:19:22 UTC
(In reply to Tobias C. Berner from comment #7)

Hi Tobias,

Thanks for testing also in a CURRENT jail.

Unfortunately, the boxes, where this happens on my side, are all in production use. The ports are all built via portmaster, with several non default options enabled, because they are needed by GIS software. Additionally, the rebuild does not work for several ports, because they have problems ATM (e.g math/libpgmath).

I haven't tried to do this via an own Poudriere repository until now. If I would change, this would take a long time (~ 2700 ports to build).
Comment 9 Tobias C. Berner freebsd_committer 2018-12-22 18:18:11 UTC
Hi there

As I could not reproduce this with an up-to-date ports tree and the FreeBSD versions mentioned in the PR I have to assume that it is related to pkgs/ports being out of sync. 

Please reopen this issue if you updated everything and it still fails :)


mfg Tobias
Comment 10 John Hein 2018-12-24 15:47:04 UTC
It compiles with poudriere testport.

But still not outside that environment.  It's happening on another host (11/stable i386) as well.  Trying to determine the jail and out-of-jail differences.
Comment 11 John Hein 2018-12-24 15:47:41 UTC
(In reply to John Hein from comment #10)
print/tex-xetex has the same problem.
Comment 12 John Hein 2018-12-27 06:17:29 UTC
Re-opening.  The problem is reproduced (in poudriere jail or out) if lang/gcc (and thus also lang/gcc8) is installed.  The 'configure' stage looks for gcc and uses it (instead of /usr/bin/cc) if it finds it.
Comment 13 John Hein 2018-12-27 06:18:05 UTC
Workaround: make CC=/usr/bin/cc CXX=/usr/bin/c++
Comment 14 Tobias C. Berner freebsd_committer 2018-12-30 00:55:41 UTC
(In reply to John Hein from comment #12)
I have lang/gcc8 installed, and it does not fail. 

* Do you have CC&Co overriden in your make.conf/environemnt? 
* Please upload a full build log.
Comment 15 John Hein 2018-12-31 23:58:01 UTC
Created attachment 200667 [details]
[build log] log of build failure with gcc

(In reply to Tobias C. Berner from comment #14)
Build log is attached.  There is no CC defined in make.conf

Compare to your build log (feel free to attach yours as well).  Pay particular attention to the configure phase where it tries to detect gcc.  You should see:

checking for gcc... gcc

If gcc is not detected, you will see:

checking for gcc... no

And then the build will use /usr/bin/cc (and /usr/bin/c++) and not fail.

If you are trying to use poudriere to reproduce, you may want to use 'bulk -i lang/gcc' or 'testport -i lang/gcc' and then run 'make -C /usr/ports/print/tex-luatex' manually inside the jail.  Or manually add 'BUILD_DEPENDS=gcc:lang/gcc' to tex-luatex/Makefile before 'testport print/tex-luatex'.  I don't know of another way currently to force poudriere to have a set of non-dependent packages (e.g., lang/gcc) installed before it tries to build a particular port (e.g., print/tex-luatex).
Comment 16 MikeH 2019-02-14 18:28:47 UTC
I can confirm I have the same problem as John on a fresh install with updated ports tree (FreeBSD 12.0-RELEASE-p3)
John's workaround in Comment 13 worked.
Comment 17 rkoberman 2019-05-15 03:00:53 UTC
*** Bug 237902 has been marked as a duplicate of this bug. ***
Comment 18 rkoberman 2019-05-15 03:41:01 UTC
I am seeing this with 12.0-STABLE r343501 GENERIC_4BSD  amd64.
Using make "CC=/usr/bin/cc CXX=/usr/bin/c++" fixes the issue.
Comment 19 John Hein 2019-05-24 14:11:42 UTC
Created attachment 204593 [details]
[patch] fix for mixed clang/gcc mismatch triggering link failure

Attached is a patch to tell configure which CC/CXX to use (rather than let it try to detect the compiler to use and have it pick something that results in a mix of clang & gcc built products that trigger the link failure).

Flagging maintainer-approval request, although it's been a long time since I've seen much ports interaction from the maintainer (none for this PR since it was opened).
Comment 20 John Hein 2019-05-24 14:28:32 UTC
p.s. It was probably not necessary to bump PORTREVISION on this port after the recent poppler update since tex-luatex was modified to use the internal bundled poppler code.
Comment 21 O. Hartmann 2019-08-03 18:05:10 UTC
*** Bug 239608 has been marked as a duplicate of this bug. ***
Comment 22 O. Hartmann 2019-08-03 18:11:03 UTC
*** Bug 236882 has been marked as a duplicate of this bug. ***
Comment 23 John Hein 2019-08-28 02:24:03 UTC
Maintainer timeout?

If a committer takes this simple patch to ensure consistent suite of compiler tools at each build stage, please also apply to print/tex-xetex.

Enough people have hit this problem, I think.  I hit this again on a machine after building due to the recent PORTREVISION bump.

QA:
 Both ports have been tested with poudriere with this change.
 No new portlint warnings.
Comment 24 Tobias C. Berner freebsd_committer 2019-08-28 04:59:18 UTC
Maintainer Timout
Comment 25 Hiroki Sato freebsd_committer 2019-08-28 07:41:58 UTC
(In reply to Tobias C. Berner from comment #24)

I am sorry for the delay getting back to this PR.  This issue was due to the mismatch between libc++ and libstdc++, not mismatch of clang and gcc themselves.  Putting CC and CXX into CONFIGURE_ARGS hides it but does not solve the root cause.