You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I was trying to do a vendored build of SDL3 SDL_image on Fedora Linux, dav1d was failing to build, due to posix_memalign() not being defined, despite the build system setting HAVE_POSIX_MEMALIGN; it seems the check_symbol_exists(posix_memalign "stdlib.h" HAVE_POSIX_MEMALIGN) line is finding posix_memalign(), despite posix_memalign() breaking the build. Turns out, per the Linux documentation, you need to define _POSIX_C_SOURCE to 200112L or higher for posix_memalign(). I made the following change to dav1d's CMakeLists.txt, then dav1d built successfully:
# The WIN32 part is already in the CMakeLists.txt file, it's just here to hint where my change was made# I'm not sure if checking only UNIX is correct, but it at least works for me on Fedora Linuxif(WIN32)
add_compile_definitions(
_WIN32_WINNT=0x0601
UNICODE=1
_UNICODE=1
__USE_MINGW_ANSI_STDIO=1
_CRT_DECLARE_NONSTDC_NAMES=1
)
check_symbol_exists(fseeko stdio.h STDIO_H_PROVIDES_FSEEKO)
if(STDIO_H_PROVIDES_FSEEKO)
add_compile_definitions(_FILE_OFFSET_BITS=64)
else()
add_compile_definitions(fseeko=_fseeki64 ftello=_ftelli64)
endif()
elseif(UNIX)
add_compile_definitions(
_POSIX_C_SOURCE=200112L
)
endif()
For whatever reason, dav1d successfully builds for SDL2 SDL_image, despite the SDL2 SDL_image's vendored dav1d CMakeLists.txt not defining _POSIX_C_SOURCE anywhere, maybe _POSIX_C_SOURCE is getting defined somewhere else. For the sake of strict correctness, it may be appropriate to define _POSIX_C_SOURCE for SDL2 SDL_image's vendored dav1d as well.
The text was updated successfully, but these errors were encountered:
While I was trying to do a vendored build of SDL3 SDL_image on Fedora Linux, dav1d was failing to build, due to
posix_memalign()
not being defined, despite the build system settingHAVE_POSIX_MEMALIGN
; it seems thecheck_symbol_exists(posix_memalign "stdlib.h" HAVE_POSIX_MEMALIGN)
line is findingposix_memalign()
, despiteposix_memalign()
breaking the build. Turns out, per the Linux documentation, you need to define_POSIX_C_SOURCE
to200112L
or higher forposix_memalign()
. I made the following change to dav1d's CMakeLists.txt, then dav1d built successfully:For whatever reason, dav1d successfully builds for SDL2 SDL_image, despite the SDL2 SDL_image's vendored dav1d CMakeLists.txt not defining
_POSIX_C_SOURCE
anywhere, maybe_POSIX_C_SOURCE
is getting defined somewhere else. For the sake of strict correctness, it may be appropriate to define_POSIX_C_SOURCE
for SDL2 SDL_image's vendored dav1d as well.The text was updated successfully, but these errors were encountered: