Skip to content

v6.3.0 FetchContent with arm-none-eabi-gcc does not work #204

@mathiasplans

Description

@mathiasplans

Building for STM32F103C8 with arm-none-eabi-gcc toolchain.

I have the following in my CMake file:

# Fetches the mpaland/printf library and sets up variables for its use

set(BUILD_SHARED_LIBS OFF)
set(SUPPORT_EXPONENTIAL_SPECIFIERS OFF)
set(SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS OFF)
set(SUPPORT_LONG_LONG OFF)
set(USE_DOUBLE_INTERNALLY OFF)
set(SUPPORT_WRITEBACK_SPECIFIER OFF)
set(ALIAS_STANDARD_FUNCTION_NAMES "SOFT")

add_compile_definitions(-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_SOFT)

include(FetchContent)
FetchContent_Declare(
  printf_library
  GIT_REPOSITORY https://github.com/eyalroz/printf.git
  GIT_TAG        v6.3.0
)
FetchContent_MakeAvailable(printf_library)

When I build, I get lots of errors:

[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:195:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   195 | #if   (SHRT_MAX   == 32767LL)
[build]       |                      ^~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:207:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   207 | #if   (SHRT_MAX   == 2147483647LL)
[build]       |                      ^~~~~~~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:209:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   209 | #elif (INT_MAX    == 2147483647LL)
[build]       |                      ^~~~~~~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:219:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   219 | #if   (SHRT_MAX   == 9223372036854775807LL)
[build]       |                      ^~~~~~~~~~~~~~~~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:221:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   221 | #elif (INT_MAX    == 9223372036854775807LL)
[build]       |                      ^~~~~~~~~~~~~~~~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:223:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   223 | #elif (LONG_MAX   == 9223372036854775807LL)
[build]       |                      ^~~~~~~~~~~~~~~~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:225:22: warning: use of C99 long long integer constant [-Wlong-long]
[build]   225 | #elif (LLONG_MAX  == 9223372036854775807LL)
[build]       |                      ^~~~~~~~~~~~~~~~~~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:228:2: error: #error "No basic integer type has a size of 64 bits exactly"
[build]   228 | #error "No basic integer type has a size of 64 bits exactly"
[build]       |  ^~~~~
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c: In function 'format_string_loop':
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:1313:78: error: 'FLAGS_INT64' undeclared (first use in this function); did you mean 'FLAGS_INT8'?
[build]  1313 |             if (*format == '4') { ADVANCE_IN_FORMAT_STRING(format); flags |= FLAGS_INT64; }
[build]       |                                                                              ^~~~~~~~~~~
[build]       |                                                                              FLAGS_INT8
[build] C:/Users/mathi/Documents/kw/boomboard/build/Debug/_deps/printf_library-src/src/printf/printf.c:1313:78: note: each undeclared identifier is reported only once for each function it appears in

This does not happen with v6.2.0. The errors are happening in a code that is for SUPPORT_MSVC_STYLE_INTEGER_SPECIFIERS, however, I have disabled it in my options.

Also, I have to put this line in my CMake for the aliasing to work:

add_compile_definitions(-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_SOFT)

I expected

set(ALIAS_STANDARD_FUNCTION_NAMES "SOFT")

to do it for me. The options are working, since I see that the printf_config.h has changed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingregressionA feature or aspect which worked properly in the past, no longer doesresolved-on-developA changeset fixing this issue has been commiutted to the development branch

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions