Skip to content

Commit f9dc978

Browse files
committed
Fix kafka compiling problem on FreeBSD.
1 parent f20375d commit f9dc978

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ jobs:
6262
copyback: false
6363
prepare: |
6464
pkg update -f
65-
pkg install -y cmake gmake gcc pkgconf openssl
65+
pkg install -y cmake gmake gcc pkgconf openssl devel/googletest
66+
pkg install -y snappy zstd liblz4
6667
run: |
6768
freebsd-version
68-
gmake
69-
gmake tutorial
69+
gmake KAFKA=y
70+
gmake check KAFKA=y
71+
gmake tutorial KAFKA=y

src/protocol/kafka_parser.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Authors: Wang Zhulei ([email protected])
1717
*/
1818

19+
#include <sys/uio.h>
1920
#include <arpa/inet.h>
2021
#include <stdlib.h>
2122
#include <stdio.h>

src/protocol/kafka_parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef _KAFKA_PARSER_H_
2020
#define _KAFKA_PARSER_H_
2121

22-
#include <arpa/inet.h>
22+
#include <sys/uio.h>
2323
#include <stddef.h>
2424
#include <stdint.h>
2525
#include "list.h"

tutorial/CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,26 @@ endif()
107107
if (KAFKA STREQUAL "y")
108108
add_executable("kafka_cli" "tutorial-13-kafka_cli.cc")
109109
find_package(ZLIB REQUIRED)
110+
find_path(SNAPPY_INCLUDE_PATH NAMES snappy.h)
110111
find_library(SNAPPY_LIB NAMES snappy)
111-
find_library(LZ4_LIB NAMES lz4)
112+
if ((NOT SNAPPY_INCLUDE_PATH) OR (NOT SNAPPY_LIB))
113+
message(FATAL_ERROR "Fail to find snappy with KAFKA=y")
114+
endif ()
115+
include_directories(${SNAPPY_INCLUDE_PATH})
116+
117+
find_path(ZSTD_INCLUDE_PATH NAMES zstd.h)
112118
find_library(ZSTD_LIB NAMES zstd)
119+
if ((NOT ZSTD_INCLUDE_PATH) OR (NOT ZSTD_LIB))
120+
message(FATAL_ERROR "Fail to find zstd with KAFKA=y")
121+
endif ()
122+
include_directories(${ZSTD_INCLUDE_PATH})
123+
124+
find_path(LZ4_INCLUDE_PATH NAMES lz4.h)
125+
find_library(LZ4_LIB NAMES lz4)
126+
if ((NOT LZ4_INCLUDE_PATH) OR (NOT LZ4_LIB))
127+
message(FATAL_ERROR "Fail to find lz4 with KAFKA=y")
128+
endif ()
129+
include_directories(${LZ4_INCLUDE_PATH})
113130
target_link_libraries("kafka_cli" ${WFKAFKA_LIB} ${LIB} ZLIB::ZLIB ${SNAPPY_LIB} ${LZ4_LIB} ${ZSTD_LIB})
114131
endif ()
115132

0 commit comments

Comments
 (0)