AirenSoft/OvenMediaEngine

Build fails due to missing cstdint include (`error: 'uint64_t' does not name a type`)

hashworks opened this issue · 3 comments

Describe the bug
Builds on Arch Linux fails with error: 'uint64_t' does not name a type since cstdint isn't included. This wasn't a problem before, it could be that a recent gcc update introduced this?

This is fixable by including it and prepending the respective types with std:::

for f in $(grep -lRE '(uint8_t|uint64_t)'); do
	sed -i 's|^#include|#include <cstdint>\n#include|' "$f";
	sed -i 's|uint8_t|std::uint8_t|g' "$f";
	sed -i 's|uint64_t|std::uint64_t|g' "$f";
done

Note that not all files are missing the cstdint include, but often don't provide the needed std:: namespace. While it works, it is quite a dirty fix and is only used for the Arch package so it builds at all.

To Reproduce
Steps to reproduce the behavior:

# Boot Arch, f.e. using podman (or docker)
podman run -it docker.io/archlinux/archlinux:base-devel bash
# Install OME deps
pacman -Syu --noconfirm openssl libsrtp srt opus ffmpeg jemalloc pcre2 hiredis bc nasm x264 x265 libvpx fdkaac git
# Check gcc version, atm it should be 13.1.1
gcc --version
# Clone OME and change to src dir
git clone https://github.com/AirenSoft/OvenMediaEngine.git && cd OvenMediaEngine/src
# Build
DISABLE_CUSTOM_LIBRARY_PATHS=true make release

The build will then fail:

[...]
[ 70/471| 14%] [static] libovlibrary.a: C++ projects/base/ovlibrary/platform.cpp => intermediates/RELEASE/objs/base/ovlibrary/platform.o
In file included from projects/base/ovlibrary/platform.cpp:9:
projects/base/ovlibrary/platform.h:117:24: error: ‘uint64_t’ does not name a type
  117 |                 static uint64_t GetProcessId();
      |                        ^~~~~~~~
compilation terminated due to -Wfatal-errors.
make: *** [core/build_objects.mk:21: intermediates/RELEASE/objs/base/ovlibrary/platform.o] Error 1

If one applies the above fix it builds just fine.

Expected behavior
OvenMediaEngine should build with the latest gcc version without any missing type errors.

Server (please complete the following information):

  • OS: Arch Linux
  • OvenMediaEngine Version: 0.15.12, but older versions fail as well

Additional context

@hashworks
Thank you for providing detailed reproduction steps that allowed for a quick verification.
I have resolved the issue by including stdint.h since we prefer using uint8_t over std::uint8_t.
Thank you!

c2ba4a6

This issue has been resolved and included in the 0.15.13 release.