bioprinttest.c: fixed undefined reference on MinGW

When compiling OpenSSL with MinGW it appears that the use of
_set_printf_count_output function leads to undefined references. This
patch skips the test on MinGW builds.

```
12:41:40 x86_64-w64-mingw32-gcc  -Iinclude -Iapps/include  -m64 -Wall -O3 -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -DOPENSSLDIR="\"C:/Program Files (x86)/Cfengine/ssl\"" -MMD -MF test/bioprinttest-bin-bioprinttest.d.tmp -c -o test/bioprinttest-bin-bioprinttest.obj test/bioprinttest.c
12:41:40 rm -f test/bioprinttest.exe
12:41:40 ${LDCMD:-x86_64-w64-mingw32-gcc} -m64 -Wall -O3 -L.  -static-libgcc -L/var/cfengine/lib \
12:41:40 	-o test/bioprinttest.exe \
12:41:40 	test/bioprinttest-bin-bioprinttest.obj \
12:41:40 	test/libtestutil.a -lcrypto -lws2_32 -lgdi32 -lcrypt32
12:41:40 test/bioprinttest-bin-bioprinttest.obj:bioprinttest.c:(.text+0x960): undefined reference to `__imp__set_printf_count_output'
12:41:40 test/bioprinttest-bin-bioprinttest.obj:bioprinttest.c:(.text+0x966): undefined reference to `__imp__get_printf_count_output'
12:41:40 collect2: error: ld returned 1 exit status
12:41:40 Makefile:28175: recipe for target 'test/bioprinttest.exe' failed
```

Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
CLA: trivial
This commit is contained in:
Lars Erik Wik 2025-10-07 11:59:45 +02:00
parent f7feb2d937
commit 38bbc58da3
No known key found for this signature in database
GPG Key ID: 983FCD7F55D882C1
1 changed files with 7 additions and 2 deletions

View File

@ -541,7 +541,12 @@ static int test_n(int i)
ptrdiff_t t;
} n = { 0 };
#if defined(OPENSSL_SYS_WINDOWS)
#if defined(__MINGW32__)
/* _set_printf_count_output below does not appear to be available in MinGW */
TEST_note("Can't enable %%n handling for snprintf"
", skipping the checks against libc");
return 1;
#elif defined(OPENSSL_SYS_WINDOWS)
/*
* MS CRT is special and throws an exception when %n is used even
* in non-*_s versions of printf routines, and there is a special function
@ -564,7 +569,7 @@ static int test_n(int i)
}
return 1;
}
#endif /* defined(OPENSSL_SYS_WINDOWS) || defined(__OpenBSD__) */
#endif /* defined(__MINGW__) || defined(OPENSSL_SYS_WINDOWS) || defined(__OpenBSD__) */
memset(bio_buf, '@', sizeof(bio_buf));
memset(std_buf, '#', sizeof(std_buf));