diff --git a/CMakeLists.txt b/CMakeLists.txt index fa4cac6b4..90b60ae09 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) @@ -75,7 +81,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) @@ -100,6 +105,7 @@ 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(ULDAQ IMPORTED_TARGET libuldaq>=1.0.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/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 3cfec4f2f..9015ef96d 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 @@ -72,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() @@ -113,7 +118,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) 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.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/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 436527198..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; @@ -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; 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..9621cbd86 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 @@ -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 && \ 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':