lib: Fix compilation when USE_STATIC_LIB
Subsystems (2)
PATCH 1/1 lib: Fix compilation when USE_STATIC_LIB
This patch removes the mandatory compiling of the shared library when USE_STATIC_LIB is used.
--- lib/Module.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/Module.mk +3 -2
@@ -27,12 +27,13 @@ LIB_SHSONAME := $(LIB_SHBASENAME).$(LIB_MAINVER) LIB_SHLIBNAME := $(LIB_SHBASENAME).$(LIB_VER) LIB_STLIBNAME := libi2c.a -LIB_TARGETS := $(LIB_SHLIBNAME) LIB_LINKS := $(LIB_SHSONAME) $(LIB_SHBASENAME) LIB_OBJECTS := smbus.o ifeq ($(BUILD_STATIC_LIB),1) -LIB_TARGETS += $(LIB_STLIBNAME) +LIB_TARGETS := $(LIB_STLIBNAME) LIB_OBJECTS += smbus.ao +else +LIB_TARGETS := $(LIB_SHLIBNAME) endif #
Signature · 1 line
2.7.4
Hi Angelo,
Quoted 2 lines · Angelo Compagnucci
This patch removes the mandatory compiling of the shared library when
USE_STATIC_LIBis used.
No, thanks. The current behavior is as desired: always build the dynamic library, and optionally build the static library. It was never the intent to allow only building the static library. Static libraries are evil.
Signature · 2 lines
Jean Delvare SUSE L3 Support
Hi Jean,
Quoted 11 lines · Jean Delvare
Hi Angelo,
Quoted 2 lines · Angelo Compagnucci
This patch removes the mandatory compiling of the shared library when
USE_STATIC_LIBis used.No, thanks. The current behavior is as desired: always build the dynamic library, and optionally build the static library. It was never the intent to allow only building the static library. Static libraries are evil.
In Buildroot we have the need to support also static only libraries cause we have targets that doesn't support dynamic libraries (like cortex M4 for which I'm fixing this bug).
The option for static only is also present for various other architectures as a build option.
So, if this cannot be fixed upstream, I'll push a patch only on the Buildroot side.
Sincerely, Angelo.
Quoted 5 lines
--
Jean Delvare
SUSE L3 Support
Quoted 5 lines · Angelo Compagnucci
Quoted 4 lines · Jean Delvare
Quoted 2 lines · Angelo Compagnucci
This patch removes the mandatory compiling of the shared library when
USE_STATIC_LIBis used.
Quoted 8 lines
Quoted 4 lines
No, thanks. The current behavior is as desired: always build the dynamic library, and optionally build the static library. It was never the intent to allow only building the static library. Static libraries are evil.
In Buildroot we have the need to support also static only libraries cause we have targets that doesn't support dynamic libraries (like cortex M4 for which I'm fixing this bug).
That's a frightening platform :(
Quoted 5 lines
The option for static only is also present for various other architectures as a build option.
So, if this cannot be fixed upstream, I'll push a patch only on the Buildroot side.
Maybe it can be fixed upstream, but not the way you proposed because it causes a regression (by default the dynamic lib would no longer be built.)
I suppose that introducing BUILD_DYNAMIC_LIB, which would default to 1 and would only control whether the dynamic library is built or not, would be acceptable. But you'll have to make sure that at least one flavor of the library is being built, and that the tools themselves are linked to the right library (dynamic if available, else fallback to static, see USE_STATIC_LIB.)
By default we want all library flavors built, and the tools linked dynamically.
Signature · 2 lines
Jean Delvare SUSE L3 Support