Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Apr 2022 05:32:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 263271] lang/gcc11: After switching to LTO bootstrap, build of editors/emacs-devel fails with segmentation fault if NATIVECOMP option enabled
Message-ID:  <bug-263271-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263271

            Bug ID: 263271
           Summary: lang/gcc11: After switching to LTO bootstrap, build of
                    editors/emacs-devel fails with segmentation fault if
                    NATIVECOMP option enabled
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: yasu@freebsd.org
                CC: emacs@FreeBSD.org, pkubaj@FreeBSD.org,
                    toolchain@FreeBSD.org

1. Since 28.x Emacs supports native compilation.
1.1. While byte compilation converts source code of emacs lisp to byte code
independent from HW and/or OS, native compilation converts it to native cod=
e of
the platform on which Emacs runs.
1.2. Emacs uses libgccgit of GCC to do native compilation.
1.3. Emacs provides two ways for native compilation. One is just-in-time way
that is done first time when source file (.el) is loaded. The other is expl=
ict
way that is done by invoking emacs lisp function that do native compilation.

2. Native compilation is enabled when Emacs is built
2.1. It is enabled by passing '--with-native-compilation' option to configu=
re
script.
2.2. At the moment, it is off by default.
2.3. The way is also provided to native compile and install all emacs lisp
files included in source tree.

3. NATIVECOMP option was added to editors/emacs-devel in June 2021.
3.1. It is off by default.
3.2. If it is enabled, all .el files included in source archive are native
compiled and installed.
3.3. Currently lang/gcc11 is used to support native compilation as there is=
 a
note as following in the document of GCC 10 and before:
"Note that libgccjit is currently of =E2=80=9CAlpha=E2=80=9D quality; the A=
PIs are not yet set
in stone, and they shouldn=E2=80=99t be used in production yet."

4. With the latest ports tree build of editors/emacs-devel fails if NATIVEC=
OMP
option is enabled.
4.1. It fails with segmantation fault of emacs while native compiling
'emoji.el' as following.
https://people.freebsd.org/~yasu/poudriere/data/logs/bulk/130amd64-default-=
emacs/2022-04-12_17h00m39s/logs/emacs-devel-nox-29.0.50.20220331_1,2.log
4.2 I faced the failure when I updated ports tree from ports 9aa49f27ffd0
(committed on April 7) to ports 7f2e164a4b3b (committed on April 12).
4.3. According to the result of `git bisect`, the build failure happens with
following commit and after.

----------------------------------------------------------------------
commit 2f6be9fb8281
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: Mon Apr 11 10:46:01 2022 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: Mon Apr 11 10:46:01 2022 +0000

    lang/gcc11: switch gcc11 to LTO bootstrap

    lang/gcc11-devel with LTO builds fine on the cluster, switch lang/gcc11=
 as
well.
----------------------------------------------------------------------

5. The cause of the build failure seems to be bug of lang/gcc11 about LTO
5.1 If I revert the commit above then build completes successfully.
5.2. I modified Makefile of editors/emacs-devel so it uses lang/gcc12-devel.
Then build completes successfully.
5.3. I also modified the Makefile so it uses lang/gcc11-devel. In this case
build fails with same error. Next, I updated lang/gcc11-devel to the 202204=
09
snapshot of GCC 11.2.1. Then build completes successfully.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-263271-7788>