Re: [Keepalived-devel] error building 2.0.10
Status: Beta
Brought to you by:
acassen
|
From: Quentin A. <qu...@ar...> - 2018-11-20 17:33:48
|
Paul,
Many thanks for the report and the patch. It is now merged upstream.
Let's hope that there isn't another libC that defines TIMER_MAXIMUM!
Quentin
On Tue, 2018-11-20 at 16:42 +0000, Paul Gildea wrote:
> Hi, just so you know, the naming conflict above (with uClibc) is
> present in the newest keepalived (2.0.10).
> If anybody else is having this issue here is the patch I use for my
> system:
>
> diff -Naur keepalived-2.0.10/lib/parser.c keepalived-
> 2.0.10_patch/lib/parser.c
> --- keepalived-2.0.10/lib/parser.c 2018-11-05 21:49:48.000000000
> +0000
> +++ keepalived-2.0.10_patch/lib/parser.c 2018-11-20
> 15:55:08.381534860 +0000
> @@ -1915,20 +1915,20 @@
> #endif
>
>
> if (!max_time)
> - max_time = TIMER_MAX;
> + max_time = TIMER_MAXIMUM;
>
>
> errno = 0;
> timer = strtoul(vector_slot(strvec, index), &endptr, 10);
> - *res = (timer > TIMER_MAX ? TIMER_MAX : timer) * TIMER_HZ;
> + *res = (timer > TIMER_MAXIMUM ? TIMER_MAXIMUM : timer) *
> TIMER_HZ;
>
>
> if (FMT_STR_VSLOT(strvec, index)[0] == '-')
> report_config_error(CONFIG_INVALID_NUMBER,
> "%snegative number '%s'", warn, FMT_STR_VSLOT(strvec, index));
> else if (*endptr)
> report_config_error(CONFIG_INVALID_NUMBER, "%sinvalid
> number '%s'", warn, FMT_STR_VSLOT(strvec, index));
> - else if (errno == ERANGE || timer > TIMER_MAX)
> + else if (errno == ERANGE || timer > TIMER_MAXIMUM)
> report_config_error(CONFIG_INVALID_NUMBER, "%snumber
> '%s' outside timer range", warn, FMT_STR_VSLOT(strvec, index));
> else if (timer < min_time || timer > max_time)
> - report_config_error(CONFIG_INVALID_NUMBER, "number
> '%s' outside range [%ld, %ld]", FMT_STR_VSLOT(strvec, index),
> min_time, max_time ? max_time : TIMER_MAX);
> + report_config_error(CONFIG_INVALID_NUMBER, "number
> '%s' outside range [%ld, %ld]", FMT_STR_VSLOT(strvec, index),
> min_time, max_time ? max_time : TIMER_MAXIMUM);
> else
> return true;
>
>
> diff -Naur keepalived-2.0.10/lib/parser.h keepalived-
> 2.0.10_patch/lib/parser.h
> --- keepalived-2.0.10/lib/parser.h 2018-11-08 19:33:31.000000000
> +0000
> +++ keepalived-2.0.10_patch/lib/parser.h 2018-11-20
> 15:55:08.381534860 +0000
> @@ -38,7 +38,7 @@
> #define MAXBUF 1024
>
>
> /* Maximum time read_timer can return */
> -#define TIMER_MAX (ULONG_MAX / TIMER_HZ)
> +#define TIMER_MAXIMUM (ULONG_MAX / TIMER_HZ)
>
>
> /* Configuration test errors. These should be in decreasing order of
> severity */
> typedef enum {
>
>
>
> On Thu, 18 Oct 2018 at 11:23, Paul Gildea <gi...@tc...> wrote:
> > Apologies for the slow reply, I patched "#include <stdbool.h>"
> > into core/process.c and keepalived-2.0.7 built.I haven't tested it
> > out yet but if there is a problem with that solution (never really
> > used C) I can work around it as it's just some definitions. I can
> > log bugs about these if necessary? Even though it's more of a
> > uClibc problem.
> >
> > Thanks,
> >
> > --
> > Paul
> > On Tue, 16 Oct 2018 at 17:39, Quentin Armitage <qu...@ar...
> > g.uk> wrote:
> > > Paul,
> > > It looks like bool, true and false are undeclared/undefined. So
> > > far as I can see uClibc doesn't have a stdbool.h header file, but
> > > I'm not sure why the #include <stdbool.h> isn't failing.
> > > Quentin
> > > On Tue, 2018-10-16 at 15:25 +0100, Paul Gildea wrote:
> > > > Thanks Quentin, that cleared up the issue in my mind for me
> > > > very well. Either solution worked fine and build is progressing
> > > > further.It looks like there are some more issues for me so I'll
> > > > see how I get on and let you know of what happens:
> > > >
> > > > make[3]: Entering directory
> > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > 2.0.7new/keepalived/core'
> > > > CC main.o
> > > > CC daemon.o
> > > > CC pidfile.o
> > > > CC layer4.o
> > > > CC smtp.o
> > > > CC global_data.o
> > > > CC global_parser.o
> > > > CC process.o
> > > > process.c:41: error: expected '=', ',', ';', 'asm' or
> > > > '__attribute__' before 'realtime_priority_set'
> > > > process.c:49: error: expected '=', ',', ';', 'asm' or
> > > > '__attribute__' before 'priority_set'
> > > > process.c: In function 'set_process_priority':
> > > > process.c:79: error: 'priority_set' undeclared (first use in
> > > > this function)
> > > > process.c:79: error: (Each undeclared identifier is reported
> > > > only once
> > > > process.c:79: error: for each function it appears in.)
> > > > process.c:79: error: 'true' undeclared (first use in this
> > > > function)
> > > > process.c: In function 'reset_process_priority':
> > > > process.c:91: error: 'priority_set' undeclared (first use in
> > > > this function)
> > > > process.c:91: error: 'false' undeclared (first use in this
> > > > function)
> > > > process.c: In function 'reset_process_priorities':
> > > > process.c:141: error: 'realtime_priority_set' undeclared (first
> > > > use in this function)
> > > > process.c:150: error: 'false' undeclared (first use in this
> > > > function)
> > > > process.c:164: error: 'priority_set' undeclared (first use in
> > > > this function)
> > > > make[3]: *** [process.o] Error 1
> > > > make[3]: *** Waiting for unfinished jobs....
> > > > make[3]: Leaving directory
> > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > 2.0.7new/keepalived/core'
> > > > make[2]: *** [all-recursive] Error 1
> > > > make[2]: Leaving directory
> > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > 2.0.7new/keepalived'
> > > > make[1]: *** [all-recursive] Error 1
> > > > make[1]: Leaving directory
> > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-2.0.7new'
> > > > make: ***
> > > > [/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > 2.0.7new/.stamp_built] Error 2
> > > >
> > > >
> > > > On Tue, 16 Oct 2018 at 14:26, Quentin Armitage <quentin@armitag
> > > > e.org.uk> wrote:
> > > > > Paul,
> > > > > This appears probably to be due to a conflict between uClibc
> > > > > using TIMER_MAX and keepalived defining TIMER_MAX. glibc
> > > > > doesn't have a definition of, or use, TIMER_MAX, at least not
> > > > > on my systems, and musl doesn't appear to either.
> > > > > So the problem would appear to be namespace polution by
> > > > > uClibc. Looking at the uClibc-ng source code, TIMER_MAX
> > > > > doesn't appear to be used other than to define it if it is
> > > > > not defined, in common/bits/uClibc_local_lim.h, so I suspect
> > > > > it is some historical code in uClibc that should be removed.
> > > > > It would be simple enough to rename the TIMER_MAX used in
> > > > > keepalived to something else, and there are only 4 lines in
> > > > > keepalived where it is used (all in read_timer
> > > > > in lib/parser.c).
> > > > > Could you just try moving the definition of TIMER_MAX from
> > > > > lib/parser.h to lib/parser.c and see if that works. If not,
> > > > > could you try changing it to TIMER_MAX_UL or something like
> > > > > that and seeing if it resolves your problem.
> > > > > Please let me know what you work out, and we can then see if
> > > > > we can push a commit to work around the problem in uClibc.
> > > > > Quentin ArmitageOn Tue, 2018-10-16 at 12:22 +0100, Paul
> > > > > Gildea wrote:
> > > > > > Hi,
> > > > > > I currently have 2.0.5 build and was trying to patch it
> > > > > > with a fix I need by patching this commit to it:
> > > > > > https://github.com/acassen/keepalived/commit/37d6b3bc22d307
> > > > > > d09ab8bd75111c3645c742c792
> > > > > > However the code change must be too great between 2.0.5 and
> > > > > > master because doing so causes build errors. To make the
> > > > > > code more similar before patching I decided to upgrade to
> > > > > > the latest release, 2.0.7, however that is not building
> > > > > > with the below error, do you know what might have changed
> > > > > > to cause this or what is happening? I'm not sure from
> > > > > > reading the changelog. I have also tried to build 2.0.6 to
> > > > > > narrow it down, which worked fine.
> > > > > >
> > > > > > /media/vmpart/vrrp/buildroot/output/host/usr/x86_64-
> > > > > > unknown-linux-
> > > > > > uclibc/sysroot/usr/include/bits/uClibc_local_lim.h:15:3:
> > > > > > error: #error local_lim.h was incorrectly updated, use the
> > > > > > NPTL version from glibc
> > > > > > make[3]: *** [parser.o] Error 1
> > > > > > make[3]: *** Waiting for unfinished jobs....
> > > > > > CC logger.o
> > > > > > make[3]: Leaving directory
> > > > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > > > 2.0.7/lib'
> > > > > > make[2]: *** [all] Error 2
> > > > > > make[2]: Leaving directory
> > > > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > > > 2.0.7/lib'
> > > > > > make[1]: *** [all-recursive] Error 1
> > > > > > make[1]: Leaving directory
> > > > > > `/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > > > 2.0.7'
> > > > > > make: ***
> > > > > > [/media/vmpart/vrrp/buildroot/output/build/keepalived-
> > > > > > 2.0.7/.stamp_built] Error 2
> > > > > >
> > > > > >
> > > > > > Looking at the file with that error I see:
> > > > > >
> > > > > > #if !defined PTHREAD_KEYS_MAX || defined TIMER_MAX ||
> > > > > > !defined SEM_VALUE_MAX
> > > > > > # error local_lim.h was incorrectly updated, use the NPTL
> > > > > > version from glibc
> > > > > > #endif
> > > > > >
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Paul
> > > > > >
> > > > > > _______________________________________________
> > > > > > Keepalived-devel mailing list
> > > > > > Kee...@li...
> > > > > > https://lists.sourceforge.net/lists/listinfo/keepalived-dev
> > > > > > el |