From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

Fixed compilation errors in modules httpserver-jolokia-plugin, josvsym and monitoring-agent mostly related to strlcpy

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/modules/httpserver-jolokia-plugin/Makefile b/modules/httpserver-jolokia-plugin/Makefile
--- a/modules/httpserver-jolokia-plugin/Makefile
+++ b/modules/httpserver-jolokia-plugin/Makefile
@@ -1,8 +1,6 @@
-
-INCLUDES = -isystem $(miscbase)/usr/include -I$(src)/build/$(mode)/gen/include
-INCLUDES += -I../../include -I. -I../../java -I../../arch/$(ARCH) -I../..
-INCLUDES += -I$(jdkbase)/include -I$(jdkbase)/include/linux
-INCLUDES += -I../httpserver-api
+SRC = $(shell readlink -f ../..)
+include $(SRC)/modules/java-base/common.gmk
+INCLUDES += -I. -I../httpserver-api

 # compiler flags:
 #  -g    adds debugging information to the executable file
@@ -25,10 +23,6 @@ endif
 ifndef OSV_BUILD_PATH
        OSV_BUILD_PATH = $(src)/build/$(mode).$(ARCH)
 endif
-miscbase = $(src)/external/$(ARCH)/misc.bin
-libs-dir = $(miscbase)/usr/lib64
-boost-libs := $(libs-dir)/libboost_system.so \
-              $(libs-dir)/libboost_filesystem.so

 # the build target executable:
 TARGET = jolokia
