Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 926953 - sys-devel/gcc libgccjit unable to compile Emacs packages with lto
Summary: sys-devel/gcc libgccjit unable to compile Emacs packages with lto
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-13 21:46 UTC by look
Modified: 2024-04-22 03:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
The build log. (build.log,931.96 KB, text/plain)
2024-03-13 21:49 UTC, look
Details
The emerge --info output (emerge --info.txt,18.10 KB, text/plain)
2024-03-13 21:50 UTC, look
Details
patch to reproduce issue easily (emacs-native-comp-lto.patch,581 bytes, text/plain)
2024-03-13 21:53 UTC, look
Details

Note You need to log in before you can comment on or make changes to this bug.
Description look 2024-03-13 21:46:11 UTC
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-editors/emacs-30.0.9999/temp/ccTDISvI.o: plugin needed to handle lto object
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/app-editors/emacs-30.0.9999/temp/ccTDISvI.o: plugin needed to handle lto object
lto1: internal compiler error: original not compressed with zstd
0x11b4301 internal_error(char const*, ...)
    ???:0
0x128df16 cgraph_node::get_untransformed_body()
    ???:0
0x128d483 cgraph_node::expand()
    ???:0
0x19c08af symbol_table::compile()
    ???:0
0x19b51b0 lto_main()
    ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
make[4]: *** [/var/tmp/portage/app-editors/emacs-30.0.9999/temp/ccUOIbLs.mk:2: /var/tmp/portage/app-editors/emacs-30.0.9999/temp/ccsaJZm8.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
collect2: fatal error: lto-wrapper returned 1 exit status
compilation terminated.
libgccjit.so: error: error invoking gcc driver
Comment 1 look 2024-03-13 21:49:06 UTC
Created attachment 887555 [details]
The build log.
Comment 2 look 2024-03-13 21:50:27 UTC
Created attachment 887556 [details]
The emerge --info output
Comment 3 look 2024-03-13 21:53:34 UTC
Created attachment 887557 [details]
patch to reproduce issue easily

This patch makes it easier to reproduce this issue since then emacs will fail emerging without -flto.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-13 22:00:27 UTC
It's always worth giving full context, e.g. the discussions you and I had on the libgccjit ML.

Anyway, if GCC is ICEing, then it's something to report to the GCC bugzilla (if you have a standalone test case), or bring it up on the libgccjit ML and ask for advice.
Comment 5 look 2024-03-13 22:19:17 UTC
True. This is the original thread I started on the libgccjit mailing list:
https://gcc.gnu.org/pipermail/jit/2024q1/001853.html
Basically, this started as an issue with libgccjit not being compiled with LTO support but that was fixed.

I also started a thread in emacs-devel but no one there is able to reproduce it and they suggest reporting it to Gentoo:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69689
Comment 6 Mike Gilbert gentoo-dev 2024-03-15 14:37:07 UTC
What package provides libgccjit.so?
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-16 05:53:01 UTC
You need to report it to the libgccjit people. It's not an Emacs bug for it to ICE (although it's possible that the libgccjit integration in Emacs needs to do something to enable compression).
Comment 8 Larry the Git Cow gentoo-dev 2024-04-22 03:14:21 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28fca56a1639578fc58de1e8310b7c94a5e12e09

commit 28fca56a1639578fc58de1e8310b7c94a5e12e09
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-04-22 03:13:04 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-04-22 03:13:52 +0000

    toolchain.eclass: propagate USE=zstd to libgccjit build
    
    You *can* do LTO with libgccjit, apparently, and it even works if we don't
    break the compression used for LTO with it. Pass down the zstd arg from
    USE=zstd like we do for the regular build.
    
    Thanks to StrawberryTea for reporting.
    
    Closes: https://bugs.gentoo.org/926953
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/toolchain.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)