Skip to content

Commit 34468cf

Browse files
committed
fix broken build on windows
we also want to make sure we use the openssl version 3.6 and newer. Reviewed-by: Neil Horman <[email protected]> (Merged from #38)
1 parent 217e723 commit 34468cf

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

source/CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ find_package(OpenSSL REQUIRED ${OPENSSL_CONFIG_MODE})
113113
add_library(perf perflib/perfhelper.c perflib/perfsslhelper.c perflib/threads.c
114114
perflib/time.c)
115115

116-
if (WIN32)
116+
if(WIN32)
117117
target_sources(perf PRIVATE perflib/getopt.c perflib/basename.c perflib/err.c)
118118
endif()
119119

@@ -127,8 +127,15 @@ if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3 )
127127
add_executable(providerdoall providerdoall.c)
128128
target_link_libraries(providerdoall PRIVATE perf)
129129

130+
endif()
131+
132+
if( OPENSSL_VERSION VERSION_GREATER_EQUAL 3.6 )
130133
add_executable(ssl_poll_perf ssl_poll_perf.c)
131-
target_link_libraries(ssl_poll_perf PRIVATE perf)
134+
if(WIN32)
135+
target_link_libraries(ssl_poll_perf PUBLIC wsock32 ws2_32 PRIVATE perf)
136+
else()
137+
target_link_libraries(ssl_poll_perf PRIVATE perf)
138+
endif()
132139
endif()
133140

134141
add_executable(randbytes randbytes.c)

source/perflib/err.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
*/
99

1010
#include <stdarg.h>
11+
#include <stdio.h>
12+
#include <stdlib.h>
1113

1214
const char *progname;
1315

14-
static void
16+
void
1517
vwarnx(const char *fmt, va_list ap)
1618
{
1719
if (progname != NULL)
@@ -20,7 +22,7 @@ vwarnx(const char *fmt, va_list ap)
2022
putc('\n', stderr);
2123
}
2224

23-
static void
25+
void
2426
errx(int status, const char *fmt, ...)
2527
{
2628
va_list ap;
@@ -31,7 +33,7 @@ errx(int status, const char *fmt, ...)
3133
exit(status);
3234
}
3335

34-
static void
36+
void
3537
warnx(const char *fmt, ...)
3638
{
3739
va_list ap;

source/perflib/err.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10-
#ifndef OSSL_PERFLIB_GETOPT_H
11-
# define OSSL_PERFLIB_GETOPT_H
10+
#ifndef OSSL_PERFLIB_ERR_H
11+
# define OSSL_PERFLIB_ERR_H
1212
# pragma once
1313

1414
#include <stdarg.h>

source/ssl_poll_perf.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
/* Include the appropriate header file for SOCK_STREAM */
3333
#ifdef _WIN32 /* Windows */
3434
# include <winsock2.h>
35-
# include "perflib/basename.h"
36-
# include "perflib/err.h"
3735
#else /* Linux/Unix */
3836
# include <err.h>
3937
# include <sys/socket.h>
@@ -55,6 +53,8 @@
5553
# include <unistd.h>
5654
#else
5755
# include <windows.h>
56+
# include "perflib/basename.h"
57+
# include "perflib/err.h"
5858
# include "perflib/getopt.h"
5959
#endif /* _WIN32 */
6060

@@ -668,7 +668,7 @@ new_txt_full_request(const char *url, const char *fill_pattern, size_t body_len)
668668
return rtf;
669669
}
670670

671-
static __attribute__((unused)) const char *
671+
static const char *
672672
pe_type_to_name(const struct poll_event *pe)
673673
{
674674
static const char *names[] = {
@@ -950,7 +950,7 @@ pe_disable_write(struct poll_event *pe)
950950
* or error is permanent. In case of permanent error the
951951
* poll event pe should be removed from poll manager and destroyed.
952952
*/
953-
static __attribute__((unused)) const char *
953+
static const char *
954954
err_str_n(unsigned long e, char *buf, size_t buf_sz)
955955
{
956956
ERR_error_string_n(e, buf, buf_sz);
@@ -1003,7 +1003,7 @@ handle_ssl_error(struct poll_event *pe, int rc, const char *caller)
10031003
return rv;
10041004
}
10051005

1006-
static __attribute__((unused)) const char *
1006+
static const char *
10071007
stream_state_str(int stream_state)
10081008
{
10091009
const char *rv;

0 commit comments

Comments
 (0)