Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 43 |
Nodes: | 6 (0 / 6) |
Uptime: | 100:30:47 |
Calls: | 290 |
Files: | 905 |
Messages: | 76,508 |
Package: hdf5[skipped]
Version: 1.14.5+repack-2
Tags: ftbfs
Usertags: hppa
The fortran test is the only one which fails on hppa: https://buildd.debian.org/status/fetch.php?pkg=hdf5&arch=hppa&ver=1.14.5%2Brepack-2&stamp=1735623616&raw=0
Testing object functions
PASSED
h5ovisit_f 1 FAILED
h5ovisit_f 1a FAILED
h5ovisit_f 2 FAILED
h5ovisit_f 2a FAILED
h5ovisit_by_name_f 1 FAILED
h5ovisit_by_name_f 1a FAILED
Testing object visiting functions
*FAILED*
Which ones exactly can be seen with this patch:
I tried to debug this, but I'm lacking too much fortran or hdf
knowledge.
It seems the gmtime() function is involved.
Could it be caused by the fact that time_t is now 64bit on hppa.
Note: hppa is a big-endian 32-bit userspace platform.
Le 2025-01-02 14:04, Helge Deller a écrit :
Package: hdf5[skipped]
Version: 1.14.5+repack-2
Tags: ftbfs
Usertags: hppa
The fortran test is the only one which fails on hppa:
https://buildd.debian.org/status/fetch.php?pkg=hdf5&arch=hppa&ver=1.14.5%2Brepack-2&stamp=1735623616&raw=0
Testing object functions
PASSED
h5ovisit_f 1 FAILED
h5ovisit_f 1a FAILED
h5ovisit_f 2 FAILED
h5ovisit_f 2a FAILED
h5ovisit_by_name_f 1 FAILED
h5ovisit_by_name_f 1a FAILED
Testing object visiting functions
*FAILED*
Which ones exactly can be seen with this patch:
I tried to debug this, but I'm lacking too much fortran or hdf
knowledge.
It seems the gmtime() function is involved.
Could it be caused by the fact that time_t is now 64bit on hppa.
Note: hppa is a big-endian 32-bit userspace platform.
Same failure on powerpc which is big-endian 32-bit as well.
On 1/3/25 15:55, pini@debian.org wrote:
You were right about the gmtime() function being involved. It
appears that on powerpc and hppa it returns 01/01/1970. I've set up a
reproducer (attached).
That's what I needed.
Thanks!
On powerpc / hppa:
$ gfortran -g -o test_gmtime test_gmtime.F90
$ ./test_gmtime
time8: 1735915109
Year: 1970
Month: 1
Day: 1
Hour: 0
Minute: 0
Second: 0
On amd64:
$ gfortran -g -o test_gmtime test_gmtime.F90
0 ;) pini@pinibrem14:~/tmp/h5gmtime
$ ./test_gmtime
time8: 1735915041
Year: 2025
Month: 1
Day: 3
Hour: 14
Minute: 37
Second: 21
I don't know how to solve this yet.
Ok, I know how to fix it:
In your fortran example, replace
FUNCTION gmtime_c(stdtime_t) BIND(C, NAME='gmtime')
by:
FUNCTION gmtime_c(stdtime_t) BIND(C, NAME='__gmtime64')
On 32-bit platforms, glibc provides "gmtime" for 32-bit time_t,
and __gmtime64 for 64-bit time_t. At compile time depending
on defines, one or the other is used.
Is it possible to detect during config time, if that function
is exported by glibc, and then use it if it's available?
On 1/3/25 18:59, pini@debian.org wrote:
Le 2025-01-03 17:43, Helge Deller a écrit :
On 1/3/25 15:55, pini@debian.org wrote:
You were right about the gmtime() function being involved. It
appears that on powerpc and hppa it returns 01/01/1970. I've set up
a reproducer (attached).
That's what I needed.
Thanks!
On powerpc / hppa:
$ gfortran -g -o test_gmtime test_gmtime.F90
$ ./test_gmtime
time8: 1735915109
Year: 1970
Month: 1
Day: 1
Hour: 0
Minute: 0
Second: 0
On amd64:
$ gfortran -g -o test_gmtime test_gmtime.F90
0 ;) pini@pinibrem14:~/tmp/h5gmtime
$ ./test_gmtime
time8: 1735915041
Year: 2025
Month: 1
Day: 3
Hour: 14
Minute: 37
Second: 21
I don't know how to solve this yet.
Ok, I know how to fix it:
In your fortran example, replace
FUNCTION gmtime_c(stdtime_t) BIND(C, NAME='gmtime')
by:
FUNCTION gmtime_c(stdtime_t) BIND(C, NAME='__gmtime64')
On 32-bit platforms, glibc provides "gmtime" for 32-bit time_t,
and __gmtime64 for 64-bit time_t. At compile time depending
on defines, one or the other is used.
Is it possible to detect during config time, if that function
is exported by glibc, and then use it if it's available?
I'm not sure that would be the correct solution. I think there is
now an inconsistency between gcc and gfortran on hppa and powerpc,
the former using __gmtime64 as the default for gmtime, and the
latter sticking to its legacy 32-bit implementation.
No. Both use the 64-bit implementation on debian, since debian
defines _TIME_BITS=64 on all 32-bit platforms (beside x86 due to compatibility).
The rule should be:
if H5_SIZEOF_TIME_T == 8
use __gmtime64 if glibc provides it, else
use gmtime which is the default.
else
use gmtime
This works for all: 32- and 64-bit, big- and little-endian.
This problem doesn't exist on litte-endian 32-bit architectures.
Yes, it does.
The only difference is, that on little-endian the lower 32-bits of
the time_t value is stored in the first 4 bytes (and thus have the
correct
value), while on big endian the upper 32bits (which are zero) are
stored
in the lower 4 bytes - which is why you get here the wrong date.