Bug #6298
Fail to build for powerpc related to atomic
Status:
New
Priority:
Normal
Assignee:
-
Category:
non-x86
Target version:
-
Start date:
2023-08-10
Due date:
% Done:
0%
Estimated time:
Found in version:
4.3~2149.g17eebbe
Affected Versions:
Description
Hi,
Debian unstable powerpc build under an emulated machine (qemu)
last version build whithout problem was 4.3~2140.g14298acb6
/usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/main.o: in function `atomic_exchange_time_t': ./src/atomic.h:253:(.text+0xfa8): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/main.o: in function `atomic_add_time_t': ./src/atomic.h:81:(.text+0x1874): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/main.o: in function `atomic_exchange_time_t': ./src/atomic.h:253:(.text.startup+0x1edc): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/epg.o: in function `atomic_add_time_t': ./src/atomic.h:81:(.text+0x48c): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ./src/atomic.h:81:(.text+0xdc0): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ./src/atomic.h:81:(.text+0x2ff8): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ./src/atomic.h:81:(.text+0x3018): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ./src/atomic.h:81:(.text+0x5fe4): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/epg.o:./src/atomic.h:81: more undefined references to `__sync_fetch_and_add_8' follow /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_exchange_time_t': ././src/atomic.h:253:(.text+0xcb0c): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: ././src/atomic.h:253:(.text+0xcb1c): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_add_time_t': ././src/atomic.h:81:(.text+0xcc44): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0xccc8): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_exchange_time_t': ././src/atomic.h:253:(.text+0xccd8): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_add_time_t': ././src/atomic.h:81:(.text+0xcd88): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_exchange_time_t': ././src/atomic.h:253:(.text+0xcd98): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: ././src/atomic.h:253:(.text+0xcfb8): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_add_time_t': ././src/atomic.h:81:(.text+0xd054): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_db.o: in function `atomic_exchange_time_t': ././src/atomic.h:253:(.text+0xd064): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_rec.o: in function `atomic_add_time_t': ././src/atomic.h:81:(.text+0x3e4c): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0x46e0): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0x4cec): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_rec.o: in function `atomic_exchange_time_t': ././src/atomic.h:253:(.text+0x4d20): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: ././src/atomic.h:253:(.text+0x4d34): undefined reference to `__sync_lock_test_and_set_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_rec.o: in function `atomic_add_time_t': ././src/atomic.h:81:(.text+0x51cc): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0x5320): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0x5344): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0x5400): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: ././src/atomic.h:81:(.text+0x542c): undefined reference to `__sync_fetch_and_add_8' /usr/bin/ld: /home/marillat/tvheadend-dmo-4.3~2149.g17eebbef5/build.linux/src/dvr/dvr_rec.o:././src/atomic.h:81: more undefined references to `__sync_fetch_and_add_8' follow collect2: error: ld returned 1 exit status distcc[4430] ERROR: compile (null) on localhost failed
Files
History
Updated by Flole Systems about 1 year ago
It's impossible that the changes in 4.3~2141 introduced this issue. Please double check that reverting that commit indeed fixes your issue.
Updated by Christian Marillat about 1 year ago
I'm not saying that 4.3~2141 introduced this issue, but that I' was able to build tvheadend at this commit.
atomic change started at commit v4.3-2143-gfe47ecb55
Updated by Flole Systems about 1 year ago
Please bisect and point to the exact commit that introduced this issue.
Updated by Christian Marillat about 1 year ago
Build fail with 4.3~2143.gfe47ecb55
fe47ecb5504a521fed9c1ca9705fb0dd2bb8443a is the first bad commit commit fe47ecb5504a521fed9c1ca9705fb0dd2bb8443a Author: Olliver Schinagl <[email protected]> Date: Fri Jun 16 23:55:26 2023 +0200 Fix time for 32bit systems again In issue #6257 an issue mentioning that time_t isn't properly supported when printing on 32-bit systems, specifically on FreeBSD. However, intel 32-bit systems suffer from a similar fate: src/rtsp.c:333:30: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=] 333 | snprintf(buf, sizeof(buf), "npt=%" PRItime_t "-", position); | ^~~~~~~ ~~~~~~~~ | | | time_t {aka long long int} In commit 76a6263f1be4 ("fix for 64bit time_t on 32bit systems") was attempted to be fixed by turning it into a PRId64, which was reverted again in commit 9e1eb89be731 ("Revert "fix for 64bit time_t on 32bit systems""), sadly without a reason as to why in the commit message. We should however, migrate to 64bit timestamps on all platforms anyway, due to the Y2038 problem. Debian is heavily working on this issue too. This commit is just the first step, in that we ensure our time_t is always 64bits. The next steps would be to use difftime where possible instead of subtractions, and ensure all stored timestamps have room for 64bit time_t (htsmsg_get_u32_or_default for example breaks this presumption already). To keep this issue small, and tackle one problem at a time, lets just fix time_t first. We do still have 15 years to fix the other issues. Note, that this patch leaves out FreeBSD specifics, as it is unclear what is specific about 32bit FreeBSD. It should be using the same glibc headers after all. If not, we can always add if needed, but adding usless code doesn't help anyone generally. ``` diff --git a/src/tvheadend.h b/src/tvheadend.h index c2fcee716..751d10d70 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -334,7 +334,9 @@ void tvh_qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void # endif /* ULONG_MAX */ #endif /* __WORDSIZE */ -#if __WORDSIZE == 32 +#if __WORDSIZE == 32 && defined(PLATFORM_FREEBSD) +# define PRItime_t "d" +#elif __WORDSIZE == 32 # define PRItime_t "lld" #elif __WORDSIZE == 64 # define PRItime_t "ld" #else ``` Signed-off-by: Olliver Schinagl <[email protected]> Makefile | 1 + src/tvheadend.h | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-)
Updated by Christian Marillat about 1 year ago
I reworked the bisect. code in commit fe47ecb5504a521fed9c1ca9705fb0dd2bb8443a has been changed.
The problem has been introduced in commit 1c22d866f336d4d38dc0679a0cb03b11237c48fc AKA 4.3~2145.g1c22d866f
commit 1c22d866f336d4d38dc0679a0cb03b11237c48fc Author: Olliver Schinagl <[email protected]> Date: Fri Aug 4 14:26:20 2023 +0200 Fix time for old 32bit systems The fix introduced in fe47ecb5504a ("Fix time for 32bit systems again") made the incorrect assumption, that the macro _TIME_BITS=64 was always available. It seems like that this is not the case for old systems, causing 32bit builds to break there. Lets completely rework 32bit time support, by actually detecting the hosts size for the time. This will break cross-compilation, as the configure script is run on the host, but since we do not seem to support cross-builds anyway (all archs are build on emulated or native targets), this should be acceptable. Fixes fe47ecb5504a ("Fix time for 32bit systems again") Signed-off-by: Olliver Schinagl <[email protected]>