Subject: | Build fails on Alpine Linux under Docker on armv7l |
I'm trying build a NetDisco Docker image on a Raspberry Pi 4 (armv7l) and it's failing when building Authen::TacacsPlus. I've included a build log below with the error.
It looks like some files just need a couple extra header includes and then the build works for me. I've attached a patch that fixes the build for me.
Build log:
Authen-TacacsPlus-0.26 # make
cp TacacsPlus.pm blib/lib/Authen/TacacsPlus.pm
cd tacpluslib && make -e
make[1]: Entering directory '/tmp/Authen-TacacsPlus-0.26/tacpluslib'
cc -c -Os -fomit-frame-pointer -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr/lib/perl5/core_perl/CORE" -DLINUX encrypt.c
cc -c -Os -fomit-frame-pointer -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr/lib/perl5/core_perl/CORE" -DLINUX md5.c
cc -c -Os -fomit-frame-pointer -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC "-I/usr/lib/perl5/core_perl/CORE" -DLINUX tac_client.c
tac_client.c: In function 'init_tac_session':
tac_client.c:208:9: warning: implicit declaration of function 'fcntl' [-Wimplicit-function-declaration]
flags = fcntl(tac_fd, F_GETFL, 0);
^~~~~
tac_client.c:208:23: error: 'F_GETFL' undeclared (first use in this function)
flags = fcntl(tac_fd, F_GETFL, 0);
^~~~~~~
tac_client.c:208:23: note: each undeclared identifier is reported only once for each function it appears in
tac_client.c:216:22: error: 'F_SETFL' undeclared (first use in this function)
res = fcntl( tac_fd, F_SETFL, flags | O_NONBLOCK );
^~~~~~~
tac_client.c:216:39: error: 'O_NONBLOCK' undeclared (first use in this function)
res = fcntl( tac_fd, F_SETFL, flags | O_NONBLOCK );
^~~~~~~~~~
make[1]: *** [Makefile:327: tac_client.o] Error 1
make[1]: Leaving directory '/tmp/Authen-TacacsPlus-0.26/tacpluslib'
make: *** [Makefile:1268: tacpluslib/libtacplus.a] Error 2
Subject: | 0001-Adding-includes-to-fix-build-on-Alpine-Docker-images.patch |
From 8b40448ee2877feb026941f10fb465c2f56957c4 Mon Sep 17 00:00:00 2001
From: Jacob Farkas <jacobf@rkas.net>
Date: Fri, 7 Feb 2020 22:50:46 -0800
Subject: [PATCH] Adding includes to fix build on Alpine Docker images
---
tacpluslib/tac_client.c | 2 ++
tacpluslib/utils.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tacpluslib/tac_client.c b/tacpluslib/tac_client.c
index d26c151..9493744 100644
--- a/tacpluslib/tac_client.c
+++ b/tacpluslib/tac_client.c
@@ -11,6 +11,8 @@
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
+#include <fcntl.h>
+#include <sys/file.h>
#include <time.h>
#include"tac_plus.h"
#include "tacplus_client.h"
diff --git a/tacpluslib/utils.c b/tacpluslib/utils.c
index af39740..150106c 100644
--- a/tacpluslib/utils.c
+++ b/tacpluslib/utils.c
@@ -19,6 +19,8 @@
#include "tac_plus.h"
#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/file.h>
int
tac_exit(status)
--
2.21.0 (Apple Git-122.2)