From 091fe0dc0a59a122df2376e90ac0370e1a538d8d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 4 Oct 2018 00:43:54 +0200 Subject: [PATCH 1/6] docker: switch to fedora 29 --- packaging/docker/Dockerfile.app | 2 +- packaging/docker/Dockerfile.dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/docker/Dockerfile.app b/packaging/docker/Dockerfile.app index 8128abb9c..cf5229b36 100644 --- a/packaging/docker/Dockerfile.app +++ b/packaging/docker/Dockerfile.app @@ -42,7 +42,7 @@ RUN cmake -DCPACK_GENERATOR=RPM .. RUN make -j$(nproc) doc RUN make -j$(nproc) package -FROM fedora:28 +FROM fedora:29 # Some of the dependencies are only available in our own repo ADD https://packages.fein-aachen.org/redhat/fein.repo /etc/yum.repos.d/ diff --git a/packaging/docker/Dockerfile.dev b/packaging/docker/Dockerfile.dev index cebb1dc8a..2afcb3eed 100644 --- a/packaging/docker/Dockerfile.dev +++ b/packaging/docker/Dockerfile.dev @@ -28,7 +28,7 @@ # along with this program. If not, see . ################################################################################### -FROM fedora:28 +FROM fedora:29 ARG GIT_REV=unknown ARG GIT_BRANCH=unknown From 06b4ede3e7b15346fbbe6a5f559edab7b52b5866 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 4 Oct 2018 00:44:18 +0200 Subject: [PATCH 2/6] docker: use new fedora package repo --- packaging/docker/Dockerfile.dev | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packaging/docker/Dockerfile.dev b/packaging/docker/Dockerfile.dev index 2afcb3eed..9621cbd86 100644 --- a/packaging/docker/Dockerfile.dev +++ b/packaging/docker/Dockerfile.dev @@ -36,12 +36,7 @@ ARG VERSION=unknown ARG VARIANT=unknown # Some of the dependencies are only available in our own repo -ADD https://packages.fein-aachen.org/redhat/fein.repo /etc/yum.repos.d/ - -# We need to use our own RPM packages of libwebsockets -# as the official ones do contain the CMake files -RUN dnf -y install --repo=fein \ - libwebsockets-2.4.2 +ADD https://packages.fein-aachen.org/fedora/fein.repo /etc/yum.repos.d/ # Toolchain RUN dnf -y install \ @@ -76,15 +71,16 @@ RUN dnf -y install \ libcurl-devel \ jansson-devel \ zeromq-devel \ - nanomsg-devel \ protobuf-devel \ protobuf-c-devel \ - libiec61850-devel \ librabbitmq-devel \ mosquitto-devel \ comedilib-devel comedilib \ libibverbs-devel \ - librdmacm-devel + librdmacm-devel \ + libwebsockets-devel \ + nanomsg \ + libiec61850 # Build & Install Criterion RUN cd /tmp && \ From 9c0d26448c7c9115b4c622b5121cd2725c69586b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 4 Oct 2018 00:44:36 +0200 Subject: [PATCH 3/6] cmake: fix detection of libwebsockets --- CMakeLists.txt | 2 +- lib/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4c984744..066137d4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,6 @@ endif() # Check packages find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) -find_package(Libwebsockets 2.3.0 REQUIRED) find_package(OpenSSL 1.0.0 REQUIRED) find_package(CURL 7.29 REQUIRED) find_package(Mosquitto) @@ -99,6 +98,7 @@ pkg_check_modules(LIBCONFIG IMPORTED_TARGET libconfig>=1.4.9) pkg_check_modules(RABBITMQ_C IMPORTED_TARGET librabbitmq>=0.8.0) pkg_check_modules(COMEDILIB IMPORTED_TARGET comedilib>=0.11.0) pkg_check_modules(LIBZMQ IMPORTED_TARGET libzmq>=2.2.0) +pkg_check_modules(LIBWEBSOCKETS IMPORTED_TARGET libwebsockets>=2.3.0) pkg_check_modules(NANOMSG IMPORTED_TARGET nanomsg) if(NOT NANOMSG_FOUND) pkg_check_modules(NANOMSG IMPORTED_TARGET libnanomsg>=1.0.0) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 3cfec4f2f..6082de21a 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -113,7 +113,7 @@ if(WITH_WEB) ) list(APPEND INCLUDE_DIRS ${LIBWEBSOCKETS_INCLUDE_DIRS}) - list(APPEND LIBRARIES websockets_shared) + list(APPEND LIBRARIES PkgConfig::LIBWEBSOCKETS) endif() if(WITH_API AND WITH_WEB) From 7dd4fc2f91ab12e5ced5b7b7b65b5caf3db349ce Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 4 Oct 2018 00:45:21 +0200 Subject: [PATCH 4/6] link against libm --- lib/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6082de21a..b46be03ea 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -34,6 +34,7 @@ set(LIBRARIES PkgConfig::JANSSON ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} + m ) set(LIB_SRC From 15ac4023f54b195a89a23f6c6cc05582b5e18e6b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 26 Sep 2018 22:19:10 +0000 Subject: [PATCH 5/6] fixes for compiling VILLASnode on ARM --- CMakeLists.txt | 6 ++++++ include/villas/log.h | 4 ++-- lib/CMakeLists.txt | 6 +++++- lib/log.c | 2 +- lib/memory.c | 2 +- lib/queue.c | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 066137d4d..bd832c6e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,12 @@ else() add_compile_options(-Wall -Werror) endif() +execute_process( + COMMAND uname -m + COMMAND tr -d '\n' + OUTPUT_VARIABLE ARCH +) + # Check OS check_include_file("sys/eventfd.h" HAS_EVENTFD) check_include_file("semaphore.h" HAS_SEMAPHORE) diff --git a/include/villas/log.h b/include/villas/log.h index 36ce7aead..031c16d11 100644 --- a/include/villas/log.h +++ b/include/villas/log.h @@ -74,7 +74,7 @@ enum log_facilities { LOG_WEBSOCKET = (1L << 29), LOG_OPAL = (1L << 30), LOG_COMEDI = (1L << 31), - LOG_IB = (1L << 32), + LOG_IB = (1LL << 32), /* Classes */ LOG_NODES = LOG_NODE | LOG_SOCKET | LOG_FILE | LOG_FPGA | LOG_NGSI | LOG_WEBSOCKET | LOG_OPAL | LOG_IB, @@ -148,7 +148,7 @@ void log_print(struct log *l, const char *lvl, const char *fmt, ...) void log_vprint(struct log *l, const char *lvl, const char *fmt, va_list va); /** Printf alike debug message with level. */ -void debug(long lvl, const char *fmt, ...) +void debug(long long lvl, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); /** Printf alike info message. */ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index b46be03ea..9015ef96d 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -73,9 +73,13 @@ set(LIB_SRC table.c bitset.c signal.c - tsc.c ) + +if(ARCH STREQUAL "x86_64") + list(APPEND LIB_SRC tsc.c) +endif() + if(IBVERBS_FOUND AND RDMACM_FOUND) list(APPEND LIB_SRC memory/ib.c) endif() diff --git a/lib/log.c b/lib/log.c index 66627a129..d472db6c7 100644 --- a/lib/log.c +++ b/lib/log.c @@ -216,7 +216,7 @@ int log_set_facility_expression(struct log *l, const char *expression) { bool negate; char *copy, *token; - long mask = 0, facilities = 0; + long long mask = 0, facilities = 0; copy = strdup(expression); token = strtok(copy, ","); diff --git a/lib/memory.c b/lib/memory.c index 436527198..86a6c9c5a 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -85,7 +85,7 @@ int memory_init(int hugepages) if (l.rlim_cur < lock) { if (l.rlim_max < lock) { if (getuid() != 0) { - warn("Failed to in increase ressource limit of locked memory from %zu to %zu bytes", l.rlim_cur, lock); + warn("Failed to in increase ressource limit of locked memory from %lu to %zu bytes", l.rlim_cur, lock); warn("Please re-run as super-user or raise manually via:"); warn(" $ ulimit -Hl %zu", lock); diff --git a/lib/queue.c b/lib/queue.c index 0b020b192..3f69079c9 100644 --- a/lib/queue.c +++ b/lib/queue.c @@ -44,7 +44,7 @@ int queue_init(struct queue *q, size_t size, struct memory_type *m) if (!IS_POW2(size)) { size_t old_size = size; size = LOG2_CEIL(size); - warn("A queue size was changed from %lu to %lu", old_size, size); + warn("A queue size was changed from %zu to %zu", old_size, size); } q->buffer_mask = size - 1; From d88c59aab4e7ccd18ce07ff3ab29b5f3086dbae3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 26 Sep 2018 22:47:58 +0000 Subject: [PATCH 6/6] bugfixes for ARM --- lib/kernel/kernel.c | 2 +- lib/log_helper.c | 2 +- lib/memory.c | 2 +- src/villas-node.cpp | 2 +- src/villas-pipe.cpp | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/kernel/kernel.c b/lib/kernel/kernel.c index aa9dacd19..08538c8ab 100644 --- a/lib/kernel/kernel.c +++ b/lib/kernel/kernel.c @@ -38,7 +38,7 @@ int kernel_get_cacheline_size() { -#ifdef __linux__ +#if defined(__linux__) && defined(__x86_64__) return sysconf(_SC_LEVEL1_ICACHE_LINESIZE); #else return 64; /** @todo fixme */ diff --git a/lib/log_helper.c b/lib/log_helper.c index e263ee0c6..3a90e6090 100644 --- a/lib/log_helper.c +++ b/lib/log_helper.c @@ -27,7 +27,7 @@ #include #include -void debug(long class, const char *fmt, ...) +void debug(long long class, const char *fmt, ...) { va_list ap; diff --git a/lib/memory.c b/lib/memory.c index 86a6c9c5a..24eb0b952 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -53,7 +53,7 @@ int memory_init(int hugepages) { info("Initialize memory sub-system: #hugepages=%d", hugepages); -#ifdef __linux__ +#if defined(__linux__) && defined(__x86_64__) int pagecnt, pagesz, ret; struct rlimit l; diff --git a/src/villas-node.cpp b/src/villas-node.cpp index 037b3f38f..3a1f8a7f0 100644 --- a/src/villas-node.cpp +++ b/src/villas-node.cpp @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) const char *uri = "opal-shmem.conf"; #else - char c; + int c; while ((c = getopt(argc, argv, "hV")) != -1) { switch (c) { case 'V': diff --git a/src/villas-pipe.cpp b/src/villas-pipe.cpp index 81996a2c1..39733ba19 100644 --- a/src/villas-pipe.cpp +++ b/src/villas-pipe.cpp @@ -255,7 +255,8 @@ int main(int argc, char *argv[]) json_t *cfg_cli = json_object(); - char c, *endptr; + int c; + char *endptr; while ((c = getopt(argc, argv, "Vhxrsd:l:L:t:f:o:")) != -1) { switch (c) { case 'V':