Adding support for ACLK build-configuration (#8223)
* Fixes for issues not caught at review in #8144. (#8211) * Properly scrub build environment for external dependencies. * Remove LWS from our system-level dependencies. We've decided to just always bundle it in the installer. * Add missing dependency for Docker build process. * Use static-build of LWS library created by installer (#8157) * link static lib of LWS * only use static LWS by installer * handle -lcap * fix problem on debian without lcap * fix lws check Co-authored-by: Austin S. Hemmelgarn <ahferroin7@gmail.com> Co-authored-by: Timo <6674623+underhood@users.noreply.github.com>
Andrew Moss committed
Feb 27, 2020 at 19:23 UTC
1ea0d8d0897ec2d84ff447874e2ebd6170f54287
6 files changed
+65
-68
Dockerfile
+1
-1
@@ -5,7 +5,7 @@ FROM alpine:3.9 AS build
5
# Install Dependencies
6
RUN apk add --no-cache -U alpine-sdk bash curl libuv-dev zlib-dev \
7
util-linux-dev libmnl-dev gcc make git autoconf \
8
- automake pkgconfig python logrotate openssl-dev
8
+ automake pkgconfig python logrotate openssl-dev cmake
9
10
# Pass optional ./netdata-installer.sh args with --build-arg INSTALLER_ARGS=...
11
ARG INSTALLER_ARGS=""
Makefile.am
+1
@@ -616,6 +616,7 @@ netdata_SOURCES = $(NETDATA_FILES)
616
if ENABLE_ACLK
617
netdata_LDADD = \
618
externaldeps/mosquitto/libmosquitto.a \
619
+ externaldeps/libwebsockets/libwebsockets.a \
620
$(NETDATA_COMMON_LIBS) \
621
$(NULL)
622
else
configure.ac
+56
-51
@@ -303,18 +303,6 @@ AC_CHECK_LIB(
303
[LZ4_LIBS="-llz4"]
304
)
305
306
-# -----------------------------------------------------------------------------
307
-# libwebsockets pure C library for implementing modern network protocols
308
-
309
-if test "${ACLK}" = "yes"; then
310
- AC_CHECK_LIB(
311
- [websockets],
312
- [lws_set_timer_usecs],
313
- [LWS_LIBS="-lwebsockets"]
314
- )
315
-fi
316
-
317
-
306
# -----------------------------------------------------------------------------
307
# Judy General purpose dynamic array
308
@@ -437,45 +425,6 @@ fi
425
AC_MSG_RESULT([${enable_https}])
426
AM_CONDITIONAL([ENABLE_HTTPS], [test "${enable_https}" = "yes"])
427
440
-# -----------------------------------------------------------------------------
441
-# ACLK
442
-
443
-#currenlty env var ACLK must be set to 'yes' to even consider building ACLK
444
-if test "${ACLK}" = "yes"; then
445
- AC_MSG_CHECKING([if libmosquitto static lib is present])
446
- if test -f "externaldeps/mosquitto/libmosquitto.a"; then
447
- HAVE_libmosquitto_a="yes"
448
- else
449
- HAVE_libmosquitto_a="no"
450
- fi
451
- AC_MSG_RESULT([${HAVE_libmosquitto_a}])
452
-
453
- AC_MSG_CHECKING([if netdata agent-cloud-link can be enabled])
454
- if test "${HAVE_libmosquitto_a}" = "yes" -a -n "${LWS_LIBS}"; then
455
- can_enable_aclk="yes"
456
- else
457
- can_enable_aclk="no"
458
- fi
459
- AC_MSG_RESULT([${can_enable_aclk}])
460
-
461
- test "${aclk_required}" = "yes" -a "${can_enable_aclk}" = "no" && \
462
- AC_MSG_ERROR([User required agent-cloud-link but it can't be built!])
463
-
464
- AC_MSG_CHECKING([if netdata agent-cloud-link should/will be enabled])
465
- if test "${aclk_required}" = "detect"; then
466
- enable_aclk=$can_enable_aclk
467
- else
468
- enable_aclk=$aclk_required
469
- fi
470
-
471
- if test "${enable_aclk}" = "yes"; then
472
- AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
473
- fi
474
-
475
- AC_MSG_RESULT([${enable_aclk}])
476
-fi
477
-AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"])
478
-
428
# -----------------------------------------------------------------------------
429
# Exporting engine
430
AC_MSG_CHECKING([if netdata exporting engine should be used])
@@ -591,6 +540,62 @@ fi
540
AC_MSG_RESULT([${with_libcap}])
541
AM_CONDITIONAL([ENABLE_CAPABILITY], [test "${with_libcap}" = "yes"])
542
543
+# -----------------------------------------------------------------------------
544
+# ACLK
545
+
546
+#currently env var ACLK must be set to 'yes' to even consider building ACLK
547
+if test "${ACLK}" = "yes"; then
548
+ AC_MSG_CHECKING([if libmosquitto static lib is present])
549
+ if test -f "externaldeps/mosquitto/libmosquitto.a"; then
550
+ HAVE_libmosquitto_a="yes"
551
+ else
552
+ HAVE_libmosquitto_a="no"
553
+ fi
554
+ AC_MSG_RESULT([${HAVE_libmosquitto_a}])
555
+
556
+ AC_MSG_CHECKING([if libwebsockets static lib is present])
557
+ if test -f "externaldeps/libwebsockets/libwebsockets.a"; then
558
+ LWS_LIBS="-I externaldeps/libwebsockets/include"
559
+ HAVE_libwebsockets_a="yes"
560
+ else
561
+ HAVE_libwebsockets_a="no"
562
+ fi
563
+ AC_MSG_RESULT([${HAVE_libwebsockets_a}])
564
+
565
+ if test "${build_target}" = "linux" -a "${aclk_required}" != "no"; then
566
+ if test "${have_libcap}" = "yes" -a "${with_libcap}" = "no"; then
567
+ AC_MSG_ERROR([agent-cloud-link can't be built without libcap. Disable it by --disable-aclk or enable libcap])
568
+ fi
569
+ if test "${with_libcap}" = "yes"; then
570
+ LWS_LIBS+=" -lcap"
571
+ fi
572
+ fi
573
+
574
+ AC_MSG_CHECKING([if netdata agent-cloud-link can be enabled])
575
+ if test "${HAVE_libmosquitto_a}" = "yes" -a "${HAVE_libwebsockets_a}" = "yes"; then
576
+ can_enable_aclk="yes"
577
+ else
578
+ can_enable_aclk="no"
579
+ fi
580
+ AC_MSG_RESULT([${can_enable_aclk}])
581
+
582
+ test "${aclk_required}" = "yes" -a "${can_enable_aclk}" = "no" && \
583
+ AC_MSG_ERROR([User required agent-cloud-link but it can't be built!])
584
+
585
+ AC_MSG_CHECKING([if netdata agent-cloud-link should/will be enabled])
586
+ if test "${aclk_required}" = "detect"; then
587
+ enable_aclk=$can_enable_aclk
588
+ else
589
+ enable_aclk=$aclk_required
590
+ fi
591
+
592
+ if test "${enable_aclk}" = "yes"; then
593
+ AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
594
+ fi
595
+
596
+ AC_MSG_RESULT([${enable_aclk}])
597
+fi
598
+AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"])
599
600
# -----------------------------------------------------------------------------
601
# apps.plugin
netdata-installer.sh
+3
-3
@@ -436,7 +436,7 @@ trap build_error EXIT
436
# -----------------------------------------------------------------------------
437
438
build_libmosquitto() {
439
- run make -C "${1}/lib"
439
+ run env CFLAGS= CXXFLAGS= LDFLAGS= make -C "${1}/lib"
440
}
441
442
copy_libmosquitto() {
@@ -492,8 +492,8 @@ bundle_libmosquitto
492
493
build_libwebsockets() {
494
pushd "${1}" > /dev/null || exit 1
495
- cmake -D LWS_WITH_SOCKS5:bool=ON .
496
- make
495
+ run env CFLAGS= CXXFLAGS= LDFLAGS= cmake -D LWS_WITH_SOCKS5:bool=ON .
496
+ run env CFLAGS= CXXFLAGS= LDFLAGS= make
497
popd > /dev/null || exit 1
498
}
499
packaging/installer/install-required-packages.sh
-7
@@ -709,12 +709,6 @@ declare -A pkg_libmnl_dev=(
709
['default']=""
710
)
711
712
-declare -A pkg_libwebsockets_dev=(
713
- ['debian']="libwebsockets-dev"
714
- ['ubuntu']="libwebsockets-dev"
715
- ['default']="libwebsockets-devel"
716
-)
717
-
712
declare -A pkg_lm_sensors=(
713
['alpine']="lm_sensors"
714
['arch']="lm_sensors"
@@ -1170,7 +1164,6 @@ packages() {
1164
suitable_package libz-dev
1165
suitable_package libuuid-dev
1166
suitable_package libmnl-dev
1173
- suitable_package libwebsockets-dev
1167
fi
1168
1169
# -------------------------------------------------------------------------
packaging/installer/methods/manual.md
+4
-6
@@ -61,16 +61,16 @@ This is how to do it by hand:
61
62
```sh
63
# Debian / Ubuntu
64
-apt-get install zlib1g-dev uuid-dev libuv1-dev liblz4-dev libjudy-dev libssl-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl python cmake libwebsockets-dev
64
+apt-get install zlib1g-dev uuid-dev libuv1-dev liblz4-dev libjudy-dev libssl-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl python cmake
65
66
# Fedora
67
-dnf install zlib-devel libuuid-devel libuv-devel lz4-devel Judy-devel openssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils python cmake libwebsockets-devel
67
+dnf install zlib-devel libuuid-devel libuv-devel lz4-devel Judy-devel openssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils python cmake
68
69
# CentOS / Red Hat Enterprise Linux
70
-yum install autoconf automake curl gcc git libmnl-devel libuuid-devel openssl-devel libuv-devel lz4-devel Judy-devel make nc pkgconfig python zlib-devel cmake libwebsockets-devel
70
+yum install autoconf automake curl gcc git libmnl-devel libuuid-devel openssl-devel libuv-devel lz4-devel Judy-devel make nc pkgconfig python zlib-devel cmake
71
72
# openSUSE
73
-zypper install zlib-devel libuuid-devel libuv-devel liblz4-devel judy-devel libopenssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils python cmake libwebsockets-devel
73
+zypper install zlib-devel libuuid-devel libuv-devel liblz4-devel judy-devel libopenssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils python cmake
74
```
75
76
Once Netdata is compiled, to run it the following packages are required (already installed using the above commands):
@@ -119,8 +119,6 @@ Netdata Cloud support may require the following packages to be installed:
119
120
| package | description
121
|:--------:| -----------------------
122
-| `libwebsockets-devel` | Version 3 or higher is at needed build time for websockets support for Netdata Cloud
123
-| `libwebsockets` | Version 3 or higher is needed at runtime for websockets support for Netdata Cloud
122
| `cmake` | Needed at build time if you aren't using your distribution's version of libwebsockets or are building on a platform other than Linux
123
124
*Netdata will greatly benefit if you have the above packages installed, but it will still work without them.*