Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 735818

Summary: app-arch/zstd-1.4.5 fails to compile on alpha
Product: Gentoo Linux Reporter: Christopher May-Townsend <chris>
Component: Current packagesAssignee: Patrick Lauer <patrick>
Status: RESOLVED FIXED    
Severity: normal CC: alpha
Priority: Normal    
Version: unspecified   
Hardware: Alpha   
OS: Linux   
See Also: https://www.sourceware.org/bugzilla/show_bug.cgi?id=27042
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 759001    
Bug Blocks:    
Attachments: zstd error
emerge info
patch for alpha architecture
patch for programs/util.c: fix build without st_mtime

Description Christopher May-Townsend 2020-08-03 20:39:37 UTC
Created attachment 652804 [details]
zstd error

attached is the output snippet of the error
Comment 1 Christopher May-Townsend 2020-08-03 20:40:55 UTC
Created attachment 652806 [details]
emerge info
Comment 2 Yoshihiko Iwama 2020-08-24 09:54:39 UTC
I have the same issue on my UP1100.

At line 152 in programs/util.c of zstd-1.4.5, it is determined whether macro PLATFORM_POSIX_VERSION is 200809L or more and whether struct stat has member st_mtim by whether macro st_mtime is defined.
If __USE_XOPEN2K8 is defined and built with gcc version 3.3 or higher, Alpha architecture does not define macro st_mtime by adding both members st_mtim and st_mtime to struct stat by using union.(/usr/include/bits/stat.h)
In programs/platform.h, macro PLATFORM_POSIX_VERSION is defined equal to _POSIX_VERSION. Since __USE_XOPEN2K8 is defined in /usr/include/features.h, _POSIX_VERSION is 200809L in /usr/include/unistd.h. On Linux/alpha with __USE_XOPEN2K8 defined (in /usr/include/features.h), I think it can be said that struct stat will include member st_mtim even if macro st_mtime is not defined.

A simple solution is to treat Linux/alpha specially, but if there is a good way to easily determine if a structure contains a member, I'd prefer it.
Comment 3 Yoshihiko Iwama 2020-08-25 15:33:45 UTC
I was able to build with a attached patch that allows Linux/alpha if  PLATFORM_POSIX_VERSION is 200809L or higher.
Comment 4 Yoshihiko Iwama 2020-08-25 15:35:42 UTC
Created attachment 656624 [details, diff]
patch for alpha architecture
Comment 5 Yoshihiko Iwama 2020-11-25 13:48:31 UTC
Created attachment 674845 [details, diff]
patch for programs/util.c: fix build without st_mtime

I've noticed that this compiling failure issue has already been addressed upstream.

https://github.com/facebook/zstd/commit/26d01bdb26f1c7487ad4ba0151221dfe28cd878d#diff-bdd9ed58a64f99d68ed71c774eade698deeaefcf10da2c8bd2764269a916f53c

I attach a patch similar to upstream.
Comment 6 Matt Turner gentoo-dev 2020-12-08 01:57:29 UTC
In debugging a glib build failure, I realized that the cause is actually the cause of this build failure as well. See bug 759001.
Comment 7 Matt Turner gentoo-dev 2020-12-24 20:39:48 UTC
Now fixed in glibc-2.32-r6.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-12-24 22:43:54 UTC
(In reply to Matt Turner from comment #7)
> Now fixed in glibc-2.32-r6.

Nice perseverance Matt (and OP for reporting)!