Skip to content

haproxy 2.4.3 fails to start, complains about CFLAGS used during build #313

Description

@drboone

After update to haproxy 2.4.3 this morning, it failed to start. From the service log:

[ Aug 30 09:37:01 Executing start method ("/opt/local/sbin/haproxy -f /opt/local/etc/haproxy.cfg -D"). ]
FATAL ERROR: invalid code detected -- cannot go further, please recompile!
The source code was miscompiled by the compiler, which usually indicates that
some of the CFLAGS needed to work around overzealous compiler optimizations
were overwritten at build time. Please do not force CFLAGS, and read Makefile
and INSTALL files to decide on the best way to pass your local build options.

This may be relevant - haproxy/haproxy@1335da38f4 - discussion of checking for the compiler option -fwrapv.

Downgrading to 2.4.2 got us back on the air for now.

Activity

  1. goekesmi commented on Aug 30, 2021

    @goekesmi

    The haproxy Makefile has quite a bit of CFLAGS manipulation in it. Given what it needs, this might be the better way to pass in the pkgsrc CFLAGS setting:

    diff --git a/net/haproxy/Makefile b/net/haproxy/Makefile
    index 8cc3b1b6314..6be440674de 100644
    --- a/net/haproxy/Makefile
    +++ b/net/haproxy/Makefile
    @@ -13,7 +13,7 @@ USE_LANGUAGES=                c
     USE_TOOLS+=            gmake
     BUILD_MAKE_FLAGS+=     ADDLIB=${COMPILER_RPATH_FLAG}${PREFIX}/lib
     BUILD_MAKE_FLAGS+=     CC=${CC:Q}
    -BUILD_MAKE_FLAGS+=     CFLAGS=${CFLAGS:Q}
    +BUILD_MAKE_FLAGS+=     DEBUG_CFLAGS=${CFLAGS:Q}
     BUILD_MAKE_FLAGS+=     LDFLAGS=${LDFLAGS:Q}
     BUILD_MAKE_FLAGS+=     TARGET=${TARGET}
     BUILD_MAKE_FLAGS+=     USE_REGPARM=1
    

    With this change, haproxy does build, package, and not throw errors at startup.

  2. jperkin commented on Aug 31, 2021

    @jperkin
    Collaborator

    Ugh, thanks. I've applied this patch upstream and will get a trunk build started as soon as it's merged to git.

  3. jperkin commented on Sep 1, 2021

    @jperkin
    Collaborator

    Ok, the fixed haproxy-2.4.3nb1 is now available in the trunk package set. Sorry for the mess.

  4. drboone commented on Sep 1, 2021

    @drboone
    Author

    Thanks!

  5. added a commit that references this issue on Feb 5, 2022
  6. added a commit that references this issue on Sep 1, 2022
  7. added a commit that references this issue on Nov 15, 2022
  8. added a commit that references this issue on Oct 23, 2023
  9. 31 remaining items

  10. added a commit that references this issue on Jun 23, 2026
  11. added a commit that references this issue on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions