Summary: | sys-devel/gcc: fails to compile sys-apps/fakeroot with CFLAGS="-fno-semantic-interposition" (/usr/include/bits/fcntl2.h:117:1: error: inlining failed in call to 'always_inline' 'openat.localalias': function not inlinable) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Matteo Salonia <saloniamatteo> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | CC: | base-system, esigra, ran.dall, saloniamatteo, sam |
Priority: | Normal | Keywords: | PullRequest |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: |
https://github.com/gentoo/gentoo/pull/25007 https://bugs.gentoo.org/show_bug.cgi?id=908421 https://bugs.gentoo.org/show_bug.cgi?id=911727 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270 https://github.com/gentoo/gentoo/pull/40397 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
Patch used to fix fakeroot
emerge --info (some packages removed because not related to bug) Fakeroot 1.25 build.log (failed build) Archive containing photo proof (emerge -p fakeroot, portage applying custom patch, successful emerge) Successful fakeroot-1.27 build.log |
Created attachment 766122 [details]
emerge --info (some packages removed because not related to bug)
Added output of `emerge --info`
Bug is present even without LTO and CCache: "/etc/portage/package.env/sys-apps": sys-apps/fakeroot no-ccache.conf perf-no-lto.conf "/etc/portage/env/no-ccache.conf": CC="gcc" CXX="g++" COMPILER="gcc" HOSTCC="gcc" FEATURES="-ccache" "/etc/portage/env/perf-no-lto.conf": COMMON_FLAGS="-Ofast -pipe -march=haswell -mtune=haswell -fno-plt -falign-functions=32 -floop-nest-optimize -fipa-pta -fno-semantic-interposition -fno-common -fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range -fexcess-precision=fast -fdevirtualize-at-ltrans" CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" What version of fakeroot are you attempting to build? Please attach a build log. Created attachment 766123 [details]
Fakeroot 1.25 build.log (failed build)
(In reply to Mike Gilbert from comment #3) > What version of fakeroot are you attempting to build? > > Please attach a build log. Mike, this error occurs with every available fakeroot version, from 1.25 to 1.27. In the attachments you'll find "fakeroot-1.25.log", a build log from fakeroot-1.25's failed build. > With these changes, I reverted "fakeroot-1.25.3-glibc-2.33.patch" 's changes, patch provided by the package mantainer of fakeroot.
Do you mean that this change been applied upstream already? Please provide a link.
(In reply to Mike Gilbert from comment #6) > > With these changes, I reverted "fakeroot-1.25.3-glibc-2.33.patch" 's changes, patch provided by the package mantainer of fakeroot. > > Do you mean that this change been applied upstream already? Please provide a > link. Sorry if I haven't been clear, here's what I mean. The Gentoo package mantainer, "Gentoo Base System", provides a patch called "fakeroot-1.25.3-glibc-2.33.patch". You can find this patch in the following directory: "/var/db/repos/gentoo/sys-apps/fakeroot/files/fakeroot-1.25.3-glibc-2.33.patch" Then, what I did is fix two lines of that patch, which regard the "openat" function, that causes build issues, at least for me (see fakeroot-1.25.log) To temporarily override the patch, I added this patch in my user patches folder. What should be done is fix the patch (/var/db/repos/gentoo/sys-apps/fakeroot/files/fakeroot-1.25.3-glibc-2.33.patch) and remove those lines (lines 331 to 350, lines 402 to 410). Removing those lines fixes build problems, at least for me. (In reply to Matteo Salonia from comment #7) > The Gentoo package mantainer, "Gentoo Base System" If it wasn't obvious, I meant the maintainer of the "fakeroot" Gentoo package. You said you also tried fakeroot-1.27. That version does not apply fakeroot-1.25.3-glibc-2.33.patch. Do you experience the same failure with that version? (In reply to Mike Gilbert from comment #9) > You said you also tried fakeroot-1.27. That version does not apply > fakeroot-1.25.3-glibc-2.33.patch. > > Do you experience the same failure with that version? Yes, yes I do. In that case, the problem exists in the upstream code and must be fixed there first. I think it would be helpful if you could do some more testing to figure out which of your CFLAGS is triggering the issue. (In reply to Mike Gilbert from comment #11) > In that case, the problem exists in the upstream code and must be fixed > there first. I don't think so: the patch is provided by Gentoo and causes issues for me, I don't know about others > I think it would be helpful if you could do some more testing to figure out > which of your CFLAGS is triggering the issue. I built fakeroot with the same CFLAGS, I didn't change them, for both the failed and the successful build. The failed build is the build before this patch (fakeroot-revert-patch-changes.patch), the successful build is the build after applying it. (CFLAGS: "-Ofast -pipe -march=haswell -mtune=haswell -fno-plt -falign-functions=32 -floop-nest-optimize -fipa-pta -fno-semantic-interposition -fno-common -fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range -fexcess-precision=fast -fdevirtualize-at-ltrans"; no LTO here and ccache was disabled with FEATURES="-ccache" and other options described above.) (In reply to Matteo Salonia from comment #12) > (In reply to Mike Gilbert from comment #11) > > In that case, the problem exists in the upstream code and must be fixed > > there first. > > I don't think so: the patch is provided by Gentoo and causes issues for me, > I don't know about others fakeroot-1.25.3-glibc-2.33.patch just backports bug fixes to fakeroot-1.25.3 from newer versions of fakeroot. fakeroot-1.27.ebuild applies no patches. We do not alter the upstream code in any way for that that version. > I built fakeroot with the same CFLAGS, I didn't change them, for both the failed and the successful build. I am unable to reproduce the issue. The obvious trigger is your crazy-looking CFLAGS. If you can identify which one causes this problem, that would be helpful. Created attachment 766124 [details]
Archive containing photo proof (emerge -p fakeroot, portage applying custom patch, successful emerge)
Added archive (fakeroot.tar.xz) containing the following pictures:
emerge -p fakeroot
portage successfully applies patch I created (fakeroot-revert-patch-changes.patch)
portage emerges fakeroot successfully
(In reply to Mike Gilbert from comment #13) > I am unable to reproduce the issue. The obvious trigger is your > crazy-looking CFLAGS. If you can identify which one causes this problem, > that would be helpful. OK. I'll test the CFLAGS and get back to you. Update: - Build FAILS with CFLAGS: "-Ofast -pipe -march=haswell -mtune=haswell -fno-plt -falign-functions=32 -floop-nest-optimize -fipa-pta -fno-semantic-interposition -fno-common" - Build is SUCCESSFUL with CFLAGS: "-Ofast -pipe -march=haswell -mtune=haswell -fno-plt -falign-functions=32 -floop-nest-optimize -fipa-pta -fno-common" - Build is SUCCESSFUL with CFLAGS: "-Ofast -pipe -march=haswell -mtune=haswell -fno-plt -falign-functions=32 -floop-nest-optimize -fipa-pta -fno-common -fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range -fexcess-precision=fast -fdevirtualize-at-ltrans" The culprit seems to be "-fno-semantic-interposition". Removing it fixes the problem. Strangely, with this flag on, I have no issues when building with the patch I provided. Created attachment 766125 [details]
Successful fakeroot-1.27 build.log
Added fakeroot-1.27 build.log
With this build, you can see the CFLAGS include -fno-semantic-interposition.
This build is SUCCESSFUL because portage applies the patch I created, "fakeroot-revert-patch-changes.patch"
Thanks for testing! Although your patch "fixes" the issue for you, I'm not convinced it is the correct solution here. Presumably that code was added to fix some other issue, and just needs to be adjusted rather than removed entirely. I would suggest reporting the problem to the upstream maintainer. https://bugs.debian.org/fakeroot Actually, it looks like this might be a bug in gcc. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7af3ec75563c6744dba7db4bd94da818844c6039 commit 7af3ec75563c6744dba7db4bd94da818844c6039 Author: Randall Vasquez <ran.dall@icloud.com> AuthorDate: 2022-04-12 13:34:17 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-04-12 22:37:51 +0000 sys-apps/fakeroot: add flag-o-matic filter for flag -fno-semantic-interposition Bug: https://bugs.gentoo.org/834445 Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270 Signed-off-by: Randall Vasquez <ran.dall@icloud.com> Closes: https://github.com/gentoo/gentoo/pull/25007 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/fakeroot/fakeroot-1.25.3-r1.ebuild | 4 ++++ sys-apps/fakeroot/fakeroot-1.26-r1.ebuild | 4 ++++ sys-apps/fakeroot/fakeroot-1.27.ebuild | 4 ++++ 3 files changed, 12 insertions(+) We've added a workaround downstream, but I don't think we can do much more. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2119b4f0306f3133015e42fb55dcd442dfecf40 commit e2119b4f0306f3133015e42fb55dcd442dfecf40 Author: NHOrus <jy6x2b32pie9@yahoo.com> AuthorDate: 2025-01-31 11:16:23 +0000 Commit: Nowa Ammerlaan <nowa@gentoo.org> CommitDate: 2025-01-31 13:10:42 +0000 dev-libs/libsass: add flag-o-matic filter for flag -fno-semantic-interposition Bug: https://bugs.gentoo.org/834445 Bug: https://github.com/sass/libsass/issues/3193 Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com> Closes: https://github.com/gentoo/gentoo/pull/40397 Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org> dev-libs/libsass/libsass-3.6.5-r1.ebuild | 8 ++++++-- dev-libs/libsass/libsass-3.6.6.ebuild | 8 ++++++-- dev-libs/libsass/libsass-9999.ebuild | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) |
Created attachment 766121 [details, diff] Patch used to fix fakeroot Hello everyone, today I tried to emerge "fakeroot". When trying to emerge it, however, portage errored out with a GCC error, with the following error: ``` In file included from usr/include/fcntl.h:342, from libfakeroot.c:138: libfakeroot.c: In function 'mknodat': /usr/include/bits/fcntl2.h:117:1: error: inlining failed in call to 'always_inline' 'openat.localalias': function not inlinable 117 | openat (int __fd, const char *__path, int __oflag, ...) | ~~~~~ libfakeroot.c:1130:6: note: called from here 1130 | fd=openat(dir_fd, pathname, O_WRONLY|O_CREAT|O_TRUNC, 00644); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` and so on. To fix this, I created a user patch in "/etc/portage/patches/sys-apps/fakeroot" with the following content: ``` diff --git a/libfakeroot.c b/libfakeroot.c index 169f4da..7593dd6 100644 --- a/libfakeroot.c +++ b/libfakeroot.c @@ -2586,19 +2570,3 @@ int sysinfo(int command, char *buf, long count) } } #endif - -#ifdef HAVE_OPENAT -int openat(int dir_fd, const char *pathname, int flags, ...) -{ - mode_t mode; - - if (flags & O_CREAT) { - va_list args; - va_start(args, flags); - mode = va_arg(args, int); - va_end(args); - } - - return next_openat(dir_fd, pathname, flags, mode); -} -#endif diff --git a/wrapfunc.inp b/wrapfunc.inp index f7ad186..556af34 100644 --- a/wrapfunc.inp +++ b/wrapfunc.inp @@ -198,7 +198,7 @@ fchownat;int;(int dir_fd, const char *path, uid_t owner, gid_t group, int flags) mkdirat;int;(int dir_fd, const char *pathname, mode_t mode);(dir_fd, pathname, mode) #endif /* HAVE_MKDIRAT */ #ifdef HAVE_OPENAT -openat;int;(int dir_fd, const char *pathname, int flags, mode_t mode);(dir_fd, pathname, flags, mode);;(int dir_fd, const char *pathname, int flags, ...) +openat;int;(int dir_fd, const char *pathname, int flags);(dir_fd, pathname, flags) #endif /* HAVE_OPENAT */ #ifdef HAVE_RENAMEAT renameat;int;(int olddir_fd, const char *oldpath, int newdir_fd, const char *newpath);(olddir_fd, oldpath, newdir_fd, newpath) -- GitLab ``` With these changes, I reverted "fakeroot-1.25.3-glibc-2.33.patch" 's changes, patch provided by the package mantainer of fakeroot. Changing these lines lets me successfully compile fakeroot.