Skip Menu |

This queue is for tickets about the Authen-TacacsPlus CPAN distribution.

Report information
The Basics
Id: 131709
Status: resolved
Priority: 0/
Queue: Authen-TacacsPlus

People
Owner: mike [...] shoyher.com
Requestors: github [...] rkas.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.26
Fixed in: (no value)

Attachments
0001-Adding-includes-to-fix-build-on-Alpine-Docker-images.patch
0001-Fixing-the-build-on-Alpine-Linux.patch
Dockerfile



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)
On Sat Feb 08 02:01:10 2020, github@rkas.net wrote: Show quoted text
> 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.
The patch I attached probably isn't the right fix for a project that supports so many platforms. I'm confused why this problem is happening in the first place, since both of those includes also happen in tac_plus.h. I created a simple Dockerfile that reproduces this, and it reproduces on MacOS so this isn't arm-specific.
Subject: Dockerfile
Download Dockerfile
application/octet-stream 621b

Message body not shown because it is not plain text.

On Sat Feb 08 02:23:08 2020, github@rkas.net wrote: Show quoted text
> On Sat Feb 08 02:01:10 2020, github@rkas.net wrote:
> > 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.
> > The patch I attached probably isn't the right fix for a project that > supports so many platforms. I'm confused why this problem is happening > in the first place, since both of those includes also happen in > tac_plus.h. > > I created a simple Dockerfile that reproduces this, and it reproduces > on MacOS so this isn't arm-specific.
Alright- I've narrowed this down a bit further. The issue is that Alpine Linux's <sys/file.h> doesn't include fcntl.h like the file.h header on most other platforms. The only time tac_plus.h includes fcntl.h is if SYSV is defined. I think a better cross-platform fix here is to conditionally include <fcntl.h> when LINUX is defined: diff --git a/tacpluslib/tac_plus.h b/tacpluslib/tac_plus.h index 8f44886..5044d41 100644 --- a/tacpluslib/tac_plus.h +++ b/tacpluslib/tac_plus.h @@ -167,6 +167,10 @@ #include <unistd.h> +#ifdef LINUX +#include <fcntl.h> +#endif + #ifdef SYSV #include <fcntl.h> #define index strchr
Subject: 0001-Fixing-the-build-on-Alpine-Linux.patch
From bdc0f41b14cfea79fb03220a079eb0a4015b4a08 Mon Sep 17 00:00:00 2001 From: Jacob Farkas <jacobf@rkas.net> Date: Sat, 8 Feb 2020 00:05:05 -0800 Subject: [PATCH] Fixing the build on Alpine Linux --- tacpluslib/tac_plus.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tacpluslib/tac_plus.h b/tacpluslib/tac_plus.h index 8f44886..5044d41 100644 --- a/tacpluslib/tac_plus.h +++ b/tacpluslib/tac_plus.h @@ -167,6 +167,10 @@ #include <unistd.h> +#ifdef LINUX +#include <fcntl.h> +#endif + #ifdef SYSV #include <fcntl.h> #define index strchr -- 2.21.0 (Apple Git-122.2)
Subject: Re: [rt.cpan.org #131709] Build fails on Alpine Linux under Docker on armv7l
Date: Sun, 09 Feb 2020 14:41:13 +1000
To: bug-Authen-TacacsPlus [...] rt.cpan.org
From: Mike McCauley <mikem [...] airspayce.com>
Thanks, patched and new version 1.27 uploaded to CPAN. Cheers. On Saturday, 8 February 2020 18:07:06 AEST Jacob Farkas via RT wrote: Show quoted text
> Queue: Authen-TacacsPlus > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=131709 > > > On Sat Feb 08 02:23:08 2020, github@rkas.net wrote:
> > On Sat Feb 08 02:01:10 2020, github@rkas.net wrote:
> > > 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.
> > > > The patch I attached probably isn't the right fix for a project that > > supports so many platforms. I'm confused why this problem is happening > > in the first place, since both of those includes also happen in > > tac_plus.h. > > > > I created a simple Dockerfile that reproduces this, and it reproduces > > on MacOS so this isn't arm-specific.
> > Alright- I've narrowed this down a bit further. The issue is that Alpine > Linux's <sys/file.h> doesn't include fcntl.h like the file.h header on most > other platforms. The only time tac_plus.h includes fcntl.h is if SYSV is > defined. I think a better cross-platform fix here is to conditionally > include <fcntl.h> when LINUX is defined: > > diff --git a/tacpluslib/tac_plus.h b/tacpluslib/tac_plus.h > index 8f44886..5044d41 100644 > --- a/tacpluslib/tac_plus.h > +++ b/tacpluslib/tac_plus.h > @@ -167,6 +167,10 @@ > > #include <unistd.h> > > +#ifdef LINUX > +#include <fcntl.h> > +#endif > + > #ifdef SYSV > #include <fcntl.h> > #define index strchr
-- Mike McCauley VK4AMM mikem@airspayce.com Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia http://www.airspayce.com 5R3MRFM2+X6 Phone +61 7 5598-7474
It's working great- thank you for the speedy fix! On Sat Feb 08 23:41:24 2020, mikem@airspayce.com wrote: Show quoted text
> Thanks, > > patched and new version 1.27 uploaded to CPAN. > > Cheers. > > On Saturday, 8 February 2020 18:07:06 AEST Jacob Farkas via RT wrote:
> > Queue: Authen-TacacsPlus > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=131709 > > > > > On Sat Feb 08 02:23:08 2020, github@rkas.net wrote:
> > > On Sat Feb 08 02:01:10 2020, github@rkas.net wrote:
> > > > 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.
> > > > > > The patch I attached probably isn't the right fix for a project > > > that > > > supports so many platforms. I'm confused why this problem is > > > happening > > > in the first place, since both of those includes also happen in > > > tac_plus.h. > > > > > > I created a simple Dockerfile that reproduces this, and it > > > reproduces > > > on MacOS so this isn't arm-specific.
> > > > Alright- I've narrowed this down a bit further. The issue is that > > Alpine > > Linux's <sys/file.h> doesn't include fcntl.h like the file.h header > > on most > > other platforms. The only time tac_plus.h includes fcntl.h is if SYSV > > is > > defined. I think a better cross-platform fix here is to conditionally > > include <fcntl.h> when LINUX is defined: > > > > diff --git a/tacpluslib/tac_plus.h b/tacpluslib/tac_plus.h > > index 8f44886..5044d41 100644 > > --- a/tacpluslib/tac_plus.h > > +++ b/tacpluslib/tac_plus.h > > @@ -167,6 +167,10 @@ > > > > #include <unistd.h> > > > > +#ifdef LINUX > > +#include <fcntl.h> > > +#endif > > + > > #ifdef SYSV > > #include <fcntl.h> > > #define index strchr