diff --git a/Dockerfile.dev b/Dockerfile.dev index f09c4143d..0bb25b983 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -68,9 +68,6 @@ RUN dnf -y install \ RUN pip install \ gcovr -ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig -ENV LD_LIBRARY_PATH /usr/local/lib - # Build & Install libxil COPY thirdparty/libxil /tmp/libxil RUN mkdir -p /tmp/libxil/build && cd /tmp/libxil/build && cmake .. && make install @@ -96,4 +93,4 @@ ENTRYPOINT villas WORKDIR /villas -ENTRYPOINT bash \ No newline at end of file +ENTRYPOINT bash diff --git a/Makefile b/Makefile index 34bc55a78..03c7d75c8 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,13 @@ CFLAGS += -std=c11 -MMD -mcx16 CFLAGS += -Wall -Werror -fdiagnostics-color=auto LDFLAGS += -L$(BUILDDIR) +# Some environment variables to increase compatability with Fedora and other distros +export PKG_CONFIG_PATH := /usr/local/lib/pkgconfig:/usr/lib/pkgconfig:$(PKG_CONFIG_PATH) +export LD_LIBRARY_PATH := /usr/local/lib:/usr/lib:$(LD_LIBRARY_PATH) + +# Some tools +PKGCONFIG := PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config + # We must compile without optimizations for gcov! ifdef DEBUG CFLAGS += -O0 -g diff --git a/lib/Makefile.villas.inc b/lib/Makefile.villas.inc index d6f3d3f6c..aef409a0a 100644 --- a/lib/Makefile.villas.inc +++ b/lib/Makefile.villas.inc @@ -37,13 +37,18 @@ LIB_SRCS += $(addprefix lib/nodes/, file.c cbuilder.c shmem.c) \ LIB_LDFLAGS = -shared LIB_LDLIBS = $(LDLIBS) -ldl -lrt -Wl,-soname,$(LIB_NAME).so.$(LIB_ABI_VERSION) -LIB_PKGS = openssl +LIB_PKGS += libwebsockets openssl + +ifneq ($(shell $(PKGCONFIG) --print-errors $(LIB_PKGS); echo $$?),0) +$(error Please install missing dependencies: make install-thirdparty) +endif + ######## Node types ######## # Enable Socket node type when libnl3 is available ifndef WITHOUT_SOCKET -ifeq ($(shell pkg-config libnl-route-3.0; echo $$?),0) +ifeq ($(shell $(PKGCONFIG) libnl-route-3.0; echo $$?),0) LIB_SRCS += $(addprefix lib/nodes/, socket.c) LIB_SRCS += $(addprefix lib/kernel/, nl.c tc.c if.c) LIB_SRCS += $(addprefix lib/, msg.c) @@ -53,7 +58,7 @@ endif # Enable VILLASfpga support when libxil is available ifndef WITHOUT_FPGA -ifeq ($(shell pkg-config libxil; echo $$?),0) +ifeq ($(shell $(PKGCONFIG) libxil; echo $$?),0) LIB_SRCS += $(addprefix lib/nodes/, fpga.c) LIB_SRCS += $(addprefix lib/kernel/, pci.c vfio.c) PKGS += libxil @@ -64,29 +69,27 @@ endif # Enable NGSI support ifndef WITHOUT_NGSI -ifeq ($(shell pkg-config libcurl jansson; echo $$?),0) +ifeq ($(shell $(PKGCONFIG) libcurl jansson; echo $$?),0) LIB_SRCS += lib/nodes/ngsi.c LIB_PKGS += libcurl jansson endif endif # Enable WebSocket support -ifndef WITHOUT_WEBSOCKETS -ifeq ($(shell pkg-config libwebsockets jansson; echo $$?),0) +ifeq ($(shell $(PKGCONFIG) libwebsockets jansson; echo $$?),0) LIB_SRCS += lib/nodes/websocket.c lib/webmsg.c LIB_PKGS += libwebsockets jansson endif -endif # Enable OPAL-RT Asynchronous Process support (will result in 32bit binary!!!) ifdef WITH_OPAL -ifneq (,$(wildcard thirdparty/opal/include/AsyncApi.h)) +ifneq ($(wildcard thirdparty/opal/include/AsyncApi.h),) LIB_OBJS += opal.o LIB_CFLAGS += -I thirdparty/opal/include LIB_LDFLAGS += -L/lib/i386-linux-gnu/ -L/usr/lib/i386-linux-gnu/ -Lthirdparty/opal/lib/redhawk/ LIB_LDLIBS += -lOpalAsyncApiCore -lOpalCore -lOpalUtils -lirc - + # libOpalAsyncApi is a 32bit library. So we need to build everything in 32bit CFLAGS += -m32 LDFLAGS += -m32 @@ -95,7 +98,8 @@ endif endif # Add flags by pkg-config -LIB_LDLIBS += $(shell pkg-config --libs ${LIB_PKGS}) +LIB_LDLIBS += $(shell $(PKGCONFIG) --libs $(LIB_PKGS)) +LIB_CFLAGS += $(shell $(PKGCONFIG) --cflags $(LIB_PKGS)) LIB_OBJS = $(patsubst %.c, $(BUILDDIR)/%.o, $(LIB_SRCS))