<command-line>: warning: "_FORTIFY_SOURCE" redefined <built-in>: note: this is the location of the previous definition In file included from /var/tmp/portage/net-misc/nextcloud-client-3.5.1/work/desktop-3.5.1/src/csync/vio/csync_vio_local_unix.cpp:31: /var/tmp/portage/net-misc/nextcloud-client-3.5.1/work/desktop-3.5.1/src/csync/vio/csync_vio_local_unix.cpp: In function int _csync_vio_local_stat_mb(const mbchar_t*, csync_file_stat_t*)’: /var/tmp/portage/net-misc/nextcloud-client-3.5.1/work/desktop-3.5.1/src/csync/std/c_private.h:88:15: error: _stat’ was not declared in this scope; did you mean stat’? 88 | #define lstat _stat | ^~~~~ ------------------------------------------------------------------- This is an unstable amd64 chroot image at a tinderbox (==build bot) name: 17.1_no_multilib-j4-20220605-170005 ------------------------------------------------------------------- gcc-config -l: [1] x86_64-pc-linux-gnu-12.1.1 * clang/llvm (if any): clang version 14.0.4 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/14/bin /usr/lib/llvm/14 14.0.4 Python 3.9.13 Available Ruby profiles: [1] ruby31 * Available Rust versions: [1] rust-1.61.0 * The following VMs are available for generation-2: 1) OpenJDK 17.0.3_p7 [openjdk-17] 2) OpenJDK 8.332_p09 [openjdk-8] *) Eclipse Temurin JDK 17.0.3_p7 [openjdk-bin-17] 4) Eclipse Temurin JDK 8.332_p09 [openjdk-bin-8] Available Java Virtual Machines: [1] openjdk-8 [2] openjdk-17 [3] openjdk-bin-8 [4] openjdk-bin-17 system-vm The Glorious Glasgow Haskell Compilation System, version 8.10.4 php cli: [1] php8.1 * HEAD of ::gentoo commit 314843433151b37acd811fb425ebd41937e699d5 Author: Repository mirror & CI <repomirrorci@gentoo.org> Date: Mon Jun 6 14:48:03 2022 +0000 2022-06-06 14:48:03 UTC emerge -qpvO net-misc/nextcloud-client [ebuild N ] net-misc/nextcloud-client-3.5.1 USE="-doc -dolphin -nautilus -test -webengine"
Created attachment 783155 [details] emerge-info.txt
Created attachment 783158 [details] emerge-history.txt
Created attachment 783161 [details] environment
Created attachment 783164 [details] etc.portage.tar.bz2
Created attachment 783167 [details] logs.tar.bz2
Created attachment 783170 [details] net-misc:nextcloud-client-3.5.1:20220606-162228.log
Created attachment 783173 [details] temp.tar.bz2
This bug is wildly misleading. Upon closer inspection of CMakeError.log, I’ve found that the test for lstat() fails (thus HAVE_LSTAT is false, and through some defines, the code mentioned above ends up with the nonexistant _stat. The reason that the lstat() test fails is however: ``` qsx@naboo /tmp % cat src.c int main(void) { #ifdef _FORTIFY_SOURCE return _FORTIFY_SOURCE; #else return 42; #endif } qsx@naboo /tmp % /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc -DWITH_FPIC -O2 -pipe -march=native -Wno-incompatible-pointer-types-discards-qualifiers -Wno-discarded-qualifiers -fstack-protector-strong -D_FORTIFY_SOURCE=2 -std=gnu99 -pedantic -pedantic-errors -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -Wmissing-format-attribute -D_GNU_SOURCE -D__STDC_FORMAT_MACROS=1 -fPIC -c src.c <command-line>: error: "_FORTIFY_SOURCE" redefined <built-in>: note: this is the location of the previous definition cc1: note: unrecognized command-line option ‘-Wno-incompatible-pointer-types-discards-qualifiers’ may have been intended to silence earlier diagnostics ``` Huh. But where? Let’s try again, this time without `-D_FORTIFY_SOURCE=2` and `-E` instead of `-c` to see it right away. ``` qsx@naboo /tmp % /usr/lib/ccache/bin/x86_64-pc-linux-gnu-gcc -DWITH_FPIC -O2 -pipe -march=native -Wno-incompatible-pointer-types-discards-qualifiers -Wno-discarded-qualifiers -fstack-protector-strong -std=gnu99 -pedantic -pedantic-errors -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -Wmissing-format-attribute -D_GNU_SOURCE -D__STDC_FORMAT_MACROS=1 -fPIC -E src.c # 0 "src.c" # 0 "<built-in>" # 0 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 0 "<command-line>" 2 # 1 "src.c" int main(void) { return 3; } ``` Well, it isn’t in `/usr/include/stdc-predef.h`, so I blame `<built-in>` and thus probably sys-devel/gcc[hardened]. So who overrides it in `CFLAGS` with `-D_FORTIFY_SOURCE=2`? The package, in src/CMakeLists.txt and cmake/modules/DefineCompilerFlags.cmake. Their changelog mentions a fix for distributions defining it to >2, but that doesn’t work with Gentoo, as we don’t do it in `CFLAGS`. Cf.: https://github.com/nextcloud/desktop/pull/4703 https://github.com/nextcloud/desktop/issues/4697 (contains workaround patch) https://bugzilla.opensuse.org/show_bug.cgi?id=1201070
Thanks Thomas, I had not seen the first line that it was a hardened profile! Coincidentally, a fix for this was pushed this week in ~arch version (will stabilize after a few days), marking as duplicate of that one! *** This bug has been marked as a duplicate of bug 890072 ***
Created attachment 850362 [details, diff] remove -D_FORTIFY_SOURCE override completely (In reply to Thomas Schneider from comment #8) > https://github.com/nextcloud/desktop/issues/4697 (contains workaround patch) Turns out this doesn’t apply with the current version, so here’s an updated patch for that one. Should probably fixed upstream by correctly checking the macro, and the patch should be included in Gentoo only if it’s guaranteed we set at least _FORTIFY_SOURCE=2.
(In reply to Thomas Schneider from comment #10) > Created attachment 850362 [details, diff] [details, diff] > remove -D_FORTIFY_SOURCE override completely > > (In reply to Thomas Schneider from comment #8) > > https://github.com/nextcloud/desktop/issues/4697 (contains workaround patch) > > Turns out this doesn’t apply with the current version, so here’s an updated > patch for that one. Should probably fixed upstream by correctly checking > the macro, and the patch should be included in Gentoo only if it’s > guaranteed we set at least _FORTIFY_SOURCE=2. Isn't this fixed by what we did in bug 890072? And yes, it is guaranteed.