GNU bug report logs - #48789
28.0.50; Emacs does not build with musl

Previous Next

Package: emacs;

Reported by: akater <nuclearspace <at> gmail.com>

Date: Wed, 2 Jun 2021 11:38:02 UTC

Severity: normal

Tags: moreinfo, patch

Merged with 50058

Found in versions 28.0.5, 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48789 in the body.
You can then email your comments to 48789 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48789; Package emacs. (Wed, 02 Jun 2021 11:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to akater <nuclearspace <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 02 Jun 2021 11:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: akater <nuclearspace <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Emacs does not build with musl
Date: Wed, 02 Jun 2021 11:26:18 +0000
(sectioned with Org markup if you want it)

* General information
The following is not a solution, just FYI:

Observing compiler (GCC 10.2.0) warnings and errors, on 2021-05-11 I
managed to build Emacs 28 with musl after reverting commits dealing with
two features,

an older one:

621bb79b7044dcc277386eb7338c0eb1e08c29c7 "New debugging command 'malloc-info'"

and a newer one --- everything related to lib-src/seccomp-filter.c

I provide the list of related commits but I likely made mistakes while
reverting so I don't attach the patch itself; the list is for
completenes.

I did not try to build Emacs 28 since, so commits newer than 2021-05-11
are not taken into account.  I will try if necessary.

Even though I did manage to build Emacs 28 with musl, my build is
extremely unreliable, regular crashes occur.  This might be due to my
lousy reverting, or due to an interference from native-comp feature, or
the neccesity to recompile third-party Elisp packages, or all at once.
Unfortunately, it so happened that I started using a musl system exactly
when native-comp is out.

Unable to use Emacs 28 here, I use Emacs 27.2 now which builds and works
totally fine with musl.

Below are: relevant commits and system configuration, for both 27.2 and 28.0.

* Commits for seccomp-filter
Here's the list of commits related to seccomp-filter that I (likely
incompetently) reverted, which allowed for Emacs 28 musl build:

Revert "Add a helper binary to create a basic Secure Computing filter."
This reverts commit 1060289f51ee1bf269bb45940892eb272d35af97

Revert "* lib-src/Makefile.in (clean): Tidy up seccomp-filter files."
This reverts commit aa354dd55b213b86ee8e3aa0365a6ad915838458.
Revert "Don't use symbolic links in the test resource directory."
This reverts commit a2842a11728336fc8110eedb5176ecfbe71bbc79.
Revert "Ensure that argument to 'verify' is a constant expression."
This reverts commit aaf6b6bf80805d18180e1c16350e9473716f5915.
Revert "Seccomp filter: deal with arch_prctl(ARCH_CET_STATUS, ...)."
This reverts commit 27af0a3dc8b6b45879904bbc5d54b0677f84a5ff.
Revert "Fix Seccomp filter on CentOS 8.3 (Bug#47828)."
This reverts commit 2822246b5d8154d0166e17ffd28a1d85b57d68aa.
Revert "Attempt to print some debugging information on Seccomp failures."
This reverts commit 568ce6826fa0aaa4d5dc95880cbdc0965dc07521.
Revert "* lib-src/seccomp-filter.c: Add missing headers."
This reverts commit 104c5e3d57705cd4bd291b61d7f165def602ab5c.
Revert "Generate Seccomp filters only if we have the necessary constants."
This reverts commit 17d20bb3cbb233ed0d94c3f1f9f3db768f526223.
Revert "* src/emacs.c (load_seccomp): Consistently check for nonzero result"
This reverts commit d37f0f3ac34f09830a881280131980f875d075d3.
Revert "Add a variant of the Seccomp filter file that allows 'execve'."
This reverts commit c8d542fd593f06b85d4b7b712378a4f84ec4d2b3.
Revert "* lib-src/seccomp-filter.c (main): Also allow O_NOFOLLOW."
This reverts commit cf0701eff0f3b06e0324be07f7810cbaf261f7f3.
Revert "Seccomp filter: allow reading the current time (Bug#47708)."
This reverts commit ea5ea09244b762008bba509d8c58bad5835fb949.
Revert "Use pkg-config to check for libseccomp."
This reverts commit 725fc96b706c57ef8ceca5e7d82b175d9a72e845.
Revert "Remove SCMP_FLTATR_CTL_LOG attribute from Seccomp filter."
This reverts commit d06c54db1b3504caed8673216a72b117d0692351.
Revert "Only attempt to generate seccomp filter files on x86-64 systems."
This reverts commit 9dc26d4a8add5b3f2a5fce7907af4f9673ae82c0.
Revert "* lib-src/seccomp-filter.c: Print trailing newline."
This reverts commit 553783628892a5363aacf58ce238969cb60a1c3a.
Revert "Also check for needed seccomp macros."
This reverts commit 25937821bc445235d984c4db8cb18dfbacd6a4ff.
Revert "* src/emacs.c (load_seccomp): Add a useful assertion."
This reverts commit 2db03e3e53af3ce5c87f64d163ab2be96aee2c0f.
Revert "* src/emacs.c (load_seccomp): Fix condition."
This reverts commit 496a46b32db9a3c32a846b8a3c872891303a1ec4.
Revert "Add a helper binary to create a basic Secure Computing filter."
This reverts commit 1060289f51ee1bf269bb45940892eb272d35af97.

