Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 26361b6c authored by Axel Auweter's avatar Axel Auweter
Browse files

Enables cross compilation for ARM targets related to ticket #30

parent 42982b59
......@@ -5,7 +5,7 @@ OBJS = collectagent.o \
simplemqttserver.o \
simplemqttserverthread.o \
simplemqttservermessage.o
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -ldcdb -lpthread -lcassandra -luv -lboost_system -lboost_random -lboost_thread -lboost_date_time
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -ldcdb -lpthread -lcassandra -luv -lboost_system -lboost_random -lboost_thread -lboost_date_time -lssl -lcrypto
TARGET = collectagent
.PHONY : clean install
......
......@@ -17,7 +17,7 @@ PUBHEADERS = $(shell find include -type f -iname "*.h")
PRIVHEADERS = $(shell find include_internal -type f -iname "*.h")
# External libraries to link against
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -lcassandra -lboost_random -lboost_system -lboost_date_time -luv
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -lcassandra -lboost_random -lboost_system -lboost_date_time -luv
# Dynamic library building differs between Linux/BSD and MacOS
OS = $(shell uname)
......
......@@ -2,7 +2,7 @@ include ../../config.mk
CXXFLAGS = -O0 -ggdb --std=c++11 -Wall -Wno-unused-local-typedefs -Wno-unknown-warning-option -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ -I$(DCDBBASEPATH)/include/
OBJS = dcdbconfig.o sensoraction.o useraction.o casshelper.o
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -ldcdb -lcassandra -luv -lboost_random -lboost_system
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -ldcdb -lcassandra -luv -lboost_random -lboost_system -lssl -lcrypto
# GCC 4.8 is broken
ifeq ($(findstring 4.8, $(shell $(CXX) --version)), 4.8)
SLIBS = $(DCDBDEPLOYPATH)/lib/libboost_random.a $(DCDBDEPLOYPATH)/lib/libboost_system.a
......
......@@ -2,7 +2,7 @@ include ../../config.mk
CXXFLAGS = -O0 -ggdb --std=c++11 -Wall -Wno-unused-local-typedefs -Wno-unknown-warning-option -fmessage-length=0 -I$(DCDBDEPLOYPATH)/include/ -I$(DCDBBASEPATH)/include/ -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
OBJS = dcdbquery.o query.o casshelper.o
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -ldcdb -lcassandra -luv -lboost_random -lboost_system -lboost_date_time
LIBS = -L$(DCDBDEPLOYPATH)/lib/ -ldcdb -lcassandra -luv -lboost_random -lboost_system -lboost_date_time -lssl -lcrypto
TARGET = dcdbquery
.PHONY : clean install
......
......@@ -24,7 +24,12 @@ DISTFILES = apache-cassandra-$(CASSANDRA_VERSION).tar.gz;http://apache.cs.utah.e
FETCH = wget -c --no-check-certificate -O -
OPENSSL_TARGET = $(if $(findstring $(shell uname),Darwin),"darwin64-x86_64-cc", "linux-x86_64")
# Determine OpenSSL dependency target
ifeq ("$(ARCH)", "arm")
OPENSSL_TARGET = "linux-armv4"
else
OPENSSL_TARGET = $(findstring $(shell uname),Darwin),"darwin64-x86_64-cc","linux-x86_64")
endif
MAKETHREADS ?= $(if $(findstring $(shell uname),Darwin),$(shell sysctl machdep.cpu.thread_count | cut -b 27-),\
$(if $(findstring $(shell uname),Linux),$(shell cat /proc/cpuinfo | grep processor | wc -l),4))
......@@ -40,11 +45,32 @@ CASSANDRA_COMMITLOG_SEGMENT_SIZE_IN_MB = 16
DISTFILESNAMES = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/;.*//'))
DISTFILESPATHS = $(foreach f,$(DISTFILES),$(shell echo "$(f)" | sed 's/.tar.gz;.*//' | sed 's/.zip;.*//' ))
# If cross-compiling for ARM, adjust the build settings
ifeq ("$(ARCH)", "arm")
ifeq ("$(CROSS_COMPILE)", "")
$(error "If you want to cross compile for ARM, you must set the CROSS_COMPILE variable with your cross compiler prefix")
endif
CROSS_COMPILE_STRP = $(CROSS_COMPILE:-=)
CC = "$(CROSS_COMPILE)gcc"
CXX = "$(CROSS_COMPILE)g++"
CMAKE_CROSS_FLAGS = -DCMAKE_C_COMPILER=$(CC) \
-DCMAKE_CXX_COMPILER=$(CXX) \
-DCMAKE_FIND_ROOT_PATH=/usr/$(CROSS_COMPILE_STRP) \
-DCMAKE_LIBRARY_PATH=$(DCDBDEPLOYPATH)/lib \
-DCMAKE_INCLUDE_PATH=$(DCDBDEPLOYPATH)/include
AUTOCONF_CROSS_FLAGS = --host=$(CROSS_COMPILE_STRP)
SKIP_PROJECTS = IPMIPusher MontBlancPusher
else
CMAKE_CROSS_FLAGS = ""
AUTOCONF_CROSS_FLAGS = ""
SKIP_PROJECTS = ""
endif
CFLAGS += -I$(DCDBDEPLOYPATH)/include -O0 -g
CXX11FLAGS = --std=c++11 -Wno-c99-extensions -Wno-missing-field-initializers -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
LDFLAGS += -L$(DCDBDEPLOYPATH)/lib -O0 -g
.PHONY : info all clean cleanall distclean $(LIBRARIES) $(PROJECTS)
.PHONY : info all clean cleanall distclean check-cross-compile $(LIBRARIES) $(PROJECTS)
info:
@echo ""
......@@ -69,7 +95,10 @@ info:
@echo ""
@echo "To start, please type:"
@echo " make all"
@echo $(OPENSSLPREFIX)
@echo ""
@echo "For ARM cross compilation, please type:"
@echo " make ARCH=arm CROSS_COMPILE=<X> all"
@echo "where <X> is your cross copmlier prefix ( e.g. arm-linux-gnueabihf- )"
clean:
@$(foreach l,$(LIBRARIES),echo "Cleaning $(l)..." && make -C $(l) clean && echo;)
......@@ -91,10 +120,16 @@ mrproper: distclean
@echo "Wiping installation directory..."
@rm -rf $(DCDBDEPLOYPATH)
all: $(DCDBDEPSPATH)/.prerequesites
all: check-cross-compile $(DCDBDEPSPATH)/.prerequesites
@make $(LIBRARIES)
@make $(PROJECTS)
check-cross-compile:
@if [ "$(ARCH)" = "arm" ]; then \
echo "Info: Cross-compiling for ARM using compiler prefix: $(CROSS_COMPILE_STRP)"; \
echo; \
fi;
$(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@echo ""
@echo "Preparing patches..."
......@@ -120,7 +155,13 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
fi; \
mkdir -p $(DCDBDEPSPATH)/mosquitto_build; \
cd $(DCDBDEPSPATH)/mosquitto_build && \
cmake -DWITH_SRV=no -DWITH_TLS=OFF -DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ $(DCDBDEPSPATH)/$(M) && \
cmake $(CMAKE_CROSS_FLAGS) \
-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DWITH_SRV=no \
-DWITH_TLS=yes \
-DWITH_TLS_PSK=yes \
-DCMAKE_INSTALL_PREFIX:PATH=$(DCDBDEPLOYPATH)/ \
$(DCDBDEPSPATH)/$(M) && \
make -j $(MAKETHREADS) && make install && \
touch $(DCDBDEPSPATH)/$(M)/.installed; \
else \
......@@ -131,7 +172,9 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
@if [ ! -e $(DCDBDEPSPATH)/$(R)/.installed ]; then \
echo ""; \
echo "Building Rudeconfig library..."; \
cd $(DCDBDEPSPATH)/$(R) && ./configure --prefix=$(DCDBDEPLOYPATH) && \
cd $(DCDBDEPSPATH)/$(R) && ./configure --prefix=$(DCDBDEPLOYPATH) \
CC="$(CC)" CFLAGS="$(CFLAGS)" CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \
$(AUTOCONF_CROSS_FLAGS) && \
make -j $(MAKETHREADS) && \
chmod +x install-sh && \
make install && \
......@@ -142,7 +185,9 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
$(eval O := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*OpenIPMI/OpenIPMI/' | sed 's/\ .*//'))
$(eval X := $(shell uname))
@if [ ! -e $(DCDBDEPSPATH)/$(O)/.installed ]; then \
@if [ "$(ARCH)" = "arm" ]; then \
echo "Skipping OpenIPMI - does not build on ARM"; \
elif [ ! -e $(DCDBDEPSPATH)/$(O)/.installed ]; then \
echo ""; \
echo "Building OpenIPMI library..."; \
if [ -e $(DCDBDEPSPATH)/patches/$(O).patch ]; then \
......@@ -153,7 +198,10 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
echo "Fixing OpenIPMI for Mac OS..."; \
cd $(DCDBDEPSPATH)/$(O) && find . -name 'Makefile*' | xargs sed -i '' -e 's/Map/map/g'; \
fi; \
cd $(DCDBDEPSPATH)/$(O) && ./configure --prefix=$(DCDBDEPLOYPATH) --with-swig=no --with-perl=no --with-python=no CFLAGS="$(CFLAGS)"; \
cd $(DCDBDEPSPATH)/$(O) && aclocal && automake; \
cd $(DCDBDEPSPATH)/$(O) && ./configure --prefix=$(DCDBDEPLOYPATH) --with-swig=no --with-perl=no --with-python=no \
CC="$(CC)" CFLAGS="$(CFLAGS)" \
$(AUTOCONF_CROSS_FLAGS); \
cd $(DCDBDEPSPATH)/$(O) && make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(O)/.installed; \
else \
echo "Skipping OpenIPMI library (already built)..."; \
......@@ -167,8 +215,12 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
echo "Patching Boost..."; \
cd $(DCDBDEPSPATH)/$(B) && (patch -N -p2 < $(DCDBDEPSPATH)/patches/$(B).patch || true); \
fi; \
if [ "$(ARCH)" = "arm" ]; then \
echo " using gcc : arm : $(CROSS_COMPILE)g++ ; " > $(DCDBDEPSPATH)/$(B)/tools/build/src/user-config.jam; \
fi; \
cd $(DCDBDEPSPATH)/$(B) && ./bootstrap.sh --prefix=$(DCDBDEPLOYPATH) \
--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,random,system,thread,timer && \
--with-libraries=atomic,chrono,date_time,exception,filesystem,program_options,random,system,thread,timer; \
cd $(DCDBDEPSPATH)/$(B) && \
./b2 -j $(MAKETHREADS) cxxflags="$(CXX11FLAGS)" install && touch $(DCDBDEPSPATH)/$(B)/.installed; \
else \
echo "Skipping Boost (already built)..."; \
......@@ -182,10 +234,10 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
echo "Patching net-snmp..."; \
cd $(DCDBDEPSPATH)/$(S) && (patch -N -p1 < $(DCDBDEPSPATH)/patches/$(S).patch || true); \
fi; \
cd $(DCDBDEPSPATH)/$(S) && env CFLAGS="$(CFLAGS)" ./configure --prefix=$(DCDBDEPLOYPATH) --with-default-snmp-version="3" \
cd $(DCDBDEPSPATH)/$(S) && env CC="$(CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=$(DCDBDEPLOYPATH) --with-default-snmp-version="3" \
--with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="$(DCDBDEPLOYPATH)/var/log/snmpd.log" \
--with-persistent-directory="$(DCDBDEPLOYPATH)/var/net-snmp" --disable-embedded-perl --without-perl-modules \
--with-openssl=$(DCDBDEPLOYPATH) ; \
--with-openssl=$(DCDBDEPLOYPATH) $(AUTOCONF_CROSS_FLAGS); \
cd $(DCDBDEPSPATH)/$(S) && env CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS) && make install && touch $(DCDBDEPSPATH)/$(S)/.installed; \
else \
echo "Skipping net-snmp (already built)..."; \
......@@ -196,7 +248,7 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
echo ""; \
echo "Building libuv..."; \
cd $(DCDBDEPSPATH)/$(U) && \
env CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS); \
env CC="$(CC)" CFLAGS="$(CFLAGS)" make -j $(MAKETHREADS); \
echo "Installing libuv..."; \
mkdir -p $(DCDBDEPLOYPATH)/include/uv-private; \
cd $(DCDBDEPSPATH)/$(U) && install -c include/uv.h $(DCDBDEPLOYPATH)/include/; \
......@@ -211,7 +263,7 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
fi
$(eval D := $(shell echo "$(DISTFILESPATHS)" | sed 's/.*cpp-driver/cpp-driver/' | sed 's/\ .*//'))
@if [ ! -e $(DCDBDEPSPATH)/$(D)/.installed ]; then \
if [ ! -e $(DCDBDEPSPATH)/$(D)/.installed ]; then \
echo ""; \
echo "Building cpp-driver..."; \
if [ -e $(DCDBDEPSPATH)/patches/$(D).patch ]; then \
......@@ -220,10 +272,12 @@ $(DCDBDEPSPATH)/.prerequesites: $(DCDBDEPSPATH)/.extract-distfiles
fi; \
mkdir -p $(DCDBDEPSPATH)/cpp-driver_build; \
cd $(DCDBDEPSPATH)/cpp-driver_build && \
cmake -DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
cmake --debug-output $(CMAKE_CROSS_FLAGS) \
-DCMAKE_CXX_FLAGS="$(CXX11FLAGS) -Wno-unused-command-line-argument -L$(DCDBDEPLOYPATH)/lib " \
-DCASS_USE_EXTERNAL_BOOST=YES \
-DBOOST_ROOT=$(DCDBDEPLOYPATH)/ \
-DOPENSSL_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DLIBUV_ROOT_DIR=$(DCDBDEPLOYPATH)/ \
-DCASS_BUILD_EXAMPLES=NO \
-DINSTALL_LIB_DIR=lib \
-DCMAKE_INSTALL_PREFIX=$(DCDBDEPLOYPATH)/ \
......@@ -278,13 +332,19 @@ $(DCDBDEPSPATH)/%/.dirstamp: $(DCDBDEPSPATH)/.download-distfiles
$(LIBRARIES): $(DCDBDEPSPATH)/.prerequesites
@echo ""
@echo "Building Library $@..."
@$(MAKE) -j $(MAKETHREADS) -C $@
@$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@
@echo "Installing Library $@..."
@$(MAKE) -C $@ install
@$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install
$(PROJECTS):
@echo ""
@echo "Building $@..."
@$(MAKE) -j $(MAKETHREADS) -C $@
@echo "Installing $@..."
@$(MAKE) -C $@ install
$(eval X := $(shell echo "$(SKIP_PROJECTS)" | grep "$@"))
@if [[ "$(X)" = "" ]]; then \
echo ""; \
echo "Building $@..."; \
$(MAKE) -j $(MAKETHREADS) CC=$(CC) CXX=$(CXX) -C $@ ; \
echo "Installing $@..."; \
$(MAKE) CC=$(CC) CXX=$(CXX) -C $@ install ; \
else \
echo ""; \
echo "Skipping $@..."; \
fi
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment