Opened 7 weeks ago
Last modified 3 weeks ago
#73696 assigned defect
poppler @26.02.0_0: Undefined symbols __ZN5GpgME4Data8toStringB5cxx11Ev __ZNK5GpgME5Error11asStdStringB5cxx11Ev
| Reported by: | jrandall814 | Owned by: | dbevans (David B. Evans) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.12.4 |
| Keywords: | lion mountainlion mavericks yosemite elcapitan sierra highsierra mojave | Cc: | mascguy (Christopher Nielsen), aeiouaeiouaeiouaeiouaeiouaeiou, rmottola (Riccardo), potmj (Michael Pot), ballapete (Peter "Pete" Dyballa) |
| Port: | poppler |
Description
I was recently able to overcome a build failure of poppler 26.01.0_0 on my legacy OS 10.13.6 by resorting to the patches described in ticket #73454. Within the portfile of this latest poppler 26.02.0_0 I find reference to the problem addressed in ticket #73454, but the build now fails again (for a stated reason other than the lack of a 'ranges' object).
Attachments (2)
Change History (14)
Changed 7 weeks ago by jrandall814
| Attachment: | poppler_build_error.log added |
|---|
comment:1 Changed 7 weeks ago by jmroot (Joshua Root)
| Cc: | mascguy added |
|---|---|
| Keywords: | highsierra added; 10.13.6 removed |
| Owner: | set to dbevans |
| Port: | 26.02.0_0 removed |
| Status: | new → assigned |
comment:2 Changed 7 weeks ago by ryandesign (Ryan Carsten Schmidt)
The log says:
Undefined symbols for architecture x86_64:
"__ZN5GpgME4Data8toStringB5cxx11Ev", referenced from:
getCertificateInfoFromKey(GpgME::Key const&, GpgME::Protocol) in GPGMECryptoSignBackend.cc.o
GpgSignatureCreation::signDetached(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in GPGMECryptoSignBackend.cc.o
"__ZNK5GpgME5Error11asStdStringB5cxx11Ev", referenced from:
GpgSignatureCreation::signDetached(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in GPGMECryptoSignBackend.cc.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Those symbols demangle as follows:
% c++filt __ZN5GpgME4Data8toStringB5cxx11Ev __ZNK5GpgME5Error11asStdStringB5cxx11Ev GpgME::Data::toString[abi:cxx11]() GpgME::Error::asStdString[abi:cxx11]() const
comment:3 follow-ups: 5 8 Changed 7 weeks ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | aeiouaeiouaeiouaeiouaeiouaeiou added |
|---|---|
| Keywords: | lion mountainlion mavericks yosemite elcapitan sierra mojave added |
| Summary: | poppler 26.02.0_0 build fails on 10.13.6 → poppler @26.02.0_0 build fails on 10.13.6 |
#73454 was resolved by making poppler build with g++ and libstdc++ on macOS < 10.15. That can't work since everything else in MacPorts is built using clang++ and libc++—C++ standard libraries have to match.
Here, g++ can't find symbols containing abi:cxx11 in libgpgmepp.dylib. abi:cxx11 is a tag used by g++ for C++11 things. clang++ evidently doesn't use such a tag, so of course our libgpgmepp.dylib that was built with clang++ won't have symbols with those tags.
poppler must be changed to build with clang++ again.
comment:4 Changed 7 weeks ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | rmottola added |
|---|---|
| Summary: | poppler @26.02.0_0 build fails on 10.13.6 → poppler @26.02.0_0: Undefined symbols __ZN5GpgME4Data8toStringB5cxx11Ev __ZNK5GpgME5Error11asStdStringB5cxx11Ev |
Has duplicate #73707.
comment:5 Changed 7 weeks ago by jrandall814
Replying to ryandesign:
#73454 was resolved by making poppler build with g++ and libstdc++ on macOS < 10.15. That can't work since everything else in MacPorts is built using clang++ and libc++—C++ standard libraries have to match.
Here, g++ can't find symbols containing
abi:cxx11in libgpgmepp.dylib.abi:cxx11is a tag used by g++ for C++11 things. clang++ evidently doesn't use such a tag, so of course our libgpgmepp.dylib that was built with clang++ won't have symbols with those tags.poppler must be changed to build with clang++ again.
I thought that the patches that I discovered within #73404 that enabled me to build poppler 26.01.0 on High Sierra (see the screenshot now the second attachment to my original ticket) made it compile with clang-17.
Changed 7 weeks ago by jrandall814
| Attachment: | poppler_patch.png added |
|---|
patches that enabled me to build poppler 26.01.0 on 10.13.6
comment:6 Changed 7 weeks ago by aeiouaeiouaeiouaeiouaeiouaeiou
https://github.com/macports/macports-ports/pull/31687
Support for C++20/C++23 on older systems is quite a challenging issue.
comment:7 Changed 7 weeks ago by rmottola (Riccardo)
indeed.... trying out myself. I understand here the usage of g++ has been a problem together with libstdc++ I could have not seen this on some systems if gpgmepp was built with gcc too (e.g. on PPC or sometimes I did that on 10.5/10.6 while doing partial manual upgrades).
on 10.13, I tried removing applied forcing of g++ and libdstc++ retaining:
legacysupport.newest_darwin_requires_legacy 18
being I on Darwin 17, it should be used.
In file included from /opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/CharCodeToUnicode.cc:46:
/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/GlobalParams.h:173:52: error: 'path' is unavailable: introduced in macOS 10.15
173 | void parseNameToUnicode(const std::filesystem::path &name);
| ^
/opt/local/libexec/llvm-17/bin/../include/c++/v1/__filesystem/path.h:446:33: note: 'path' has been explicitly marked unavailable here
446 | class _LIBCPP_EXPORTED_FROM_ABI path {
| ^
1 error generated.
make[2]: *** [CMakeFiles/poppler.dir/poppler/CharCodeToUnicode.cc.o] Error 1
perhaps somehow a target is trying 10.15 anyway? did someone see this specific issue?
comment:8 Changed 7 weeks ago by rmottola (Riccardo)
Replying to ryandesign:
Here, g++ can't find symbols containing
abi:cxx11in libgpgmepp.dylib.abi:cxx11is a tag used by g++ for C++11 things. clang++ evidently doesn't use such a tag, so of course our libgpgmepp.dylib that was built with clang++ won't have symbols with those tags.poppler must be changed to build with clang++ again.
I tried rebuilding gpgme & gpgmepp with g++, but fail to. Not ideal, but would test if in that case it would work.
comment:9 Changed 7 weeks ago by ryandesign (Ryan Carsten Schmidt)
You can't mix and match C++ standard libraries. You probably shouldn't try to mix C++ compilers either.
Other C++ ports in MacPorts are compiled using clang++ and linked with libc++, so gpgmepp and poppler need to be linked with libc++ as well, and ideally compiled with clang++ as well.
comment:10 Changed 3 weeks ago by potmj (Michael Pot)
| Cc: | potmj added |
|---|
comment:11 Changed 3 weeks ago by potmj (Michael Pot)
The I find the old gcc stdlibc++ & new clang libc++ a bit of a hard thing to get my head around. It seems math programs use the gcc path, and GUI programs use clang. I have today built poppler for El Capitan 10.11.6 by reverting to clang-17, and reverting the poppler C++23 code to work on an older compiler. The gcc-15 path may still be the best for even older systems, depending on how glib2 and the like are built. I documented my progress as a bash script, and include it here as a workaround that has worked for me.
#!/bin/bash
sudo port clean poppler
sudo port configure poppler $1 $2 $3 configure.compiler=macports-clang-17 configure.cxx_stdlib=libc++
### General fixes
# Find all files mentioning <ranges> and delete that specific line
files=$(grep -rl "#include <ranges>" /opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/)
cnt=0
for f in $files; do
echo "Removing ranges header from $f..."
sudo sed -i '' '/#include <ranges>/d' "$f"
cnt=$((cnt+1))
done
echo $cnt files
# 1. Get the list of files
files=$(grep -rl "std::ranges::" /opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/)
cnt=0
# 2. Run the bulk surgery
for f in $files; do
echo "Patching $f..."
# Fix std::ranges::sort(C, F) -> std::sort(C.begin(), C.end(), F)
sudo sed -i '' 's/std::ranges::sort(\([^,]*\), \(.*\))/std::sort(\1.begin(), \1.end(), \2)/g' "$f"
# Fix std::ranges::find(C, I) -> std::find(C.begin(), C.end(), I)
sudo sed -i '' 's/std::ranges::find(\([^,]*\), \(.*\))/std::find(\1.begin(), \1.end(), \2)/g' "$f"
# Fix std::ranges::any_of(C, F) -> std::any_of(C.begin(), C.end(), F)
sudo sed -i '' 's/std::ranges::any_of(\([^,]*\), \(.*\))/std::any_of(\1.begin(), \1.end(), \2)/g' "$f"
# Fix lower_bound
sudo sed -i '' 's/std::ranges::lower_bound(\([^,]*\), \(.*\))/std::lower_bound(\1.begin(), \1.end(), \2)/g' "$f"
# Fix Modern: std::ranges::replace(C, OLD, NEW) to Classic: std::replace(C.begin(), C.end(), OLD, NEW)
sudo sed -i '' 's/std::ranges::replace(\([^,]*\), /std::replace(\1.begin(), \1.end(), /g' "$f"
# Fix reverse: std::ranges::reverse(C) -> std::reverse(C.begin(), C.end())
sudo sed -i '' 's/std::ranges::reverse(\([^)]*\))/std::reverse(\1.begin(), \1.end())/g' "$f"
# Fix transform: std::ranges::transform(IN, OUT_BEGIN, LAMBDA) -> std::transform(IN.begin(), IN.end(), OUT_BEGIN, LAMBDA)
sudo sed -i '' 's/std::ranges::transform(\([^,]*\), \([^,]*\), /std::transform(\1.begin(), \1.end(), \2, /g' "$f"
# Fix std::ranges::all_of(C, P) -> std::all_of(C.begin(), C.end(), P)
sudo sed -i '' 's/std::ranges::all_of(\([^,]*\), \(.*\))/std::all_of(\1.begin(), \1.end(), \2)/g' "$f"
# Clobbers Dict.cc, to fix DistinguishedNameParser.h, see below: sudo sed -i '' 's/std::ranges::find_if(\([^,]*\),/std::find_if(\1.begin(), \1.end(),/g' "$f"
# Fix std::ranges::copy(l, ...) -> std::copy(l.begin(), l.end(), ...)
sudo sed -i '' 's/std::ranges::copy(\([^,]*\), /std::copy(\1.begin(), \1.end(), /g' $f
cnt=$((cnt+1))
done
echo $cnt files
### File specific fixes
# Need to explicitly #include <unordered_map>
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/XRef.h
sudo sed -i '' '1i\
#include <unordered_map>
' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/Dict.cc
# Replace the 5-arg version with a classic 4-arg version using a lambda
sudo sed -i '' 's/std::lower_bound(entries.begin(), entries.end(), key, std::less<> {}, \&DictEntry::first)/std::lower_bound(entries.begin(), entries.end(), key, [](const DictEntry\& a, const std::string\& b){ return a.first < b; })/' $f
# Replace the ranges::find_if(reverse_view...) with classic std::find_if(rbegin, rend)
sudo sed -i '' 's/std::ranges::find_if(std::ranges::reverse_view(entries), \[key\](const DictEntry \&entry) { return entry.first == key; })/std::find_if(entries.rbegin(), entries.rend(), [\&key](const DictEntry \&entry) { return entry.first == key; })/' $f
# We change 'const std::string& b' to 'const auto& b'
sudo sed -i '' 's/const std::string\& b/const auto\& b/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/CIDFontsWidthsBuilder.h
# Replace std::ranges::find_if(std::ranges::reverse_view(NAME), LAMBDA)
# with std::find_if(NAME.rbegin(), NAME.rend(), LAMBDA)
sudo sed -i '' 's/std::ranges::find_if(std::ranges::reverse_view(\([^)]*\)),/std::find_if(\1.rbegin(), \1.rend(),/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/Gfx.cc
# Fix bboxIntersections[4]
sudo sed -i '' 's/std::ranges::sort(bboxIntersections)/std::sort(bboxIntersections, bboxIntersections + 4)/g' $f
# Fix s[4] (appears twice)
sudo sed -i '' 's/std::ranges::sort(s)/std::sort(s, s + 4)/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/GfxFont.cc
# Replace the fake member calls with raw pointers
sudo sed -i '' 's/base14SubstFonts.begin()/base14SubstFonts/g' $f
sudo sed -i '' 's/base14SubstFonts.end()/base14SubstFonts + 14/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/GlobalParams.cc
# Fix displayFontTab (Size 13)
sudo sed -i '' 's/displayFontTab.begin()/displayFontTab/g' $f
sudo sed -i '' 's/displayFontTab.end()/displayFontTab + 13/g' $f
# Fix winFontTab (Size 11)
sudo sed -i '' 's/winFontTab.begin()/winFontTab/g' $f
sudo sed -i '' 's/winFontTab.end()/winFontTab + 11/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/Lexer.cc
# Fix line 606: (cmd1, p) -> (cmd1, p - cmd1)
sudo sed -i '' 's/std::string_view(cmd1, p)/std::string_view(cmd1, p - cmd1)/g' $f
# Fix line 633: (tokBuf, p) -> (tokBuf, p - tokBuf)
sudo sed -i '' 's/std::string_view(tokBuf, p)/std::string_view(tokBuf, p - tokBuf)/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/splash/SplashFontEngine.cc
# 1. Fix fill: (fontCache, nullptr) -> (fontCache, fontCache + 16, nullptr)
sudo sed -i '' 's/std::ranges::fill(fontCache,/std::fill(fontCache.begin(), fontCache.end(),/g' "$f"
# 2. Fix find_if: (fontCache, ...) -> (fontCache, fontCache + 16, ...)
sudo sed -i '' 's/std::ranges::find_if(fontCache,/std::find_if(fontCache.begin(), fontCache.end(),/g' "$f"
# 3. Fix rotate: (fontCache, end - 1) -> (fontCache, fontCache + 15, fontCache + 16)
# Note: std::rotate takes (first, middle, last). We want the last element to become the first.
sudo sed -i '' 's/std::ranges::rotate(fontCache, fontCache.end() - 1)/std::rotate(fontCache.begin(), fontCache.end() - 1, fontCache.end())/g' "$f"
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/NSSCryptoSignBackend.cc
# Fix line 320: Compare 'oid' against the buffer
sudo sed -i '' 's/std::ranges::equal(oid, std::span { attr->type.data, attr->type.len })/std::equal(oid.begin(), oid.end(), attr->type.data)/g' $f
# Fix line 1264: Compare 'cert_hash' against the certHash buffer
sudo sed -i '' 's/std::ranges::equal(cert_hash, std::span { decoded_attr.certs\[0\]->certHash.data, decoded_attr.certs\[0\]->certHash.len })/std::equal(cert_hash.begin(), cert_hash.end(), decoded_attr.certs[0]->certHash.data)/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/poppler/DistinguishedNameParser.h
# Fix std::ranges::find_if(dn, LAMBDA) -> std::find_if(dn.begin(), dn.end(), LAMBDA)
sudo sed -i '' 's/std::ranges::find_if(dn,/std::find_if(dn.begin(), dn.end(),/g' $f
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/utils/printencodings.cc
sudo sed -i '' 's/std::ranges::sort(\([^)]*\))/std::sort(\1.begin(), \1.end())/g' "$f"
f=/opt/local/var/macports/build/poppler-06287f0b/work/poppler-26.02.0/utils/HtmlFonts.cc
# Replace .contains("X") with .find("X") != std::string::npos
sudo sed -i '' 's/\.contains(\([^)]*\))/.find(\1) != std::string::npos/g' $f
######## & build ########
sudo port install $1 $2 $3 poppler configure.compiler=macports-clang-17 configure.cxx_stdlib=libc++
The for loop might be quite re-usable for taming the newer C++. It's way to late for me to add much more at this stage. Good luck :-)
comment:12 Changed 3 weeks ago by ballapete (Peter "Pete" Dyballa)
| Cc: | ballapete added |
|---|

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_poppler/poppler/main.log