[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Cluster-devel] [PATCH] Fix libdlm static build

Fabio M. Di Nitto wrote:

Hi David,

the objects included in the static version of dlm are different from the one in the shared lib. This is generally wrong as they should be the same.

the patch addresses the problem by killing .po files in favour of more common .o and changing the linking targets.

the patch applies to both master and stable2. rhel branches are also affected by other problems (_lt is linked to pthread) but i don't think it's wise to change it.

Please review and apply.


diff --git a/dlm/libdlm/Makefile b/dlm/libdlm/Makefile
index 0cc1f7b..734eaa9 100644
--- a/dlm/libdlm/Makefile
+++ b/dlm/libdlm/Makefile
@@ -42,26 +42,20 @@ $(TARGET)_lt.a: $(TARGET)_lt.o
     ${AR} cru $@ $^
     ${RANLIB} $@

$(CC) -shared -o $@ -Wl,-soname=$(TARGET).so.$(SOMAJOR) $< $(PTHREAD_LDFLAGS) $(LDFLAGS)
     ln -sf $(TARGET).so.$(SOMAJOR).$(SOMINOR) $(TARGET).so
     ln -sf $(TARGET).so.$(SOMAJOR).$(SOMINOR) $(TARGET).so.$(SOMAJOR)

-$(TARGET)_lt.so.${SOMAJOR}.${SOMINOR}: $(TARGET)_lt.po
+$(TARGET)_lt.so.${SOMAJOR}.${SOMINOR}: $(TARGET)_lt.o
$(CC) -shared -o $@ -Wl,-soname=$(TARGET)_lt.so.$(SOMAJOR) $< $(LDFLAGS)
     ln -sf $(TARGET)_lt.so.$(SOMAJOR).$(SOMINOR) $(TARGET)_lt.so
ln -sf $(TARGET)_lt.so.$(SOMAJOR).$(SOMINOR) $(TARGET)_lt.so.$(SOMAJOR)

 %_lt.o: $(S)/%.c
-    $(CC) $(CFLAGS) -c -o $@ $<
-%_lt.po: $(S)/%.c
     $(CC) $(CFLAGS) -fPIC -c -o $@ $<

 %.o: $(S)/%.c
-    $(CC) $(CFLAGS) -D_REENTRANT -c -o $@ $<
-%.po: $(S)/%.c
     $(CC) $(CFLAGS) -fPIC -D_REENTRANT -c -o $@ $<

 clean: generalclean

I don't understand the problem you are trying to fix here. Having PIC objects in the dynamic library and non-PIC in the static is perfectly standard practice.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]