From 4ec0459fd3e6c3d1ef446337671b6da5bb30d006 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 17 May 2023 00:20:44 +0200 Subject: [PATCH] crowdsec: fix compilation with musl 1.2.4 _LARGEFILE64_SOURCE has to be defined in the source, or CFLAGS can be used to pass -D_LARGEFILE64_SOURCE to allow to keep using LFS64 definitions. Fixes errors in the form of: Building targets github.com/mattn/go-sqlite3 sqlite3-binding.c:35901:42: error: 'pread64' undeclared here (not in a function); did you mean 'pread'? 35901 | { "pread64", (sqlite3_syscall_ptr)pread64, 0 }, | ^~~~~~~ | pread sqlite3-binding.c:35919:42: error: 'pwrite64' undeclared here (not in a function); did you mean 'pwrite'? 35919 | { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 }, | ^~~~~~~~ | pwrite sqlite3-binding.c: In function 'seekAndRead': sqlite3-binding.c:35905:49: error: unknown type name 'off64_t'; did you mean 'off_t'? 35905 | #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent) | ^~~~~~~ sqlite3-binding.c:38767:11: note: in expansion of macro 'osPread64' 38767 | got = osPread64(id->h, pBuf, cnt, offset); | ^~~~~~~~~ sqlite3-binding.c:35905:58: error: expected ')' before 'aSyscall' 35905 | #define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent) | ~ ^~~~~~~~ sqlite3-binding.c:38767:11: note: in expansion of macro 'osPread64' 38767 | got = osPread64(id->h, pBuf, cnt, offset); | ^~~~~~~~~ sqlite3-binding.c: In function 'seekAndWriteFd': sqlite3-binding.c:35923:57: error: unknown type name 'off64_t'; did you mean 'off_t'? 35923 | #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\ | ^~~~~~~ sqlite3-binding.c:38896:17: note: in expansion of macro 'osPwrite64' 38896 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); | ^~~~~~~~~~ sqlite3-binding.c:35924:21: error: expected ')' before 'aSyscall' 35924 | aSyscall[13].pCurrent) | ^~~~~~~~ sqlite3-binding.c:38896:17: note: in expansion of macro 'osPwrite64' 38896 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); | ^~~~~~~~~~ sqlite3-binding.c:35923:21: note: to match this '(' 35923 | #define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off64_t))\ | ^ sqlite3-binding.c:38896:17: note: in expansion of macro 'osPwrite64' 38896 | do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); | ^~~~~~~~~~ make[2]: *** [Makefile:153: /home/nick/openwrt/build_dir/target-aarch64_cortex-a53_musl/crowdsec-1.4.6/.built] Error 1 make[2]: Leaving directory '/home/nick/openwrt/feeds/packages/net/crowdsec' Signed-off-by: Nick Hainke --- net/crowdsec/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/crowdsec/Makefile b/net/crowdsec/Makefile index aa939df950..2b5051eadd 100644 --- a/net/crowdsec/Makefile +++ b/net/crowdsec/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=crowdsec PKG_VERSION:=1.4.6 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/crowdsecurity/crowdsec/tar.gz/v$(PKG_VERSION)? @@ -82,6 +82,10 @@ $(call Package/crowdsec/Default/description) This package provides the source files for the program. endef +ifneq ($(CONFIG_USE_MUSL),) + TARGET_CFLAGS += -D_LARGEFILE64_SOURCE +endif + define Package/crowdsec/install $(call GoPackage/Package/Install/Bin,$(1)) -- 2.30.2