Skip to content

Testament: build fails on 32-bit musl libc because d:nimUse64BitCTime isn't passed to compiler #24346

@tokyovigilante

Description

@tokyovigilante

Description

Musl defines time_t as a 64 bit int on all platforms. When building against Musl (Alpine linux in this case) the build fails on 32-bit platforms because the nimUse64BitCTime flag isn't passed when building testament.

Example (from Alpine's CI - https://gitlab.alpinelinux.org/tokyovigilante/aports/-/jobs/1565125):

Nim Version

2.2.0

Current Output

/home/buildozer/.cache/nim/testament_r/@m..@slib@[email protected]: In function 'getLocalOffsetAndDst__pureZtimes_u1906':
/home/buildozer/.cache/nim/testament_r/@m..@slib@[email protected]:2179:28: error: passing argument 1 of 'localtime' from incompatible pointer type [-Wincompatible-pointer-types]
 2179 |         tmPtr = localtime((&a));
      |                           ~^~~
      |                            |
      |                            long int *
In file included from /home/buildozer/.cache/nim/testament_r/@m..@slib@[email protected]:11:
/usr/include/time.h:60:23: note: expected 'const time_t *' {aka 'const long long int *'} but argument is of type 'long int *'
   60 | struct tm *localtime (const time_t *);
      |                       ^~~~~~~~~~~~~~
CC: ../lib/pure/concurrency/cpuinfo.nim
CC: ../lib/std/monotimes.nim
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread -O3 -fno-strict-aliasing -fno-ident -fno-math-errno   -I/builds/tokyovigilante/aports/community/nim/src/nim-2.2.0/lib -I/builds/tokyovigilante/aports/community/nim/src/nim-2.2.0/testament -o /home/buildozer/.cache/nim/testament_r/@m..@slib@[email protected] /home/buildozer/.cache/nim/testament_r/@m..@slib@[email protected]' failed with exit code: 1
FAILURE

Expected Output

No response

Known Workarounds

Force 64-bit time_t by patching nim_posix_other.nim.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions