Skip to content

Commit 02fada4

Browse files
committed
Fix compilation on latest mac versions with external libraries
Fix also Performance job on ubuntu-latest/24.04: see similar fix in 957a050. Close: #2412
1 parent 674428d commit 02fada4

File tree

3 files changed

+26
-34
lines changed

3 files changed

+26
-34
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ jobs:
7676
strategy:
7777
fail-fast: true
7878
matrix:
79-
# macOS-latest == macos-14 on **ARM64**. Also macos-15 is on arm64
80-
# There are some issues with external dependencies on macOS-14/15. Disable it for the time being
81-
os: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04", "macOS-13"]
79+
# macos-14 and 15 are on **ARM64**
80+
os: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04", "macOS-13", "macOS-14", "macOS-15"]
8281
gcrypt: ["--with-local-libgcrypt", ""]
8382
compiler: ["cc"]
8483
pcre: [""]
@@ -131,25 +130,11 @@ jobs:
131130
nBPF: ""
132131
global_context: "--disable-global-context-support"
133132
- compiler: "cc"
134-
os: macOS-13
133+
os: macOS-latest
135134
gcrypt: ""
136135
pcre: "--with-pcre2"
137136
maxminddb: "--with-maxminddb"
138-
msan: "" # Disable sanitizer on macos
139-
nBPF: ""
140-
- compiler: "cc"
141-
os: macos-14
142-
gcrypt: ""
143-
pcre: ""
144-
maxminddb: ""
145-
msan: "" # Disable sanitizer on macos
146-
nBPF: ""
147-
- compiler: "cc"
148-
os: macos-15
149-
gcrypt: ""
150-
pcre: ""
151-
maxminddb: ""
152-
msan: "" # Disable sanitizer on macos
137+
msan: ""
153138
nBPF: ""
154139
steps:
155140
- uses: actions/checkout@v4
@@ -215,18 +200,10 @@ jobs:
215200
run: |
216201
./autogen.sh --enable-option-checking=fatal --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} --enable-tls-sigs ${{ matrix.global_context}}
217202
- name: Build nDPI
218-
if: ${{ !startsWith(matrix.os, 'macos-14') && !startsWith(matrix.os, 'macos-15') }}
219203
run: |
220204
make -j all
221205
make -C example ndpiSimpleIntegration
222206
make -C rrdtool
223-
- name: Build nDPI (MacOS M1)
224-
if: startsWith(matrix.os, 'macos-14') || startsWith(matrix.os, 'macos-15')
225-
run: |
226-
make -j all
227-
make -C example ndpiSimpleIntegration
228-
# There are somes issues with librrd
229-
# make -C rrdtool
230207
- name: Print nDPI long help
231208
run: |
232209
cd ./example && ./ndpiReader -H
@@ -244,7 +221,6 @@ jobs:
244221
run: |
245222
NDPI_FORCE_PARALLEL_UTESTS=1 NDPI_SKIP_PARALLEL_BAR=1 ./tests/do.sh
246223
- name: Test nDPI [UNIT]
247-
if: ${{ !startsWith(matrix.os, 'macos-14') && !startsWith(matrix.os, 'macos-15') }}
248224
run: |
249225
./tests/do-unit.sh
250226
- name: Test nDPI [DGA]

.github/workflows/build_scheduled.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,17 @@ jobs:
7373
name: Performance (ubuntu-latest)
7474
runs-on: ubuntu-latest
7575
env:
76-
GO111MODULE: on
7776
CFLAGS: -Werror
7877
steps:
7978
- uses: actions/checkout@v4
8079
with:
8180
fetch-depth: 0
8281
- name: Install Ubuntu Prerequisites
8382
run: |
84-
sudo add-apt-repository ppa:longsleep/golang-backports
8583
sudo apt-get update
8684
sudo apt-get install libunwind-dev
8785
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison libpcap-dev parallel
88-
sudo apt-get install golang-1.16-go libgoogle-perftools-dev graphviz
86+
sudo apt-get install libgoogle-perftools-dev graphviz
8987
go install github.com/google/pprof@latest
9088
sudo ln -s ${HOME}/go/bin/pprof /usr/bin/pprof
9189
pprof -h
@@ -122,7 +120,7 @@ jobs:
122120
- name: Install Ubuntu Prerequisites
123121
run: |
124122
sudo apt-get update
125-
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison libjson-c libpcap-dev rrdtool librrd-dev parallel
123+
sudo apt-get install autoconf automake libtool pkg-config gettext flex bison libjson-c-dev libpcap-dev rrdtool librrd-dev parallel
126124
- name: Configure nDPI
127125
run: |
128126
./autogen.sh --enable-option-checking=fatal --with-thread-sanitizer

configure.ac

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,26 @@ echo "Setting API version to ${NDPI_API_VERSION}"
190190
AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "${GIT_RELEASE}", [GIT Release])
191191
AC_DEFINE_UNQUOTED(NDPI_GIT_DATE, "${GIT_DATE}", [Last GIT change])
192192

193+
NDPI_CFLAGS="-W -Wall -Wno-address-of-packed-member ${NDPI_CFLAGS}"
194+
195+
dnl> MacOS brew.sh
196+
HOMEBREW_DIR=/opt/homebrew
197+
if test -d $HOMEBREW_DIR; then
198+
# On latest macOS versions on M* archs, some (all?) libraries are not installed
199+
# "system-wide" anymore.
200+
NDPI_CFLAGS="${NDPI_CFLAGS} -I ${HOMEBREW_DIR}/include"
201+
NDPI_LDFLAGS="${NDPI_LDFLAGS} -L ${HOMEBREW_DIR}/lib"
202+
203+
# While updating NDPI_CFLAGS/NDPI_LDFLAGS is obvious, we need to update
204+
# CFLAGS/LDFLAGS as well, because only these variables are used internally by
205+
# autoconf to check for libraries.
206+
# The core reason is likely that internally in our Makefiles we use
207+
# NDPI_CFLAGS/NDPI_LDFLAGS instead of the standard CFLAGS/LDFLAGS
208+
# See: 7c19de49047a5731f3107ff17854e9afe839cc61 for details
209+
CFLAGS="${CFLAGS} -I ${HOMEBREW_DIR}/include"
210+
LDFLAGS="${LDFLAGS} -L ${HOMEBREW_DIR}/lib"
211+
fi
212+
193213
if ! test "${with_only_libndpi+set}" = set; then :
194214
dnl> used by json-c for unit tests
195215
PKG_CHECK_MODULES([JSONC], [json-c], [
@@ -226,8 +246,6 @@ AS_IF([test "x${enable_tls_sigs}" = "xyes"],[
226246
HANDLE_TLS_SIGS=""
227247
])
228248

229-
NDPI_CFLAGS="-W -Wall -Wno-address-of-packed-member ${NDPI_CFLAGS}"
230-
231249
AS_IF([test "${with_lto_and_gold_linker+set}" = set], [
232250
NDPI_CFLAGS="${NDPI_CFLAGS} -flto -fuse-ld=gold -Wno-unused-command-line-argument"
233251
NDPI_LDFLAGS="${NDPI_LDFLAGS} ${NDPI_CFLAGS}"

0 commit comments

Comments
 (0)