You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2016/10/18 19:26:20 UTC

[18/50] [abbrv] celix git commit: CELIX-377: Fixes RPATH issues

CELIX-377: Fixes RPATH issues


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/6425b408
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/6425b408
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/6425b408

Branch: refs/heads/release/celix-2.0.0
Commit: 6425b408c0062afa0a688369ad4f704c5ce9e29e
Parents: 1b25a0a
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Fri Oct 7 14:56:02 2016 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Fri Oct 7 14:56:02 2016 +0200

----------------------------------------------------------------------
 CMakeLists.txt                                         |  4 +---
 cmake/cmake_celix/Packaging.cmake                      |  1 +
 dfi/CMakeLists.txt                                     |  2 +-
 dfi/private/src/dyn_message.c                          | 13 ++++++++-----
 dfi/private/src/dyn_type.c                             |  5 ++---
 .../client/private/src/echo_client_activator.c         |  2 +-
 examples/hello_world_test/private/src/activator.c      |  2 +-
 examples/mongoose/private/src/activator.c              |  2 +-
 .../client/private/src/client.c                        |  2 +-
 .../greeting/private/src/activator.c                   |  2 +-
 framework/CMakeLists.txt                               |  2 +-
 launcher/CMakeLists.txt                                | 12 ++++++------
 utils/CMakeLists.txt                                   |  2 +-
 13 files changed, 26 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1c5886..421a042 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,12 +19,10 @@ cmake_minimum_required (VERSION 3.2)
 project (Celix C CXX)
 
 cmake_policy(SET CMP0012 NEW)
+include(GNUInstallDirs)                                                                                                                                                                             
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
 
-set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_NAME_DIR "@rpath")
-
 SET(CMAKE_BUILD_TYPE "Debug")
 
 # see https://public.kitware.com/Bug/view.php?id=15696

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/cmake/cmake_celix/Packaging.cmake
----------------------------------------------------------------------
diff --git a/cmake/cmake_celix/Packaging.cmake b/cmake/cmake_celix/Packaging.cmake
index 7ff5091..eeb0a39 100644
--- a/cmake/cmake_celix/Packaging.cmake
+++ b/cmake/cmake_celix/Packaging.cmake
@@ -251,6 +251,7 @@ SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY \"0\")
     if(BUNDLE_SOURCES) 
         bundle_private_libs(${BUNDLE_TARGET_NAME} ${BUNDLE_TARGET_NAME})
         set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUNDLE_ACTIVATOR" "$<TARGET_SONAME_FILE_NAME:${BUNDLE_TARGET_NAME}>")
