Bug 284487 - graphics/rawtherapee: GCC14 build on FreeBSD 13.4-RELEASE causes "undefined reference to `__cxa_call_terminate'"
Summary: graphics/rawtherapee: GCC14 build on FreeBSD 13.4-RELEASE causes "undefined r...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Andree
URL: https://pkg-status.freebsd.org/gohan0...
Keywords:
Depends on: 284499
Blocks: 281091
  Show dependency treegraph
 
Reported: 2025-01-31 14:44 UTC by Lorenzo Salvadore
Modified: 2025-02-01 09:29 UTC (History)
2 users (show)

See Also:
mandree: maintainer-feedback+


Attachments
compressed 134amd64 exp-run log for rawtherapee (44.07 KB, application/x-gzip-compressed)
2025-02-01 09:29 UTC, Matthias Andree
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Salvadore freebsd_committer freebsd_triage 2025-01-31 14:44:41 UTC
The port fails to build with GCC 14, which is about to become GCC_DEFAULT version. This link can help: https://gcc.gnu.org/gcc-14/porting_to.html

lpangocairo-1.0  -lpango-1.0  -lharfbuzz  -latk-1.0  -lcairo-gobject  -lcairo  -lgdk_pixbuf-2.0  -lgio-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lexpat  -lfftw3f  /usr/local/lib/libfftw3f_omp.so  -lgiomm-2.4  -lgio-2.0  -lglibmm-2.4  -lgobject-2.0  -lglib-2.0  -lintl  -lsigc-2.0  -lgio-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lglib-2.0  -lintl  -lglibmm-2.4  -lgobject-2.0  -lglib-2.0  -lintl  -lsigc-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lgthread-2.0  -lglib-2.0  -lintl  -lgtkmm-3.0  -latkmm-1.6  -lgdkmm-3.0  -lgiomm-2.4  -lgtk-3  -lgdk-3  -lz  -latk-1.0  -lcairo-gobject  -lgio-2.0  -lpangomm-1.4  -lglibmm-2.4  -lcairomm-1.0  -lsigc-2.0  -lpangocairo-1.0  -lpango-1.0  -lharfbuzz  -lcairo  -lgdk_pixbuf-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lgtk-3  -lgdk-3  -lz  -lpangocairo-1.0  -lpango-1.0  -lharfbuzz  -latk-1.0  -lcairo-gobject  -lcairo  -lgdk_pixbuf-2.0  -lgio-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -liptcdata  /usr/local/lib/libjpeg.so  -llcms2  -llcms2_fast_float  -llcms2_threaded  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libtiff.so.6.1.0  /usr/lib/libz.so  -llensfun  -lrsvg-2  -lm  -lgio-2.0  -lgdk_pixbuf-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lcairo  /usr/local/lib/libexiv2.so  -ljxl  -ljxl_threads  rtengine/libraw/lib/.libs/libraw_r.a  /usr/local/lib/gcc14/libgomp.so  -lgiomm-2.4  -lgtkmm-3.0  -latkmm-1.6  -lgdkmm-3.0  -lpangomm-1.4  -lcairomm-1.0  -lexpat  -lfftw3f  /usr/local/lib/libfftw3f_omp.so  -lgdk_pixbuf-2.0  -lgio-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lglibmm-2.4  -lsigc-2.0  -lgthread-2.0  -liptcdata  /usr/local/lib/libjpeg.so  -llcms2  -llcms2_fast_float  -llcms2_threaded  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libtiff.so.6.1.0  -llensfun  -lrsvg-2  -lm  -lgdk_pixbuf-2.0  -lgio-2.0  -lgobject-2.0  -lglib-2.0  -lintl  -lglibmm-2.4  -lsigc-2.0  -lgthread-2.0  -liptcdata  /usr/local/lib/libjpeg.so  -llcms2  -llcms2_fast_float  -llcms2_threaded  /usr/local/lib/libpng.so  /usr/lib/libz.so  /usr/local/lib/libtiff.so.6.1.0  -llensfun  -lrsvg-2  -lm  -lcairo && :
/usr/local/bin/ld: /tmp/ccgto6pJ.ltrans65.ltrans.o: in function `Spot::~Spot() [clone .cold]':
<artificial>:(.text.unlikely+0x89d): undefined reference to `__cxa_call_terminate'
/usr/local/bin/ld: /tmp/ccgto6pJ.ltrans76.ltrans.o: in function `(anonymous namespace)::dfInfo::updateBadPixelList(rtengine::RawImage const*) [clone ._omp_fn.0] [clone .cold]':
<artificial>:(.text.unlikely+0x93): undefined reference to `__cxa_call_terminate'
/usr/local/bin/ld: /tmp/ccgto6pJ.ltrans77.ltrans.o: in function `rtengine::ImProcFunctions::RGB_denoise(int, rtengine::Imagefloat*, rtengine::Imagefloat*, rtengine::Imagefloat*, float*, float*, float*, bool, rtengine::procparams::DirPyrDenoiseParams const&, double, rtengine::NoiseCurve const&, rtengine::NoiseCurve const&, float&, float&) [clone ._omp_fn.2] [clone .cold]':
<artificial>:(.text.unlikely+0x1d9): undefined reference to `__cxa_call_terminate'
/usr/local/bin/ld: /tmp/ccgto6pJ.ltrans81.ltrans.o: in function `rtengine::init(rtengine::Settings const*, Glib::ustring const&, Glib::ustring const&, bool) [clone ._omp_fn.0] [clone .lto_priv.0] [clone .cold]':
<artificial>:(.text.unlikely+0x4be): undefined reference to `__cxa_call_terminate'
/usr/local/bin/ld: /tmp/ccgto6pJ.ltrans84.ltrans.o: in function `rtengine::ImProcFunctions::ciecamloc_02float(rtengine::local_params&, int, rtengine::LabImage*, int, int, int, int, LUT<float> const&, bool, LUT<float> const&, bool, LUT<float> const&, bool, LUT<float> const&, bool, LUT<float> const&, bool, rtengine::LocCHCurve const&, rtengine::LocHHCurve const&, rtengine::LocLHCurve const&, bool, bool, bool, rtengine::LocwavCurve const&, bool, float&, float&, float&) [clone ._omp_fn.11] [clone .lto_priv.0] [clone .cold]':
<artificial>:(.text.unlikely+0x5f): undefined reference to `__cxa_call_terminate'
/usr/local/bin/ld: /tmp/ccgto6pJ.ltrans84.ltrans.o:<artificial>:(.text.unlikely+0xc7): more undefined references to `__cxa_call_terminate' follow
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/rawtherapee



NB: I have been told that pinning GCC version with USE_GCC=13 would not be ideal for this port.
Comment 1 Matthias Andree freebsd_committer freebsd_triage 2025-01-31 20:07:26 UTC
At first glance this looks like an incompatibility with (y)our base system's C++ stack with GCC14. The porting_to link doesn't help.  Googling suggests that there have been GCC14 related changes that may now cause __cxa_call_terminate to be called in places where GCC13 might not have triggered that, and this would require recompiling the world and its brother for libstdc++.  It seems there's a  __clang_call_terminate, but more importantly,

THIS IS A SHOWSTOPPER FOR MAKING GCC14 THE DEFAULT FOR ALL C++ STUFF IN PORTS!

Either patch GCC14 so it generates code that is compatible with our base system C++ stuff on all supported releases.
Comment 2 Matthias Andree freebsd_committer freebsd_triage 2025-01-31 21:38:23 UTC
To make this a bit more constructive, this was discussed in the GCC context for libstdc++ here:

https://gcc.gnu.org/pipermail/libstdc++/2023-May/056011.html

What this boils down to is that GCC14 some way references libstdc++ ABI stuff when building other components, and rawtherapee than barfs when the latter cannot find the libstdc++ specific function in the Base libc++.

And we cannot easily use libstdc++ in rawtherapee (instead of libc++) because that means that all C++ libraries also must have been compiled with libstdc++. We've been there before, and rawtherapee has frequently shown clang++ to be troublesome.

For the time being, I'll pin GCC.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-01-31 21:42:50 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7c091b1abc84f4246e557aaf7d04d111e4db9b8f

commit 7c091b1abc84f4246e557aaf7d04d111e4db9b8f
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2025-01-31 21:37:37 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2025-01-31 21:42:11 +0000

    graphics/rawtherapee: pin GCC version to 13.

    Apparently GCC 14 has new libstdc++ bits spill over somewhere,
    and this would break rawtherapee's build at link time,
    salvadore@ wrote

    /usr/local/bin/ld: /tmp/ccgto6pJ.ltrans65.ltrans.o: in function `Spot::~Spot() [clone .cold]':
    <artificial>:(.text.unlikely+0x89d): undefined reference to `__cxa_call_terminate'
    /usr/local/bin/ld: /tmp/ccgto6pJ.ltrans76.ltrans.o: in function `(anonymous namespace)::dfInfo::updateBadPixelList(rtengine::RawImage const*) [clone ._omp_fn.0] [clone .cold]':
    <artificial>:(.text.unlikely+0x93): undefined reference to `__cxa_call_terminate'
    /usr/local/bin/ld: /tmp/ccgto6pJ.ltrans77.ltrans.o: in function `rtengine::ImProcFunctions::RGB_denoise(int, rtengine::Imagefloat*, rtengine::Imagefloat*, rtengine::Imagefloat*, float*, float*, float*, bool, rtengine::procparams::DirPyrDenoiseParams const&, double, rtengine::NoiseCurve const&, rtengine::NoiseCurve const&, float&, float&) [clone ._omp_fn.2] [clone .cold]':
    <artificial>:(.text.unlikely+0x1d9): undefined reference to `__cxa_call_terminate'
    /usr/local/bin/ld: /tmp/ccgto6pJ.ltrans81.ltrans.o: in function `rtengine::init(rtengine::Settings const*, Glib::ustring const&, Glib::ustring const&, bool) [clone ._omp_fn.0] [clone .lto_priv.0] [clone .cold]':
    <artificial>:(.text.unlikely+0x4be): undefined reference to `__cxa_call_terminate'
    /usr/local/bin/ld: /tmp/ccgto6pJ.ltrans84.ltrans.o: in function `rtengine::ImProcFunctions::ciecamloc_02float(rtengine::local_params&, int, rtengine::LabImage*, int, int, int, int, LUT<float> const&, bool, LUT<float> const&, bool, LUT<float> const&, bool, LUT<float> const&, bool, LUT<float> const&, bool, rtengine::LocCHCurve const&, rtengine::LocHHCurve const&, rtengine::LocLHCurve const&, bool, bool, bool, rtengine::LocwavCurve const&, bool, float&, float&, float&) [clone ._omp_fn.11] [clone .lto_priv.0] [clone .cold]':
    <artificial>:(.text.unlikely+0x5f): undefined reference to `__cxa_call_terminate'

    And this seems to be https://gcc.gnu.org/pipermail/libstdc++/2023-May/056011.html
    related to C++ standards compliance - however __cxa_call_terminate
    specifically is a libstdc++ export function, unavailable in libc++.

    Rawtherapee needs to link against libc++ because otherwise all
    C++ libraries it imports would also have to be compiled against
    libstdc++.

    Reported by:    Lorenzo salvadore@
    PR:             284487

 graphics/rawtherapee/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Comment 4 Matthias Andree freebsd_committer freebsd_triage 2025-01-31 21:44:05 UTC
So, can we somehow identify how "GCC 14" makes libstd++'s __cxa_call_terminate spill over?  Is this through some library we link against that should have used the base system's libc++?
Comment 5 Matthias Andree freebsd_committer freebsd_triage 2025-01-31 21:52:14 UTC
I have had this in my graphics/rawtherapee/Makefile for a long time, I would like another pair of eyeballs and comments on this:

.include <bsd.port.pre.mk>

.if ${COMPILER_FEATURES:Mlibc++}
CXXFLAGS+=      -stdlib=libc++
.endif


The idea is checking "if base system uses libc++, so should rawtherapee".

Does that work as intended? Did I overlook something?
Comment 6 Matthias Andree freebsd_committer freebsd_triage 2025-01-31 23:52:25 UTC
Let me retitle and reopen this. See 281091 comments for why.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-01-31 23:54:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3aaa6f4874aec6faa1f51dce405cfaf430bbc9c1

commit 3aaa6f4874aec6faa1f51dce405cfaf430bbc9c1
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2025-01-31 23:49:21 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2025-01-31 23:52:59 +0000

    graphics/rawtherapee: Revert "pin GCC version to 13."

    This reverts commit 7c091b1abc84f4246e557aaf7d04d111e4db9b8f.

    Reason I am reverting this is that I can set USE_GCC=14 and
    happily compile, without or with LTO and/or native.

    My conclusion is that rawtherapee is doing its things right,
    but one of its libraries gets compiled for libstdc++, and pollutes
    rawtherapee's program space but we don't give rawtherapee libstdc++
    but libc++ on systems where the default compiler uses the latter.

    PR:             284487

 graphics/rawtherapee/Makefile | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
Comment 8 Matthias Andree freebsd_committer freebsd_triage 2025-02-01 09:29:33 UTC
Created attachment 257159 [details]
compressed 134amd64 exp-run log for rawtherapee