@@ -37,15 +31,21 @@ JSON_CC_FILES := $(subst .json,.json.cc,$(subst api-doc/listings/,autogen/,$(JSO
 CPP_FILES := $(JSON_CC_FILES) $(wildcard *.cc)
 OBJ_FILES := $(addprefix obj/,$(CPP_FILES:.cc=.o))

-STATIC_LIBS = $(libs-dir)/libboost_program_options.a
+# link with -mt if present, else the base version (and hope it is multithreaded)
+boost-mt := -mt
+boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
+ifeq ($(filter /%,$(boost-lib-dir)),)
+    boost-mt :=
+ boost-lib-dir := $(dir $(shell $(CC) --print-file-name libboost_system$(boost-mt).a))
+    ifeq ($(filter /%,$(boost-lib-dir)),)
+        $(error Error: libboost_system.a needs to be installed.)
+    endif
+endif
+
+STATIC_LIBS = $(boost-lib-dir)/libboost_program_options$(boost-mt).a
 DYN_LIBS = -lpthread -ldl -L$(libs-dir) -lyaml-cpp $(boost-libs)

-ifeq ($(use_host),y)
-       DYN_LIBS += -lssl -lcrypto
-else
-       DYN_LIBS += $(libs-dir)/libssl.so.10 \
-               $(libs-dir)/libcrypto.so.10
-endif
+DYN_LIBS += -lssl -lcrypto

 LIBS = $(DYN_LIBS) $(STATIC_LIBS)

diff --git a/modules/josvsym/Makefile b/modules/josvsym/Makefile
--- a/modules/josvsym/Makefile
+++ b/modules/josvsym/Makefile
@@ -1,7 +1,6 @@
-INCLUDES = $(shell $(CXX) -E -xc++ - -v </dev/null 2>&1 | awk '/^End/ {exit} /^ .*c\+\+/ {print "-isystem" $$0}')
-INCLUDES       += -isystem $(miscbase)/usr/include
-INCLUDES       += -I../../include -I. -I../../java -I../../arch/$(ARCH) -I../..
-INCLUDES       += -I$(jdkbase)/include -I$(jdkbase)/include/linux
+SRC = $(shell readlink -f ../..)
+include $(SRC)/modules/java-base/common.gmk
+INCLUDES += -I.

 # compiler flags:
 #  -g    adds debugging information to the executable file
@@ -23,11 +22,6 @@ ifndef OSV_BUILD_PATH
        OSV_BUILD_PATH = $(src)/build/$(mode).$(ARCH)
 endif

-#miscbase = $(src)/external/$(ARCH)/misc.bin
-#libs-dir = $(miscbase)/usr/lib64
-#boost-libs := $(libs-dir)/libboost_system.so \
-#              $(libs-dir)/libboost_filesystem.so
-
 MODULE         = josvsym
 OUTDIR         := $(OSV_BUILD_PATH)/modules/$(MODULE)
 CPP_FILES      := josvsym.cc
@@ -61,6 +55,6 @@ $(OUTDIR)/%.o : %.cc
                $(call quiet, $(CXX) $(CXXFLAGS) -c -MMD  -o $@ $<, CXX $@)

 clean          :
-               $(call quiet, $(RM) $(TARGET), CLEAN)
+               $(call quiet, $(RM) -f $(TARGET), CLEAN)
                $(call very-quiet, $(RM) -rf $(OUTDIR/*.o))
                $(call very-quiet, $(RM) -rf $(OUTDIR/*.d))
diff --git a/modules/monitoring-agent/Makefile b/modules/monitoring-agent/Makefile
--- a/modules/monitoring-agent/Makefile
+++ b/modules/monitoring-agent/Makefile
@@ -1,17 +1,12 @@
-miscbase = $(src)/external/$(ARCH)/misc.bin
-
-INCLUDES = -isystem $(miscbase)/usr/include -I$(src)/build/$(mode)/gen/include
-INCLUDES += -I../../include -I. -I../../java -I../../arch/$(ARCH) -I../..
-INCLUDES += -I$(jdkbase)/include -I$(jdkbase)/include/linux
-
+SRC = $(shell readlink -f ../..)
+include $(SRC)/modules/java-base/common.gmk
+INCLUDES += -I.

 # compiler flags:
 #  -g    adds debugging information to the executable file
 #  -Wall turns on most, but not all, compiler warnings
 autodepend = -MD -MT $@ -MP
 CXXFLAGS  = -g -rdynamic -Wall -std=c++11 -fPIC $(INCLUDES) $(autodepend)
-src = ../..
-

 ifndef ARCH
        ARCH = x64
@@ -21,12 +16,9 @@ ifndef mode
        mode = release
 endif

-boost-lib-dir = $(miscbase)/usr/lib64
-boost-libs := $(boost-lib-dir)/libboost_system.so \
-              $(boost-lib-dir)/libboost_filesystem.so
+boost-libs := -lboost_system -lboost_filesystem

-
-HTTPSERVER_DIR = ../../modules/httpserver
+HTTPSERVER_DIR = $(src)/modules/httpserver
 INCLUDES += -I$(HTTPSERVER_DIR)

 # the build target executable:
@@ -35,7 +27,7 @@ CPP_FILES := main.cc monitor-agent.cc client.cc
 OBJ_FILES := $(addprefix obj/,$(CPP_FILES:.cc=.o))
 DEPS := $(OBJ_FILES:.o=.d)

-LIBS = -lpthread $(boost-libs) -lyaml-cpp $(DEPEDNDS_LIBS) -L$(boost-lib-dir)
+LIBS = -lpthread $(boost-libs) -lyaml-cpp $(DEPEDNDS_LIBS)

 quiet = $(if $V, $1, @echo " $2"; $1)
 very-quiet = $(if $V, $1, @$1)
@@ -48,18 +40,14 @@ all: init $(TARGET).so
 init:
        $(call very-quiet, mkdir -p obj)

-$(TARGET): $(OBJ_FILES)
- $(call quiet, $(CXX) $(CXXFLAGS) -o $(TARGET) $^ $(LIBS) $(boost-lib-dir)/libboost_program_options.a, LINK $@)
-
 $(TARGET).so: $(OBJ_FILES)
- $(call quiet, $(CXX) $(CXXFLAGS) $(STATIC_LIBS) -shared -o $(TARGET).so $^ $(LIBS), LINK $@) + $(call quiet, $(CXX) $(CXXFLAGS) -shared -o $(TARGET).so $^ $(LIBS), LINK $@)

 obj/%.o: %.cc
        $(call quiet, $(CXX) $(CXXFLAGS) -c -o $@ $<, CXX $@)

 clean:
-       $(call quiet, $(RM) $(TARGET), CLEAN)
-       $(call very-quiet, $(RM) $(TARGET).so)
+       $(call quiet, $(RM) -f $(TARGET).so, CLEAN)
        $(call very-quiet, $(RM) -rf obj/*)

 ifneq ($(MAKECMDGOALS),clean)
diff --git a/modules/monitoring-agent/client.cc b/modules/monitoring-agent/client.cc
--- a/modules/monitoring-agent/client.cc
+++ b/modules/monitoring-agent/client.cc
@@ -93,7 +93,7 @@ client& client::upload(const std::string& server, const std::string& path,
     connect_with_timeout(io_service, _socket, _endpoint, ec,
                          boost::posix_time::seconds(time_out));

-    if (ec != 0) {
+    if (ec) {
         throw connection_exception(
             std::string("connect failed ") + ec.message());
     }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000705079058f05cdb1%40google.com.

Reply via email to