+        set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES "BUILD_WITH_INSTALL_RPATH" true)
 
         if(APPLE)
             set_target_properties(${BUNDLE_TARGET_NAME} PROPERTIES INSTALL_RPATH "@loader_path")

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/dfi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/dfi/CMakeLists.txt b/dfi/CMakeLists.txt
index 78ee2e5..6fe7071 100644
--- a/dfi/CMakeLists.txt
+++ b/dfi/CMakeLists.txt
@@ -56,7 +56,7 @@ add_library(celix_dfi SHARED
 set_target_properties(celix_dfi PROPERTIES "SOVERSION" 1)
 target_link_libraries(celix_dfi celix_utils ${FFI_LIBRARIES} ${JANSSON_LIBRARY})
 
-install(TARGETS celix_dfi DESTINATION lib COMPONENT framework)
+install(TARGETS celix_dfi DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
 FILE(GLOB files "public/include/*.h" ${MEMSTREAM_INCLUDES})
 INSTALL(FILES ${files} DESTINATION include/celix/dfi COMPONENT framework)
 

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/dfi/private/src/dyn_message.c
----------------------------------------------------------------------
diff --git a/dfi/private/src/dyn_message.c b/dfi/private/src/dyn_message.c
index 3e2ca99..652be83 100644
--- a/dfi/private/src/dyn_message.c
+++ b/dfi/private/src/dyn_message.c
@@ -93,6 +93,7 @@ int dynMessage_parse(FILE *descriptor, dyn_message_type **out) {
     if (status == OK) {
         *out = msg;
     } else if (msg != NULL) {
+        LOG_ERROR("Error parsing msg\n");
         dynMessage_destroy(msg);
     }
     return status;
@@ -222,7 +223,7 @@ static int dynMessage_parseTypes(dyn_message_type *msg, FILE *stream) {
     while (peek != ':' && peek != EOF) {
         ungetc(peek, stream);
 
-        char *name;
+        char *name = NULL;
         status = dynCommon_parseName(stream, &name);
 
         if (status == OK) {
@@ -231,10 +232,7 @@ static int dynMessage_parseTypes(dyn_message_type *msg, FILE *stream) {
 
         dyn_type *type = NULL;
         if (status == OK) {
-            dynType_parse(stream, name, &msg->types, &type);
-        }
-        if (name != NULL) {
-            free(name);
+            status = dynType_parse(stream, name, &msg->types, &type);
         }
 
         if (status == OK) {
@@ -245,6 +243,7 @@ static int dynMessage_parseTypes(dyn_message_type *msg, FILE *stream) {
         if (status == OK) {
             entry = calloc(1, sizeof(*entry));
             if (entry != NULL) {
+                LOG_DEBUG("Adding type '%s' with pointer %p to types", name, type);
                 entry->type = type;
                 TAILQ_INSERT_TAIL(&msg->types, entry, entries);
             } else {
@@ -253,6 +252,10 @@ static int dynMessage_parseTypes(dyn_message_type *msg, FILE *stream) {
             }
         }
 
+        if (name != NULL) {
+            free(name);
+        }
+
         if (status != OK) {
             if (type != NULL) {
                 dynType_destroy(type);

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/dfi/private/src/dyn_type.c
----------------------------------------------------------------------
diff --git a/dfi/private/src/dyn_type.c b/dfi/private/src/dyn_type.c
index 2b83f25..9beea1d 100644
--- a/dfi/private/src/dyn_type.c
+++ b/dfi/private/src/dyn_type.c
@@ -427,15 +427,14 @@ static int dynType_parseRefByValue(FILE *stream, dyn_type *type) {
             LOG_ERROR("Error cannot find type '%s'", name);
         }
         free(name);
-    } 
 
-    if (status == OK) {
         int c = fgetc(stream);
         if (c != ';') {
             status = PARSE_ERROR;
             LOG_ERROR("Error expected ';' got '%c'", c);
         } 
-    }
+    } 
+
 
     return status;
 }

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/examples/echo_service/client/private/src/echo_client_activator.c
----------------------------------------------------------------------
diff --git a/examples/echo_service/client/private/src/echo_client_activator.c b/examples/echo_service/client/private/src/echo_client_activator.c
index f03a741..4026886 100644
--- a/examples/echo_service/client/private/src/echo_client_activator.c
+++ b/examples/echo_service/client/private/src/echo_client_activator.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/examples/hello_world_test/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/hello_world_test/private/src/activator.c b/examples/hello_world_test/private/src/activator.c
index 8bf9501..2185e16 100644
--- a/examples/hello_world_test/private/src/activator.c
+++ b/examples/hello_world_test/private/src/activator.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/examples/mongoose/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/mongoose/private/src/activator.c b/examples/mongoose/private/src/activator.c
index 2fd51bb..beea9df 100644
--- a/examples/mongoose/private/src/activator.c
+++ b/examples/mongoose/private/src/activator.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c b/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
index 41aff7c..dfae0ce 100644
--- a/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
+++ b/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
----------------------------------------------------------------------
diff --git a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
index 64d324a..d5b0b3f 100644
--- a/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
+++ b/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
@@ -1,4 +1,4 @@
-#include <sys/cdefs.h>/**
+/**
  *Licensed to the Apache Software Foundation (ASF) under one
  *or more contributor license agreements.  See the NOTICE file
  *distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/framework/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt
index 06eead2..06f0c9f 100644
--- a/framework/CMakeLists.txt
+++ b/framework/CMakeLists.txt
@@ -76,7 +76,7 @@ if (FRAMEWORK)
     endif()
     target_link_libraries(celix_framework celix_utils ${UUID} ${ZLIB_LIBRARY} ${CURL_LIBRARIES})
 
-    install(TARGETS celix_framework DESTINATION lib COMPONENT framework)
+    install(TARGETS celix_framework DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
     FILE(GLOB files "public/include/*.h")
     INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)
     INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/" DESTINATION share/celix/cmake/modules COMPONENT framework) 

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/launcher/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index e1f9a9c..4f9056a 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -18,20 +18,20 @@ celix_subproject(LAUNCHER "Option to build the launcher" "ON" DEPS UTILS FRAMEWO
 if (LAUNCHER) 
     find_package(CURL REQUIRED)
 
-    SET(CMAKE_SKIP_BUILD_RPATH  FALSE) #TODO needed?
-    SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) #TODO needed?
-    SET(CMAKE_INSTALL_RPATH "${PROJECT_BINARY_DIR}/framework" "${PROJECT_BINARY_DIR}/utils")
-
     include_directories(public/include)
     
     add_executable(celix
         private/src/main
     )
+
+    set_target_properties(celix PROPERTIES "INSTALL_RPATH" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
     
     target_link_libraries(celix celix_framework ${CURL_LIBRARIES})
+    target_link_libraries(celix celix_dfi) #note not strictly needed, but ensure libdfi is a dep for the framework, useful when create docker images
+
     include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
     include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
     include_directories("${CURL_INCLUDE_DIRS}")
     
-    install(TARGETS celix RUNTIME DESTINATION bin COMPONENT framework)
-endif (LAUNCHER) 
\ No newline at end of file
+    install(TARGETS celix RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT framework)
+endif (LAUNCHER) 

http://git-wip-us.apache.org/repos/asf/celix/blob/6425b408/utils/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 6c273bd..3c20b90 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -63,7 +63,7 @@ if (UTILS)
         target_link_libraries(celix_utils m)
     ENDIF()
     
-    install(TARGETS celix_utils DESTINATION lib COMPONENT framework)
+    install(TARGETS celix_utils DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework)
     FILE(GLOB files "public/include/*.h")
     INSTALL(FILES ${files} DESTINATION include/celix COMPONENT framework)