Project

General

Profile

Bug #6288

Commit fe47ecb breaks compilation on 32-bit systems

Added by John Hunt over 1 year ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
General
Target version:
-
Start date:
2023-08-01
Due date:
% Done:

0%

Estimated time:
Found in version:
4.3-2143~gfe47ecb55
Affected Versions:

Description

The following commit (https://github.com/tvheadend/tvheadend/commit/fe47ecb5504a521fed9c1ca9705fb0dd2bb8443a) breaks compilation on 32-bit systems. I've attached a build log from my 32-bit Raspberry Pi system.

The author arbitrarily removed a check for 32-bit FreeBSD systems claiming it's "unclear" what's specific about 32-bit FreeBSD. It's very clear what's specific here -- time_t is 32-bits only!

He also changed the time_t format string to "%lld" for all 32-bit systems. I don't know of any 32-bit systems with a 64-bit time_t. Raspbian Bullseye certainly doesn't have it.

I apologize if my tone is harsh. I've tried communicating with the author of these patches in the past and he's determined to break support for 32-bit systems 15 years before the Y2038 expiration date. I don't think a single contributor should have sole discretion on this matter. Unannounced breaking changes tend to be frowned upon. This would be especially true in the embedded system community where a great many 32-bit systems are still in use.

Thank you for your understanding.


Files

tvheadend.log (16.9 KB) tvheadend.log John Hunt, 2023-08-01 22:04

History

#1

Updated by saen acro over 1 year ago

Confirm same behavior.

Solution can be simple IF THEN ELSE check during compilation,
and implementation of corresponding code.

#2

Updated by Flole Systems over 1 year ago

I suggest you (or someone else) submits a PR that makes GitHub actions run all of our builds on new PRs aswell (obviously without uploading them). Right now we have a single build that checks if PRs compile or not, however we have like 45 different systems that we build after it's merged. Building those to check the PRs would allow to detect such issues easily.

#3

Updated by saen acro over 1 year ago

Flole Systems wrote:

I suggest you (or someone else) submits a PR that makes GitHub actions run all of our builds on new PRs aswell (obviously without uploading them). Right now we have a single build that checks if PRs compile or not, however we have like 45 different systems that we build after it's merged. Building those to check the PRs would allow to detect such issues easily.

adapt this be hero

on: [push, pull_request]

concurrency:
  group: fast-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  xxhash-c-compilers:
    name: CC=${{ matrix.cc }}, ${{ matrix.os }}
    strategy:
      fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix entry fails.
      matrix:
        include: [
          # You can access the following values via ${{ matrix.??? }}
          #
          #   pkgs    : apt-get package names.  It can include multiple package names which are delimited by space.
          #   cc      : C compiler executable.
          #   cxx     : C++ compiler executable for `make ctocpptest`.
          #   avx512  : Set 'true' if compiler supports avx512.  Otherwise, set 'false'.
          #   os      : GitHub Actions YAML workflow label.  See https://github.com/actions/virtual-environments#available-environments

          # cc
          { pkgs: '',                                  cc: cc,        cxx: c++,         avx512: 'true',  os: ubuntu-latest, },

          # gcc
          { pkgs: '',                                  cc: gcc,       cxx: g++,         avx512: 'true',  os: ubuntu-latest, },
          { pkgs: 'gcc-12  g++-12  lib32gcc-12-dev',   cc: gcc-12,    cxx: g++-12,      avx512: 'true',  os: ubuntu-22.04,  },
          { pkgs: 'gcc-11  g++-11  lib32gcc-11-dev',   cc: gcc-11,    cxx: g++-11,      avx512: 'true',  os: ubuntu-22.04,  },
          { pkgs: 'gcc-10  g++-10  lib32gcc-10-dev',   cc: gcc-10,    cxx: g++-10,      avx512: 'true',  os: ubuntu-22.04,  },
          { pkgs: 'gcc-9   g++-9   lib32gcc-9-dev',    cc: gcc-9,     cxx: g++-9,       avx512: 'true',  os: ubuntu-22.04,  },
          { pkgs: 'gcc-8   g++-8   lib32gcc-8-dev',    cc: gcc-8,     cxx: g++-8,       avx512: 'true',  os: ubuntu-20.04,  },
          { pkgs: 'gcc-7   g++-7   lib32gcc-7-dev',    cc: gcc-7,     cxx: g++-7,       avx512: 'true',  os: ubuntu-20.04,  },

          # clang
          { pkgs: '',                                  cc: clang,     cxx: clang++,     avx512: 'true',  os: ubuntu-latest, },
          { pkgs: 'clang-12',                          cc: clang-12,  cxx: clang++-12,  avx512: 'true',  os: ubuntu-22.04,  },
          { pkgs: 'clang-11',                          cc: clang-11,  cxx: clang++-11,  avx512: 'true',  os: ubuntu-22.04,  },
          { pkgs: 'clang-10',                          cc: clang-10,  cxx: clang++-10,  avx512: 'true',  os: ubuntu-20.04,  },
          { pkgs: 'clang-9',                           cc: clang-9,   cxx: clang++-9,   avx512: 'true',  os: ubuntu-20.04,  },
          { pkgs: 'clang-8',                           cc: clang-8,   cxx: clang++-8,   avx512: 'true',  os: ubuntu-20.04,  },
          { pkgs: 'clang-7',                           cc: clang-7,   cxx: clang++-7,   avx512: 'true',  os: ubuntu-20.04,  },
          { pkgs: 'clang-6.0',                         cc: clang-6.0, cxx: clang++-6.0, avx512: 'true',  os: ubuntu-20.04,  },
        ]

    runs-on: ${{ matrix.os }}
    env:                        # Set environment variables
      # We globally set CC and CXX to improve compatibility with .travis.yml
      CC: ${{ matrix.cc }}
      CXX: ${{ matrix.cxx }}
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

    - name: apt-get install
      run: |
        sudo apt-get update
        sudo apt-get install gcc-multilib
        sudo apt-get install ${{ matrix.pkgs }}
    - name: Environment info
      run: |
        echo && type $CC && which $CC && $CC --version
        echo && type $CXX && which $CXX && $CXX --version
        echo && type make && make -v
        echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present
    - name: C90 + no-long-long compliance
      if: always()
      run: |
        CFLAGS="-std=c90 -pedantic -Wno-long-long -Werror" make clean xxhsum
    - name: C90 + XXH_NO_LONG_LONG
      if: always()
      run: |
        # strict c90, with no long long support; resulting in no XXH64_* symbol
        make clean c90test
    - name: dispatch
      if: always()
      run: |
        # removing sign conversion warnings due to a bug in gcc-5's definition of some AVX512 intrinsics
        CFLAGS="-Werror" MOREFLAGS="-Wno-sign-conversion" make clean dispatch
    - name: DISPATCH=1
      if: always()
      run: |
        CFLAGS="-Wall -Wextra -Werror" make DISPATCH=1 clean default
    - name: XXH_SIZE_OPT == 2
      if: always()
      run: |
        CFLAGS="-Os -DXXH_SIZE_OPT=2 -Wall -Wextra -Werror" make clean xxhsum
    - name: noxxh3test
      if: always()
      run: |
        # check library can be compiled with XXH_NO_XXH3, resulting in no XXH3_* symbol
        make clean noxxh3test
    - name: nostreamtest
      if: always()
      run: |
        # check library can be compiled with XXH_NO_STREAM, resulting in no streaming symbols
        make clean noxxh3test
    - name: make avx512f
      if: ${{ matrix.avx512 == 'true' }}
      run: |
        CFLAGS="-O1 -mavx512f -Werror" make clean default
    - name: test-all
      if: always()
      run: |
        make clean test-all
  ubuntu-consistency:
    name: Linux x64 check results consistency
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

    - name: Environment info
      run: |
        echo && gcc --version
        echo && make -v
        echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present
    - name: Scalar code path
      run: |
        CPPFLAGS=-DXXH_VECTOR=XXH_SCALAR make clean check
    - name: SSE2 code path
      run: |
        CPPFLAGS=-DXXH_VECTOR=XXH_SSE2 make clean check
    - name: AVX2 code path
      run: |
        CPPFLAGS="-mavx2 -DXXH_VECTOR=XXH_AVX2" make clean check
    # As for AVX512, see "Known critical issues" at the top of this file
    - name: AVX512 code path
      run: |
        # Run "make check" if /proc/cpuinfo has flags for avx512.
        grep -q "^flags.*\bavx512\b" /proc/cpuinfo && CPPFLAGS="-mavx512f -DXXH_VECTOR=XXH_AVX512" make clean check || (echo This test runner does not support AVX512. && $(exit 0))
    - name: reroll code path (#240)
      run: |
        CPPFLAGS=-DXXH_REROLL=1 make clean check
    - name: tests/bench
      run: |
        make -C tests/bench
  ubuntu-misc:
    name: Linux x64 misc tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

    - name: apt-get install
      run: |
        sudo apt-get update
        sudo apt-get install valgrind cppcheck
    - name: Environment info
      run: |
        echo && gcc --version
        echo && clang --version
        echo && valgrind --version
        echo && cppcheck --version
        echo && make -v
        echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present
    - name: cppcheck
      run: |
        # This test script ignores exit code of cppcheck.  See knowin issues
        # at the top of this file.
        make clean cppcheck || echo There are some cppcheck reports
    - name: test-mem (valgrind)
      run: |
        make clean test-mem
    - name: usan
      run: |
        make clean usan
    - name: Lint Unicode in root-dir, cli/, tests/, tests/bench/, tests/collisions/.
      run: |
        make lint-unicode
    - name: test-filename-escape
      # See also issue #695 - https://github.com/Cyan4973/xxHash/issues/695
      run: |
        make clean test-filename-escape
    - name: test-cli-comment-line
      run: |
        make clean test-cli-comment-line
  ubuntu-cmake-unofficial:
    name: Linux x64 cmake unofficial build test
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

    - name: Environment info
      run: |
        echo && gcc --version
        echo && cmake --version
        echo && make -v
        echo && cat /proc/cpuinfo || echo /proc/cpuinfo is not present
    - name: cmake
      run: |
        cd cmake_unofficial
        cmake -Bbuild
        cd build
        CFLAGS=-Werror make
        mkdir -p test_install_dir
        DESTDIR=test_install_dir cmake --install .
    - name: cmake pkgconfig generation
      run: |
        cd cmake_unofficial
        pwd
        ls
        rm -rf build
        cmake -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=/usr/include -DCMAKE_INSTALL_LIBDIR=/usr/lib
        echo "checking content of libxxhash.pc" 
        cat build/libxxhash.pc | grep "libdir=/usr/lib" 
        cat build/libxxhash.pc | grep "includedir=/usr/include" 
    - name: cmake minimum version v2.8.12 test
      run: |
        mkdir -p cmake_bins
        cd cmake_bins
        wget https://cmake.org/files/v2.8/cmake-2.8.12.2-Linux-i386.tar.gz
        tar xzf cmake-2.8.12.2-Linux-i386.tar.gz
        cd ../cmake_unofficial
        rm -rf build
        pwd
        ls
        mkdir -p build
        cd build
        ../../cmake_bins/cmake-2.8.12.2-Linux-i386/bin/cmake --version
        ../../cmake_bins/cmake-2.8.12.2-Linux-i386/bin/cmake ..
        ../../cmake_bins/cmake-2.8.12.2-Linux-i386/bin/cmake --build .
        mkdir -p test_install_dir
        DESTDIR=test_install_dir ../../cmake_bins/cmake-2.8.12.2-Linux-i386/bin/cmake --install .
        rm -rf *
        ../../cmake_bins/cmake-2.8.12.2-Linux-i386/bin/cmake -DCMAKE_BUILD_TYPE=Debug ..
        ../../cmake_bins/cmake-2.8.12.2-Linux-i386/bin/cmake --build .
  # Linux, { ARM, ARM64, PPC64LE, PPC64, S390X }
  # All tests are using QEMU and gcc cross compiler.

  qemu-consistency:
    name: QEMU ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
      matrix:
        include: [
          { name: 'ARM',             xcc_pkg: gcc-arm-linux-gnueabi,        xcc: arm-linux-gnueabi-gcc,        xemu_pkg: qemu-system-arm,    xemu: qemu-arm-static,     os: ubuntu-latest, },
          { name: 'AARCH64',         xcc_pkg: gcc-aarch64-linux-gnu,        xcc: aarch64-linux-gnu-gcc,        xemu_pkg: qemu-system-arm,    xemu: qemu-aarch64-static, os: ubuntu-latest, },
          { name: 'PPC64LE',         xcc_pkg: gcc-powerpc64le-linux-gnu,    xcc: powerpc64le-linux-gnu-gcc,    xemu_pkg: qemu-system-ppc,    xemu: qemu-ppc64le-static, os: ubuntu-latest, },
          { name: 'PPC64',           xcc_pkg: gcc-powerpc64-linux-gnu,      xcc: powerpc64-linux-gnu-gcc,      xemu_pkg: qemu-system-ppc,    xemu: qemu-ppc64-static,   os: ubuntu-latest, },
          { name: 'S390X',           xcc_pkg: gcc-s390x-linux-gnu,          xcc: s390x-linux-gnu-gcc,          xemu_pkg: qemu-system-s390x,  xemu: qemu-s390x-static,   os: ubuntu-latest, },
          { name: 'MIPS',            xcc_pkg: gcc-mips-linux-gnu,           xcc: mips-linux-gnu-gcc,           xemu_pkg: qemu-system-mips,   xemu: qemu-mips-static,    os: ubuntu-latest, },
          { name: 'M68K',            xcc_pkg: gcc-m68k-linux-gnu,           xcc: m68k-linux-gnu-gcc,           xemu_pkg: qemu-system-m68k,   xemu: qemu-m68k-static,    os: ubuntu-latest, },
          { name: 'RISC-V',          xcc_pkg: gcc-riscv64-linux-gnu,        xcc: riscv64-linux-gnu-gcc,        xemu_pkg: qemu-system-riscv64,xemu: qemu-riscv64-static, os: ubuntu-latest, },

          { name: 'ARM, gcc-10',     xcc_pkg: gcc-10-arm-linux-gnueabi,     xcc: arm-linux-gnueabi-gcc-10,     xemu_pkg: qemu-system-arm,   xemu: qemu-arm-static,     os: ubuntu-20.04, },
          { name: 'AARCH64, gcc-10', xcc_pkg: gcc-10-aarch64-linux-gnu,     xcc: aarch64-linux-gnu-gcc-10,     xemu_pkg: qemu-system-arm,   xemu: qemu-aarch64-static, os: ubuntu-20.04, },
          { name: 'PPC64LE, gcc-10', xcc_pkg: gcc-10-powerpc64le-linux-gnu, xcc: powerpc64le-linux-gnu-gcc-10, xemu_pkg: qemu-system-ppc,   xemu: qemu-ppc64le-static, os: ubuntu-20.04, },
          { name: 'PPC64, gcc-10',   xcc_pkg: gcc-10-powerpc64-linux-gnu,   xcc: powerpc64-linux-gnu-gcc-10,   xemu_pkg: qemu-system-ppc,   xemu: qemu-ppc64-static,   os: ubuntu-20.04, },
          { name: 'S390X, gcc-10',   xcc_pkg: gcc-10-s390x-linux-gnu,       xcc: s390x-linux-gnu-gcc-10,       xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static,   os: ubuntu-20.04, },
          { name: 'MIPS, gcc-10',    xcc_pkg: gcc-10-mips-linux-gnu,        xcc: mips-linux-gnu-gcc-10,        xemu_pkg: qemu-system-mips,  xemu: qemu-mips-static,    os: ubuntu-20.04, },

          { name: 'ARM, gcc-9',      xcc_pkg: gcc-9-arm-linux-gnueabi,      xcc: arm-linux-gnueabi-gcc-9,      xemu_pkg: qemu-system-arm,   xemu: qemu-arm-static,     os: ubuntu-20.04, },
          # SVE tests require at least gcc-10.1
          # { name: 'AARCH64, gcc-9',  xcc_pkg: gcc-9-aarch64-linux-gnu,      xcc: aarch64-linux-gnu-gcc-9,      xemu_pkg: qemu-system-arm,   xemu: qemu-aarch64-static, os: ubuntu-20.04, },
          { name: 'PPC64LE, gcc-9',  xcc_pkg: gcc-9-powerpc64le-linux-gnu,  xcc: powerpc64le-linux-gnu-gcc-9,  xemu_pkg: qemu-system-ppc,   xemu: qemu-ppc64le-static, os: ubuntu-20.04, },
          { name: 'PPC64, gcc-9',    xcc_pkg: gcc-9-powerpc64-linux-gnu,    xcc: powerpc64-linux-gnu-gcc-9,    xemu_pkg: qemu-system-ppc,   xemu: qemu-ppc64-static,   os: ubuntu-20.04, },
          { name: 'S390X, gcc-9',    xcc_pkg: gcc-9-s390x-linux-gnu,        xcc: s390x-linux-gnu-gcc-9,        xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static,   os: ubuntu-20.04, },
          { name: 'MIPS, gcc-9',     xcc_pkg: gcc-9-mips-linux-gnu,         xcc: mips-linux-gnu-gcc-9,         xemu_pkg: qemu-system-mips,  xemu: qemu-mips-static,    os: ubuntu-20.04, },

          { name: 'ARM, gcc-8',      xcc_pkg: gcc-8-arm-linux-gnueabi,      xcc: arm-linux-gnueabi-gcc-8,      xemu_pkg: qemu-system-arm,   xemu: qemu-arm-static,     os: ubuntu-20.04, },
          # aarch64-linux-gnu-gcc-8 linker has an issue for LDFLAGS="-static" 
          # { name: 'AARCH64, gcc-8',  xcc_pkg: gcc-8-aarch64-linux-gnu,      xcc: aarch64-linux-gnu-gcc-8,      xemu_pkg: qemu-system-arm,   xemu: qemu-aarch64-static, os: ubuntu-20.04, },
          { name: 'PPC64LE, gcc-8',  xcc_pkg: gcc-8-powerpc64le-linux-gnu,  xcc: powerpc64le-linux-gnu-gcc-8,  xemu_pkg: qemu-system-ppc,   xemu: qemu-ppc64le-static, os: ubuntu-20.04, },
          { name: 'PPC64, gcc-8',    xcc_pkg: gcc-8-powerpc64-linux-gnu,    xcc: powerpc64-linux-gnu-gcc-8,    xemu_pkg: qemu-system-ppc,   xemu: qemu-ppc64-static,   os: ubuntu-20.04, },
          { name: 'S390X, gcc-8',    xcc_pkg: gcc-8-s390x-linux-gnu,        xcc: s390x-linux-gnu-gcc-8,        xemu_pkg: qemu-system-s390x, xemu: qemu-s390x-static,   os: ubuntu-20.04, },
          # ubuntu-20.04 fails to retrieve gcc-8-mips-linux-gnu for some reason.
          # { name: 'MIPS, gcc-8',   xcc_pkg: gcc-8-mips-linux-gnu,         xcc: mips-linux-gnu-gcc-8,         xemu_pkg: qemu-system-mips,  xemu: qemu-mips-static,    os: ubuntu-20.04, },
        ]
    env:                        # Set environment variables
      XCC: ${{ matrix.xcc }}
      XEMU: ${{ matrix.xemu }}
      MOREFLAGS: -Werror
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
    - name: apt update & install (1)
      run: |
        sudo apt-get update
        sudo apt-get install gcc-multilib g++-multilib qemu-utils qemu-user-static
    - name: Environment info (1)
      run: |
        echo && apt-cache search "^gcc-" | grep "linux" | sort
    - name: apt update & install (2)
      run: |
        sudo apt-get install ${{ matrix.xcc_pkg }} ${{ matrix.xemu_pkg }}
    - name: Environment info (2)
      run: |
        echo && which $XCC
        echo && $XCC --version
        echo && $XCC -v  # Show built-in specs
        echo && which $XEMU
        echo && $XEMU --version
    - name: ARM (XXH_VECTOR=[ scalar, NEON ])
      if: ${{ startsWith(matrix.name, 'ARM') }}
      run: |
        CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_NEON" CFLAGS="-O3 -march=armv7-a -fPIC -mfloat-abi=softfp -mfpu=neon-vfpv4" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
    - name: AARCH64 (XXH_VECTOR=[ scalar, NEON, SVE ])
      if: ${{ startsWith(matrix.name, 'AARCH64') }}
      run: |
        CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_NEON" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=off,sve512=off,sve1024=off,sve2048=off" make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=off,sve1024=off,sve2048=off" make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=on,sve1024=off,sve2048=off" make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=on,sve1024=on,sve2048=off" make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_SVE" LDFLAGS="-static" CC="$XCC -march=armv8.2-a+sve" RUN_ENV="$XEMU -cpu max,sve128=on,sve256=on,sve512=on,sve1024=on,sve2048=on" make clean check
    - name: PPC64(LE) (XXH_VECTOR=[ scalar, VSX ])
      if: ${{ startsWith(matrix.name, 'PPC64') }}
      run: |
        CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
        CPPFLAGS="-DXXH_VECTOR=XXH_VSX" CFLAGS="-O3 -maltivec -mvsx -mpower8-vector -mcpu=power8" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
    - name: S390X (XXH_VECTOR=[ scalar, VSX ])
      if: ${{ startsWith(matrix.name, 'S390X') }}
      run: |
        CPPFLAGS="-DXXH_VECTOR=XXH_SCALAR" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
        CPPFLAGS=-DXXH_VECTOR=XXH_VSX CFLAGS="-O3 -march=arch11 -mzvector" LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
    - name: MIPS-M68K-RISCV (XXH_VECTOR=[ scalar ])
      if: ${{ startsWith(matrix.name, 'MIPS') || startsWith(matrix.name, 'M68K') || startsWith(matrix.name, 'RISC-V') }}
      run: |
        LDFLAGS="-static" CC=$XCC RUN_ENV=$XEMU make clean check
  # macOS, { 11 }

  macos-general:
    name: ${{ matrix.system.os }}
    runs-on: ${{ matrix.system.os }}
    strategy:
      fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
      matrix:
        system: [
          { os: macos-11    },
          { os: macos-12    },
        ]
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

    - name: Environment info
      run: |
        echo && clang --version
        echo && sysctl -a | grep machdep.cpu   # cpuinfo
    - name: make
      run: |
        CFLAGS="-Werror" make clean default
    - name: make test
      run: |
        # test scenario where "stdout" is not the console
        make clean test MOREFLAGS='-Werror' | tee
  # Windows, { VC++2022, VC++2019, VC++2017 } x { x64, Win32, ARM, ARM64 }
  #
  # - Default shell for Windows environment is PowerShell Core.
  #   https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
  #
  # - "windows-2022" uses Visual Studio 2022.
  #   https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022
  #
  # - "windows-2019" uses Visual Studio 2019.
  #   https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019

  windows-visualc-general:
    name: ${{ matrix.system.vc }}, ${{ matrix.arch }}
    runs-on: ${{ matrix.system.os }}   # Runs-on foreach value of strategy.matrix.system.os
    strategy:
      fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
      matrix:
        system: [
          { os: windows-2022, vc: "VC++ 2022", clangcl: 'false', }, # CMake failed to configure clang-cl with VC++2022.
          { os: windows-2019, vc: "VC++ 2019", clangcl: 'true',  },
        ]
        arch: [ x64, Win32, ARM, ARM64 ]
    steps:
    - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

    - name: Build ${{ matrix.system.os }}, ${{ matrix.arch }}
      run: |
        cd cmake_unofficial
        mkdir build
        cd build
        cmake .. -DCMAKE_BUILD_TYPE=Release -A ${{ matrix.arch }} -DXXHASH_C_FLAGS="/WX" 
        cmake --build . --config Release
    - name: Test
      # Run benchmark for testing only if target arch is x64 or Win32.
      if: ${{ matrix.arch == 'x64' || matrix.arch == 'Win32' }}
      run: |
        .\cmake_unofficial\build\Release\xxhsum.exe -bi1
    - name: Build ${{ matrix.system.os }}, clang-cl, ${{ matrix.arch }}
      if: ${{ matrix.system.clangcl == 'true' }}
      run: |
        cd cmake_unofficial
        mkdir build-clang-cl
        cd build-clang-cl
        cmake .. -DCMAKE_BUILD_TYPE=Release -A x64 -DCMAKE_GENERATOR_TOOLSET=ClangCL
        cmake --build . --config Release
    - name: Test (clang-cl)
      # Run benchmark for testing only if target arch is x64 or Win32.
      if: ${{ matrix.system.clangcl == 'true' && ( matrix.arch == 'x64' || matrix.arch == 'Win32' ) }}
      run: |
        .\cmake_unofficial\build-clang-cl\Release\xxhsum.exe -bi1
  # Windows, { mingw64, mingw32 }
  #
  # - Shell for msys2 is sh (msys2).  defaults.run.shell is for this setting.
  #
  # https://github.com/msys2/MINGW-packages/blob/master/.github/workflows/main.yml
  # https://github.com/actions/starter-workflows/issues/95

  windows-msys2-general:
    name: Windows ${{ matrix.msystem }}
    runs-on: windows-latest
    strategy:
      fail-fast: false  # 'false' means Don't stop matrix workflows even if some matrix failed.
      matrix:
        include: [
          { msystem: mingw64, toolchain: mingw-w64-x86_64-toolchain },
          { msystem: mingw32, toolchain: mingw-w64-i686-toolchain },
        ]
    defaults:
      run:
        shell: msys2 {0}
    steps:
      - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
      - uses: msys2/setup-msys2@7efe20baefed56359985e327d329042cde2434ff # v2
        with:
          msystem: MSYS
          install: mingw-w64-i686-make ${{ matrix.toolchain }}
          update: true

      - name: Update
        run: |
          pacman --noconfirm -Suuy
          pacman --noconfirm -Suu
      - name: mingw64
        if: ${{ matrix.msystem == 'mingw64' }}
        run: |
          PATH=/mingw64/bin:$PATH /mingw32/bin/mingw32-make clean test MOREFLAGS=-Werror
          PATH=/mingw64/bin:$PATH /mingw32/bin/mingw32-make -C tests/bench
          # Abort if result of "file ./xxhsum.exe" doesn't contain 'x86-64'.
          # Expected output is "./xxhsum.exe: PE32+ executable (console) x86-64, for MS Windows" 
          file ./xxhsum.exe | grep -q 'x86-64' || $(exit 1)
          ./xxhsum.exe --version
      - name: mingw32
        if: ${{ matrix.msystem == 'mingw32' }}
        run: |
          PATH=/mingw32/bin:$PATH /mingw32/bin/mingw32-make.exe clean test MOREFLAGS=-Werror
          PATH=/mingw32/bin:$PATH /mingw32/bin/mingw32-make.exe -C tests/bench
          # Abort if result of "file ./xxhsum.exe" doesn't contain '80386'.
          # Expected output is "./xxhsum.exe: PE32 executable (console) Intel 80386, for MS Windows" 
          file ./xxhsum.exe | grep -q '80386' || $(exit 1)
          ./xxhsum.exe --version
#4

Updated by Flole Systems over 1 year ago

First of all stop demanding, do it yourself, second of all stop posting about stuff you clearly don't understand.

#5

Updated by saen acro over 1 year ago

If I do it will you merge it, or will review it for months as last PR?

#6

Updated by Flole Systems over 1 year ago

If it's good I will merge it. Then I will also have the necessary tests for the other PR so I can merge that aswell.

#7

Updated by Oliver Schinagl over 1 year ago

So first off, thanks for being so kind and condescending in your post. But the MR was open for 3 or 4 weeks, so it would have been helpful to actually comment on the MR and help, rather then complain.

I actually went through quite some trouble to figure out how to solve it, and I actually did compilations on 32 bit architectures (but not enough it seems). I used debian-stable-slim as well as alpine-stable, both in x86-64, x86, arch64 and arm32v7.

As an embedded developer and user, I do actually care.

Having said that. Yes, it's 20 or so more years, but even debian is migrating and fixing this shit. But what's worse, it's causing problems today already on modern systems, though you would have known this if you read the actual commit message. So my attempt to fix it, was to fix it for all platforms obviously.

Now, let me look in what you wrote here, and see if we can fix it properly for all past and future platforms and get this resolved. The more I think about it, the more I suspect we have to do some configure magic and detect the proper with/flags, as the provided defines (_TIME_BITS) may not be available in older architectures.

Btw, time_t is NOT 32bits anymore. That's the whole issue. OLD systems have time_t == 32 bits (apparently) but NEW systems expect time_t, or allow time_t to be 64 bits.

#8

Updated by saen acro over 1 year ago

bot say:

•  Use a standard function like strftime to convert time_t to a string representation
https://stackoverflow.com/questions/14361651/is-there-any-way-to-get-64-bit-time-t-in-32-bit-programs-in-linux. 
This way, you don't have to worry about the size and format of time_t, as long as it can represent the time you want.

•  Cast time_t to a larger integer type like int64_t or unsigned long long and use the appropriate format specifier like %lld or %llu to print it
https://stackoverflow.com/questions/2467418/portable-way-to-deal-with-64-32-bit-time-t. 
This will ensure that you can handle both 32-bit and 64-bit time_t values, but you may lose some precision or portability.

•  Define a macro or a typedef for time_t and use conditional compilation to choose the correct format specifier depending on the platform
https://stackoverflow.com/questions/2467418/portable-way-to-deal-with-64-32-bit-time-t. 
This will allow you to customize your code for different platforms, but you may have to maintain multiple versions of your code.

•  In Kernel 5.6 there is new *time64 syscalls that support 64-bit time_t on 32-bit architectures https://lkml.org/lkml/2020/1/29/355?anz=web

•  Use a platform-specific option or flag to force the use of 32-bit or 64-bit time_t, such as _USE_32BIT_TIME_T for MSVC or -D_FILE_OFFSET_BITS=64 for glibc 
https://en.wikipedia.org/wiki/Year_2038_problem https://stackoverflow.com/questions/70292503/do-i-have-to-re-compile-glibc-2-34-itself-for-full-64-bit-time-t-support-for-32. 
This will override the default behavior of your C library, but you may encounter compatibility issues with other libraries or programs.

•  For BSD systems, the situation is similar, but there may be some differences in the C library implementation and the available options. For example, 
FreeBSD uses 64-bit time_t for all 32-bit and 64-bit architectures except 32-bit i386, which uses signed 32-bit time_t instead .

#9

Updated by Oliver Schinagl over 1 year ago

TVHeadend already does some of this, the problem is, it has to work for all architectures old and new, for many software versions, old and new.

E.g. I found out, that _TIME_BITS=64 works great on newer glibc/gcc combo's, but Ubuntu 16.04 breaks. Yeah, I know, it's 7 years old, but we shouldn't break stuff if we can avoid it.

And testing is super slow, the CI isn't helpful right now (it only checks all archs on master, not on individual MR's).

And right now, I just try to avoid fixing the entire tvheadend code base with portable functions (that may or may not be available in 32bit ubuntu 16.04 for example).

The main/only issue i'm trying to resolve right now, is that PRItime_t is using the correct type format, because even that, isn't as simple and dry as using if WORDSIZE=64 = %ld; if WORDSIZE=32 = %lld (because some modern systems Do have time64 on 32 bit architectures, but not all).

I hoped my (seemingly logical) solution, by actually just compiling two snippets would fix that, but it seems like `-Werror` isn't working as intended (on debian at least, or in the CI at least). So I'm looking into that now.

#10

Updated by Oliver Schinagl over 1 year ago

With #1551 it seems to have been fixed, so but we first want the pipeline to run for all archs to avoid this in the future.

#11

Updated by Oliver Schinagl over 1 year ago

I think we can close this issue now, the issue has been resolved on master.

#12

Updated by Flole Systems over 1 year ago

  • Status changed from New to Fixed

Also available in: Atom PDF