[sheepdog-users] About bundling libraries (at least one library isa-l)
Marcin Mirosław
marcin at mejor.pl
Mon Nov 24 17:15:33 CET 2014
It looks I solved problems with isa-l library. Build system for isa-l
isn't friendly (or is too friendly). THis patch solves problem when
building target "slib":
--- a/make.inc
+++ b/make.inc
@@ -38,7 +38,7 @@
# trace - get simulator trace
# clean - remove object files
-CC = gcc
+CC ?= gcc
AS = yasm
SIM = sde $(SIMFLAGS) --
@@ -78,10 +78,9 @@ endif
INCLUDE = $(patsubst %,-I%,$(subst :, ,$(VPATH)))
-CFLAGS = $(CFLAGS_$(arch)) $(CFLAGS_$(CC)) $(DEBUG) -O2 $(DEFINES)
$(INCLUDE)
-ASFLAGS = $(ASFLAGS_$(arch)) $(ASFLAGS_$(CC)) $(DEBUG_$(AS))
$(DEFINES) $(INCLUDE)
+CFLAGS += $(DEFINES) $(INCLUDE)
+ASFLAGS += $(ASFLAGS_$(arch)) $(DEFINES) $(INCLUDE)
ARFLAGS = $(ARFLAGS_$(arch))
-DEFINES += $(addprefix -D , $D)
O = bin
lobj += $(patsubst %.c,%.o,$(patsubst %.asm,%.o,$(lsrc$(arch))))
@@ -138,15 +137,15 @@ msg = $(if $(DEBUG),DEBUG) $(patsubst
32,32-bit,$(arch)) $D
$(O)/%.o: %.asm
@echo " ---> Building $< $(msg)"
- @$(AS) $(ASFLAGS) -o $@ $<
+ $(AS) $(ASFLAGS) -o $@ $<
$(O)/%.o %.o: %.c
@echo " ---> Building $< $(msg)"
- @$(COMPILE.c) $(OUTPUT_OPTION) $<
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
$(all_tests):
@echo " ---> Building Test $@ $(msg)"
- @$(LINK.o) $(CFLAGS) $^ $(LDLIBS) -o $@
+ $(LINK.o) $(CFLAGS) $^ $(LDLIBS) -o $@
# Target to build lib files
@@ -163,8 +162,7 @@ endif
#lib $(lib_name): $(lib_name)(${objs})
$(lib_name): $(objs)
@echo " ---> Creating Lib $@"
- @$(AR) $(ARFLAGS) $^
- @$(STRIP_$(CC))
+ $(AR) $(ARFLAGS) $^
# Target for shared lib
@@ -175,7 +173,7 @@ shared_objs += $(addprefix
$(O)/shared_ver_,$(patsubst %.c,%.o,$(filter %.c,$(l
$(O)/shared_ver_%.o: %.c
@echo " ---> Building shared $< $(msg)"
- @$(COMPILE.c) $(OUTPUT_OPTION) $<
+ $(COMPILE.c) $(OUTPUT_OPTION) $<
ifneq ($(lib_debug),1)
$(so_lib_name): DEBUG_$(AS)=
@@ -187,7 +185,7 @@ $(shared_objs): CFLAGS += -fPIC
$(shared_objs) $(aobjs): | $(O)
$(so_lib_name): $(shared_objs) $(aobjs)
@echo " ---> Creating Shared Lib $@"
- @$(CC) $(CFLAGS) --shared $(LDFLAGS) -o $@ $^
+ $(CC) $(CFLAGS) --shared $(LDFLAGS) -Wl,-z,noexecstack -o $@ $^
# Collect performance data
@@ -202,7 +200,7 @@ perf_report:
clean:
@echo Cleaning up
- @$(RM) -r $(O) *.o *.a $(all_tests) $(lib_name) $(so_lib_name)
+ $(RM) -r $(O) *.o *.a $(all_tests) $(lib_name) $(so_lib_name)
So now I've got isa-l.so library installed in system. And with this
patch I'm unbundling isa-l from sheepdog:
--- a/dog/Makefile.am
+++ b/dog/Makefile.am
@@ -36,7 +36,7 @@ if BUILD_NFS
dog_SOURCES += nfs.c
endif
-dog_LDADD = ../lib/libsheepdog.a -lpthread
+dog_LDADD = ../lib/libsheepdog.a -lpthread -lisa-l
dog_DEPENDENCIES = ../lib/libsheepdog.a
noinst_HEADERS = treeview.h dog.h farm/farm.h
diff --git a/include/fec.h b/include/fec.h
index 1ae32e4..e317fcb 100644
--- a/include/fec.h
+++ b/include/fec.h
@@ -64,7 +64,7 @@
#include "util.h"
#include "sheepdog_proto.h"
-#include "../lib/isa-l/include/erasure_code.h"
+#include "erasure_code.h"
struct fec {
unsigned long magic;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a43076e..5b6ac1d 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -4,29 +4,11 @@ AM_CPPFLAGS = -I$(top_builddir)/include
-I$(top_srcdir)/include
libsheepdog_a_DEPENDENCIES =
-noinst_LIBRARIES = libisa.a libsheepdog.a
-
-libisa_a_SOURCES = $(shell find isa-l/ -type f -regex
".*\.\(c\|h\|asm\)") \
- isa-l/erasure_code/Makefile \
- isa-l/Makefile \
- isa-l/Makefile.nmake \
- isa-l/make.inc
+noinst_LIBRARIES = libsheepdog.a
libsheepdog_a_SOURCES = event.c logger.c net.c util.c rbtree.c strbuf.c \
sha1.c option.c work.c sockfd_cache.c fec.c
sd_inode.c
-libsheepdog_a_LIBADD = isa-l/bin/ec_base.o \
- isa-l/bin/ec_highlevel_func.o \
- isa-l/bin/ec_multibinary.o \
- isa-l/bin/gf_2vect_dot_prod_sse.o \
- isa-l/bin/gf_3vect_dot_prod_sse.o \
- isa-l/bin/gf_4vect_dot_prod_sse.o \
- isa-l/bin/gf_5vect_dot_prod_sse.o \
- isa-l/bin/gf_6vect_dot_prod_sse.o \
- isa-l/bin/gf_vect_dot_prod_sse.o \
- isa-l/bin/gf_vect_mul_avx.o \
- isa-l/bin/gf_vect_mul_sse.o
-
if BUILD_SHA1_HW
libsheepdog_a_SOURCES += sha1_ssse3.S
endif
@@ -41,9 +23,3 @@ check-syntax:
check-style:
@$(CHECK_STYLE) $(libsheepdog_a_SOURCES)
-
-libisa.a:
- cd isa-l/ && $(MAKE) && cd ..
-
-clean:
- cd isa-l/ && $(MAKE) clean && cd ..
diff --git a/sheep/Makefile.am b/sheep/Makefile.am
index 406a4ec..e6f90c5 100644
--- a/sheep/Makefile.am
+++ b/sheep/Makefile.am
@@ -53,7 +53,7 @@ AM_CPPFLAGS += -DENABLE_TRACE
sheep_SOURCES += trace/trace.c trace/mcount.S trace/graph.c
trace/checker.c
endif
-sheep_LDADD = ../lib/libsheepdog.a -lpthread -lm\
+sheep_LDADD = ../lib/libsheepdog.a -lpthread -lm -lisa-l\
$(libcpg_LIBS) $(libcfg_LIBS) $(libacrd_LIBS)
$(LIBS)
if BUILD_NFS
# scanelf -n dog sheep
TYPE NEEDED FILE
ET_DYN libpthread.so.0,libisa-l.so,librt.so.1,libc.so.6 dog
ET_DYN libpthread.so.0,libm.so.6,libisa-l.so,librt.so.1,libc.so.6 sheep
And I hope sheep uses isa-l in work;)
Marcin
More information about the sheepdog-users
mailing list