Skip to content

fix issue with PRIu64 on some compilers, by including sys/types.h early#320

Closed
AuxLoui wants to merge 1 commit into
intel:mainfrom
AuxLoui:main
Closed

fix issue with PRIu64 on some compilers, by including sys/types.h early#320
AuxLoui wants to merge 1 commit into
intel:mainfrom
AuxLoui:main

Conversation

@AuxLoui

@AuxLoui AuxLoui commented Apr 13, 2026

Copy link
Copy Markdown

Fix for #207 (PRIu64 problem)

@thiagomacieira thiagomacieira changed the title Main fix issue with PRIu64 on some compilers, by including sys/types.h early Apr 13, 2026

@thiagomacieira thiagomacieira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback on making commits and making PRs (general, not about this one in particular):

  • the commit message should explain why you're making a change. If you have an error message, it's often useful to include it.
  • you don't need to explain the what you're changing, because we can read diffs
  • the first line of the commit is the "subject" and should be a summary, which we can see in one-line logs (e.g. https://github.com/intel/tinycbor/commits/main/)
  • some projects require that you include a signed-off-by footer. We don't insist for TinyCBOR, but I would prefer it is there.
  • each commit should be a single, logical/semantic change, which doesn't break the build
  • the GitHub PR page is a summary of all commits in the change. If there's only one commit, then just copy the commit message and body (GitHub will do it for you).

Comment thread src/cborpretty.c
Comment on lines +32 to +33
// Include sys/types.h before inttypes.h to work around issue with
// certain versions of GCC and newlib which causes omission of PRIx64

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment wasn't necessary. But I'll allow it.

However, is this high enough? Imagine something changes in the headers above and breaks? Especially cbor.h, which includes stdint.h.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for late reply. Your comment did have me give an other thought about this problem, and came to the conclusion that instead of implementing a work around for a specific compiler instead you should use a working compiler. So instead of using this fix/workaround I changed my docker image used to compile my program in CI/CD pipeline. So will close this pull request, if other have this problem this is my used dockerbuild definition used wit gitlab.

FROM ubuntu:26.04

ENV DEBIAN_FRONTEND=noninteractive

ARG ARM_GNU_TOOLCHAIN_VERSION=15.2.Rel1
ARG ARM_GNU_TOOLCHAIN_ARCHIVE=arm-gnu-toolchain-15.2.Rel1-x86_64-arm-none-eabi.tar.xz
ARG ARM_GNU_TOOLCHAIN_DIR=arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi
ARG ARM_GNU_TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GNU_TOOLCHAIN_VERSION}/binrel/${ARM_GNU_TOOLCHAIN_ARCHIVE}
ARG PICO_SDK_VERSION=2.2.0

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    ca-certificates \
    cmake \
    curl \
    git \
    ninja-build \
    python3 \
    xz-utils && \
    rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/toolchains /opt/pico-sdk && \
    curl -fsSL "${ARM_GNU_TOOLCHAIN_URL}" -o "/tmp/${ARM_GNU_TOOLCHAIN_ARCHIVE}" && \
    tar -xJf "/tmp/${ARM_GNU_TOOLCHAIN_ARCHIVE}" -C /opt/toolchains && \
    rm -f "/tmp/${ARM_GNU_TOOLCHAIN_ARCHIVE}" && \
    test -x "/opt/toolchains/${ARM_GNU_TOOLCHAIN_DIR}/bin/arm-none-eabi-gcc" && \
    git clone --branch "${PICO_SDK_VERSION}" --depth 1 https://github.com/raspberrypi/pico-sdk.git /opt/pico-sdk && \
    git -C /opt/pico-sdk submodule update --init --recursive

ENV ARM_GNU_TOOLCHAIN_VERSION=${ARM_GNU_TOOLCHAIN_VERSION}
ENV ARM_GNU_TOOLCHAIN_PATH=/opt/toolchains/${ARM_GNU_TOOLCHAIN_DIR}
ENV PICO_SDK_VERSION=${PICO_SDK_VERSION}
ENV PICO_SDK_PATH=/opt/pico-sdk
ENV PATH=${ARM_GNU_TOOLCHAIN_PATH}/bin:${PATH}

@AuxLoui AuxLoui closed this Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants