TritonDataCenter / pkgsrc

NetBSD/pkgsrc fork for our binary package repositories
https://pkgsrc.smartos.org/
132 stars 51 forks source link

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

Closed drboone closed 3 years ago

drboone commented 3 years ago

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 - https://github.com/haproxy/haproxy/commit/1335da38f4 - discussion of checking for the compiler option -fwrapv.

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

goekesmi commented 3 years ago

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.

jperkin commented 3 years ago

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

jperkin commented 3 years ago

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

drboone commented 3 years ago

Thanks!