* Emacs configuration
I'm using Gentoo, with musl profile ~default/linux/amd64/17.0/musl/hardened~.
** 27.2

Configured using:
 'configure --prefix=/usr --build=x86_64-gentoo-linux-musl
 --host=x86_64-gentoo-linux-musl --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --disable-silent-rules
 --docdir=/usr/share/doc/emacs-27.2
 --htmldir=/usr/share/doc/emacs-27.2/html --libdir=/usr/lib
 --program-suffix=-emacs-27 --includedir=/usr/include/emacs-27
 --infodir=/usr/share/info/emacs-27 --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=no --with-pdumper --disable-acl --without-dbus
 --with-modules --without-gameuser --with-libgmp --without-gpm
 --with-json --without-kerberos --without-kerberos5 --without-lcms2
 --with-xml2 --without-mailutils --without-selinux --with-gnutls
 --without-libsystemd --with-threads --without-wide-int --with-zlib
 --with-sound=no --without-x --without-ns --with-dumping=pdumper
 'CFLAGS=-march=native -O2 -pipe' CPPFLAGS= 'LDFLAGS=-Wl,-O1
 -Wl,--as-needed''

Configured features:
GNUTLS LIBXML2 ZLIB MODULES THREADS JSON PDUMPER GMP

Important settings:
  value of $LANG: C.UTF8
  locale-coding-system: utf-8-unix

Memory information:
((conses 16 2211161 291586)
 (symbols 48 57073 2)
 (strings 32 259188 12930)
 (string-bytes 1 7862427)
 (vectors 16 109477)
 (vector-slots 8 1620006 88906)
 (floats 8 1626 870)
 (intervals 56 115451 4407)
 (buffers 1000 81))

** 28.0
The revision is ec574a72f7198d9793b466f33382fff397ac4ce1

Configured using:
 'configure --prefix=/usr --build=x86_64-gentoo-linux-musl
 --host=x86_64-gentoo-linux-musl --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --disable-silent-rules
 --docdir=/usr/share/doc/emacs-28.0.9999
 --htmldir=/usr/share/doc/emacs-28.0.9999/html --libdir=/usr/lib
 --program-suffix=-emacs-28-vcs --includedir=/usr/include/emacs-28-vcs
 --infodir=/usr/share/info/emacs-28-vcs --localstatedir=/var
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --without-compress-install --without-hesiod --without-pop
 --with-file-notification=no --with-pdumper --disable-acl
 --disable-link-time-optimization --without-dbus --with-modules
 --without-gameuser --with-libgmp --without-gpm --with-json
 --without-kerberos --without-kerberos5 --without-lcms2 --with-xml2
 --without-mailutils --without-selinux --with-gnutls
 --without-libsystemd --with-threads --without-native-compilation
 --without-wide-int --with-zlib --with-sound=no --without-imagemagick
 --without-x --without-ns --with-dumping=pdumper 'CFLAGS=-march=native
 -O2 -pipe' CPPFLAGS= 'LDFLAGS=-Wl,-O1 -Wl,--as-needed''

Configured features:
GMP GNUTLS JSON LIBXML2 MODULES PDUMPER SECCOMP THREADS ZLIB

Important settings:
  value of $LANG: C.UTF8
  locale-coding-system: utf-8-unix

Memory information:
((conses 16 409599 310905)
 (symbols 48 41434 3)
 (strings 32 163330 24933)
 (string-bytes 1 5104681)
 (vectors 16 68170)
 (vector-slots 8 715297 489605)
 (floats 8 393 1947)
 (intervals 56 1099 72)
 (buffers 992 13))




Severity set to 'normal' from 'important' Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 03 Jun 2021 08:08:02 GMT) Full text and rfc822 format available.

Merged 48789 50058. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 14 Aug 2021 19:15:01 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 15 Aug 2021 00:00:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 15 Aug 2021 00:00:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 50058 <at> debbugs.gnu.org and birdsite <at> airmail.cc Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 15 Aug 2021 14:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48789; Package emacs. (Fri, 27 Aug 2021 22:16:02 GMT) Full text and rfc822 format available.

Message #18 received at 48789 <at> debbugs.gnu.org (full text, mbox):

From: akater <nuclearspace <at> gmail.com>
To: 48789 <at> debbugs.gnu.org
Subject: Re: bug#48789 acknowledged by developer         (control message
 for bug #50058)
Date: Fri, 27 Aug 2021 22:04:15 +0000
[Message part 1 (text/plain, inline)]
This bug was closed following the resolution of #50058

However, I still can't build on musl due to seccomp-related issue.

In the original message, I forgot to attach actual output from GCC; here
it goes:

x86_64-gentoo-linux-musl-gcc -fno-common -Wall -Warith-conversion
-Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-cond
-Wextra -Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op
-Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes
-Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd
-Wpacked -Wpointer-arith -Wstrict-prototypes -Wsuggest-attribute=format
-Wsuggest-attribute=noreturn -Wsuggest-final-methods
-Wsuggest-final-types -Wtrampolines -Wuninitialized -Wunknown-pragmas
-Wunused-macros -Wvariadic-macros -Wvector-operation-performance
-Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wformat=2
-Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2
-Wvla-larger-than=4031 -Wredundant-decls -Wno-missing-field-initializers
-Wno-override-init -Wno-sign-compare -Wno-type-limits
-Wno-unused-parameter -Wno-format-nonliteral -I. -I../src -I../lib
-I. -I./../src -I./../lib -Wl,-O1 -Wl,--as-needed -march=native -O2
-pipe seccomp-filter.c \ -lseccomp -o seccomp-filter
seccomp-filter.c: In function 'export_filter':
seccomp-filter.c:134:12: warning: implicit declaration of function 'TEMP_FAILURE_RETRY' [-Wimplicit-function-declaration]
  134 |   int fd = TEMP_FAILURE_RETRY (
      |            ^~~~~~~~~~~~~~~~~~
seccomp-filter.c:134:12: warning: nested extern declaration of 'TEMP_FAILURE_RETRY' [-Wnested-externs]
/usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: /var/tmp/portage/app-editors/emacs-28.0.9999/temp/ccIiDmil.o: in function `export_filter':
seccomp-filter.c:(.text+0x199): undefined reference to `TEMP_FAILURE_RETRY'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:432: seccomp-filter] Error 1
make[1]: Leaving directory '/var/tmp/portage/app-editors/emacs-28.0.9999/work/emacs/lib-src'
make: *** [Makefile:430: lib-src] Error 2
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48789; Package emacs. (Fri, 27 Aug 2021 22:26:02 GMT) Full text and rfc822 format available.

Message #21 received at 48789 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: akater <nuclearspace <at> gmail.com>
Cc: 48789 <at> debbugs.gnu.org
Subject: Re: bug#48789: acknowledged by developer (control message for bug
 #50058)
Date: Sat, 28 Aug 2021 00:25:29 +0200
akater <nuclearspace <at> gmail.com> writes:

> This bug was closed following the resolution of #50058
>
> However, I still can't build on musl due to seccomp-related issue.

I think it'd be better to open a new bug report for this new issue.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48789; Package emacs. (Sat, 28 Aug 2021 06:17:02 GMT) Full text and rfc822 format available.

Message #24 received at 48789 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: akater <nuclearspace <at> gmail.com>
Cc: 48789 <at> debbugs.gnu.org
Subject: Re: bug#48789: acknowledged by developer (control message for bug
 #50058)
Date: Sat, 28 Aug 2021 09:16:12 +0300
> From: akater <nuclearspace <at> gmail.com>
> Date: Fri, 27 Aug 2021 22:04:15 +0000
> 
> However, I still can't build on musl due to seccomp-related issue.
> 
> In the original message, I forgot to attach actual output from GCC; here
> it goes:
> 
> x86_64-gentoo-linux-musl-gcc -fno-common -Wall -Warith-conversion
> -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-cond
> -Wextra -Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op
> -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes
> -Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd
> -Wpacked -Wpointer-arith -Wstrict-prototypes -Wsuggest-attribute=format
> -Wsuggest-attribute=noreturn -Wsuggest-final-methods
> -Wsuggest-final-types -Wtrampolines -Wuninitialized -Wunknown-pragmas
> -Wunused-macros -Wvariadic-macros -Wvector-operation-performance
> -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wformat=2
> -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2
> -Wvla-larger-than=4031 -Wredundant-decls -Wno-missing-field-initializers
> -Wno-override-init -Wno-sign-compare -Wno-type-limits
> -Wno-unused-parameter -Wno-format-nonliteral -I. -I../src -I../lib
> -I. -I./../src -I./../lib -Wl,-O1 -Wl,--as-needed -march=native -O2
> -pipe seccomp-filter.c \ -lseccomp -o seccomp-filter
> seccomp-filter.c: In function 'export_filter':
> seccomp-filter.c:134:12: warning: implicit declaration of function 'TEMP_FAILURE_RETRY' [-Wimplicit-function-declaration]
>   134 |   int fd = TEMP_FAILURE_RETRY (
>       |            ^~~~~~~~~~~~~~~~~~
> seccomp-filter.c:134:12: warning: nested extern declaration of 'TEMP_FAILURE_RETRY' [-Wnested-externs]
> /usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: /var/tmp/portage/app-editors/emacs-28.0.9999/temp/ccIiDmil.o: in function `export_filter':
> seccomp-filter.c:(.text+0x199): undefined reference to `TEMP_FAILURE_RETRY'
> collect2: error: ld returned 1 exit status

I believe TEMP_FAILURE_RETRY is glibc-specific; the configure script
should test for it, and disable seccomp if not supported (or code
around its absence, if possible).

But I agree with Lars that this warrants a separate bug report.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48789; Package emacs. (Sun, 29 Aug 2021 18:55:02 GMT) Full text and rfc822 format available.

Message #27 received at 48789 <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: akater <nuclearspace <at> gmail.com>, 48789 <at> debbugs.gnu.org
Subject: Re: bug#48789: acknowledged by developer (control message for bug
 #50058)
Date: Sun, 29 Aug 2021 20:54:17 +0200
Am Sa., 28. Aug. 2021 um 08:17 Uhr schrieb Eli Zaretskii <eliz <at> gnu.org>:
>
> > From: akater <nuclearspace <at> gmail.com>
> > Date: Fri, 27 Aug 2021 22:04:15 +0000
> >
> > However, I still can't build on musl due to seccomp-related issue.
> >
> > In the original message, I forgot to attach actual output from GCC; here
> > it goes:
> >
> > x86_64-gentoo-linux-musl-gcc -fno-common -Wall -Warith-conversion
> > -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-cond
> > -Wextra -Wformat-signedness -Winit-self -Winvalid-pch -Wlogical-op
> > -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes
> > -Wnested-externs -Wnull-dereference -Wold-style-definition -Wopenmp-simd
> > -Wpacked -Wpointer-arith -Wstrict-prototypes -Wsuggest-attribute=format
> > -Wsuggest-attribute=noreturn -Wsuggest-final-methods
> > -Wsuggest-final-types -Wtrampolines -Wuninitialized -Wunknown-pragmas
> > -Wunused-macros -Wvariadic-macros -Wvector-operation-performance
> > -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2 -Wformat=2
> > -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2
> > -Wvla-larger-than=4031 -Wredundant-decls -Wno-missing-field-initializers
> > -Wno-override-init -Wno-sign-compare -Wno-type-limits
> > -Wno-unused-parameter -Wno-format-nonliteral -I. -I../src -I../lib
> > -I. -I./../src -I./../lib -Wl,-O1 -Wl,--as-needed -march=native -O2
> > -pipe seccomp-filter.c \ -lseccomp -o seccomp-filter
> > seccomp-filter.c: In function 'export_filter':
> > seccomp-filter.c:134:12: warning: implicit declaration of function 'TEMP_FAILURE_RETRY' [-Wimplicit-function-declaration]
> >   134 |   int fd = TEMP_FAILURE_RETRY (
> >       |            ^~~~~~~~~~~~~~~~~~
> > seccomp-filter.c:134:12: warning: nested extern declaration of 'TEMP_FAILURE_RETRY' [-Wnested-externs]
> > /usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: /var/tmp/portage/app-editors/emacs-28.0.9999/temp/ccIiDmil.o: in function `export_filter':
> > seccomp-filter.c:(.text+0x199): undefined reference to `TEMP_FAILURE_RETRY'
> > collect2: error: ld returned 1 exit status
>
> I believe TEMP_FAILURE_RETRY is glibc-specific; the configure script
> should test for it, and disable seccomp if not supported (or code
> around its absence, if possible).

TEMP_FAILURE_RETRY is a trivial helper macro. I've expanded it in
commit 8fa624b39b39569d280b06811dd81f1253559e17.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48789; Package emacs. (Sun, 29 Aug 2021 21:50:01 GMT) Full text and rfc822 format available.

Message #30 received at 48789 <at> debbugs.gnu.org (full text, mbox):

From: akater <nuclearspace <at> gmail.com>
To: Philipp Stephani <p.stephani2 <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 48789 <at> debbugs.gnu.org
Subject: Re: bug#48789: acknowledged by developer (control message for bug
 #50058)
Date: Sun, 29 Aug 2021 21:38:07 +0000
[Message part 1 (text/plain, inline)]
Philipp Stephani <p.stephani2 <at> gmail.com> writes:

> TEMP_FAILURE_RETRY is a trivial helper macro. I've expanded it in
> commit 8fa624b39b39569d280b06811dd81f1253559e17.

Emacs 28 does build now on musl, thank you.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 27 Sep 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 205 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.