Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freebsd: Redefinition of RSIZE_MAX #78

Open
1480c1 opened this issue Oct 18, 2024 · 0 comments
Open

Freebsd: Redefinition of RSIZE_MAX #78

1480c1 opened this issue Oct 18, 2024 · 0 comments

Comments

@1480c1
Copy link

1480c1 commented Oct 18, 2024

Hi, based on compilation logs of https://gitlab.com/AOMediaCodec/SVT-AV1/-/jobs/8127838199, freebsd defines RSIZE_MAX on their own.

[5/270] Building C object CMakeFiles/safestringlib.dir/third_party/safestringlib/strncpy_s.c.o
FAILED: CMakeFiles/safestringlib.dir/third_party/safestringlib/strncpy_s.c.o 
/usr/lib/ccache/clang --target=x86_64-unknown-freebsd14.0 --sysroot=/opt/cross-freebsd -DARCH_X86_64=1 -DEN_AVX512_SUPPORT=1 -DEXCLUDE_HASH=0 -DHAVE_BUILTIN_EXPECT=1 -DHAVE_ELF_AUX_INFO=1 -DHAVE_VALGRIND_H=0 -DREPRODUCIBLE_BUILDS=1 -DSAFECLIB_STR_NULL_SLACK=1 -I/builds/AOMediaCodec/SVT-AV1/. -Wall -Wextra -Wformat -Wformat-security -Werror -Wshadow -pipe -fstack-protector-strong -mno-avx -g -std=gnu99 -flto=thin -fPIC -fvisibility=hidden -MD -MT CMakeFiles/safestringlib.dir/third_party/safestringlib/strncpy_s.c.o -MF CMakeFiles/safestringlib.dir/third_party/safestringlib/strncpy_s.c.o.d -o CMakeFiles/safestringlib.dir/third_party/safestringlib/strncpy_s.c.o -c /builds/AOMediaCodec/SVT-AV1/third_party/safestringlib/strncpy_s.c
In file included from /builds/AOMediaCodec/SVT-AV1/third_party/safestringlib/strncpy_s.c:7:
In file included from /builds/AOMediaCodec/SVT-AV1/third_party/safestringlib/safeclib_private.h:69:
/builds/AOMediaCodec/SVT-AV1/third_party/safestringlib/safe_lib.h:40:9: error: 'RSIZE_MAX' macro redefined [-Werror,-Wmacro-redefined]
#define RSIZE_MAX (256UL << 20) /* 256MB */
        ^
/opt/cross-freebsd/usr/include/stdint.h:72:9: note: previous definition is here
#define RSIZE_MAX (SIZE_MAX >> 1)
        ^

To reproduce:

$ docker run --rm -it registry.gitlab.com/aomediacodec/aom-testing/ubuntu2004-bsd
# git clone https://github.com/intel/safestringlib.git
# cmake -GNinja -S safestringlib/ -B build --toolchain /opt/cross-freebsd/toolchain.cmake -DCMAKE_BUILD_TYPE=Release
# ninja -C build

As a note, you can't compile the unit tests as there is the issue that freebsd already has a memset_s() with a different signature

In file included from /safestringlib/unittests/test_memcmp16_s.c:13:
/safestringlib/include/safe_mem_lib.h:75:16: error: conflicting types for 'memset_s'
extern errno_t memset_s(void *dest, rsize_t dmax, uint8_t value);
               ^
/opt/cross-freebsd/usr/include/string.h:169:9: note: previous declaration is here
errno_t memset_s(void *, rsize_t, int, rsize_t);
        ^
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

No branches or pull requests

1 participant