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

error: memcpy(): too few arguments provided to function-like macro invocation #8994

Closed
ryandesign opened this issue Mar 29, 2024 · 4 comments · Fixed by #8999 or #9000
Closed

error: memcpy(): too few arguments provided to function-like macro invocation #8994

ryandesign opened this issue Mar 29, 2024 · 4 comments · Fixed by #8999 or #9000
Labels
bug component-tls13 size-s Estimated task size: small (~2d)

Comments

@ryandesign
Copy link

ryandesign commented Mar 29, 2024

Summary

mbedtls 3.6.0 fails to build on macOS 10.12 and earlier due to wrong number of arguments to memcpy, because memcpy() is a function-like macro there.

System information

Mbed TLS version (number or commit id): 3.6.0
Operating system and version: macOS 10.12
Configuration (if not default, please attach mbedtls_config.h):
Compiler and options (if you used a pre-built binary, please indicate how you obtained it): from Xcode 9.2

$ /usr/bin/clang --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Additional environment information:

Expected behavior

successful build

Actual behavior

https://build.macports.org/builders/ports-10.12_x86_64-builder/builds/266113/steps/install-port/logs/stdio

[ 82%] Building C object library/CMakeFiles/mbedtls_static.dir/ssl_tls13_generic.c.o
cd /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/build/library && /usr/bin/clang  -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/include -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/library -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/build/library -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/3rdparty/everest/include -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/3rdparty/p256-m -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/3rdparty/p256-m/p256-m -pipe -Os -DNDEBUG -I/opt/local/include -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wmissing-declarations -Wmissing-prototypes -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code -std=c99 -arch x86_64 -mmacosx-version-min=10.12 -MD -MT library/CMakeFiles/mbedtls_static.dir/ssl_tls13_generic.c.o -MF CMakeFiles/mbedtls_static.dir/ssl_tls13_generic.c.o.d -o CMakeFiles/mbedtls_static.dir/ssl_tls13_generic.c.o -c /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/library/ssl_tls13_generic.c
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/library/ssl_tls13_generic.c:196:79: error: too few arguments provided to function-like macro invocation
        memcpy(verify_buffer + idx, MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN(client_cv));
                                                                              ^
/usr/include/secure/_string.h:64:9: note: macro 'memcpy' defined here
#define memcpy(dest, src, len)                                  \
        ^
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/library/ssl_tls13_generic.c:196:9: warning: expression result unused [-Wunused-value]
        memcpy(verify_buffer + idx, MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN(client_cv));
        ^~~~~~
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/library/ssl_tls13_generic.c:199:79: error: too few arguments provided to function-like macro invocation
        memcpy(verify_buffer + idx, MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN(server_cv));
                                                                              ^
/usr/include/secure/_string.h:64:9: note: macro 'memcpy' defined here
#define memcpy(dest, src, len)                                  \
        ^
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_mbedtls3/mbedtls3/work/mbedtls-3.6.0/library/ssl_tls13_generic.c:199:9: warning: expression result unused [-Wunused-value]
        memcpy(verify_buffer + idx, MBEDTLS_SSL_TLS1_3_LBL_WITH_LEN(server_cv));
        ^~~~~~
2 warnings and 2 errors generated.

Steps to reproduce

Build mbedtls 3.6.0 on macOS 10.12 or earlier

Additional information

Here is how a similar bug was fixed in another project:

https://redmine.lighttpd.net/issues/2772

@barracuda156
Copy link

Same issue on PowerPC, both with gcc-4.2 and gcc13: https://trac.macports.org/ticket/69624

@ryandesign
Copy link
Author

As I already said, "fails to build on macOS 10.12 and earlier". All PowerPC Macs are obviously included in that.

@barracuda156
Copy link

As I already said, "fails to build on macOS 10.12 and earlier". All PowerPC Macs are obviously included in that.

Fair enough, it was just not yet clear at that moment (for me at least) that the cause of the error are system headers, and we do have instances where something gonna build fine on PowerPC while failing on corresponding Intel systems, due to different compilers and C++ runtime.

@tom-cosgrove-arm tom-cosgrove-arm changed the title error: too few arguments provided to function-like macro invocation error: memcpy(): too few arguments provided to function-like macro invocation Apr 1, 2024
tom-cosgrove-arm added a commit to tom-cosgrove-arm/mbedtls that referenced this issue Apr 2, 2024
tom-cosgrove-arm added a commit to tom-cosgrove-arm/mbedtls that referenced this issue Apr 2, 2024
tom-cosgrove-arm added a commit to tom-cosgrove-arm/mbedtls that referenced this issue Apr 2, 2024
tom-cosgrove-arm added a commit to tom-cosgrove-arm/mbedtls that referenced this issue Apr 2, 2024
@tom-cosgrove-arm tom-cosgrove-arm added bug size-s Estimated task size: small (~2d) component-tls13 labels Apr 2, 2024
@barracuda156
Copy link

It builds now for me, thank you for fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-tls13 size-s Estimated task size: small (~2d)
Projects
None yet
3 participants