diff --git a/src/modules/lua/Makefile b/src/modules/lua/Makefile index 8f534a51b48..5754ff32358 100644 --- a/src/modules/lua/Makefile +++ b/src/modules/lua/Makefile @@ -9,6 +9,11 @@ ifeq ($(BUILD_LUA),module) else STATIC_LUA_FLAG=-DSTATIC_LUA=1 LUA_TARGET=libvalkeylua.a + # Strip LTO flags for the static build. When archiving into a .a, + # LTO bitcode objects cause linker failures if the system linker + # cannot read them. Use 'override' because OPTIMIZATION is passed + # as a command-line variable from the parent Makefile. + override OPTIMIZATION:=$(subst -flto,,$(subst -ffat-lto-objects,,$(subst -flto=auto,,$(OPTIMIZATION)))) endif ifeq ($(uname_S),Darwin)