changeset 2451:a4032b162502

lsb working
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jan 2018 13:07:57 +0100
parents ade8b4ddd8a6
children 383337f21655
files Resources/LinuxStandardBaseToolchain.cmake UnitTestsSources/PluginsTests.cpp
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/LinuxStandardBaseToolchain.cmake	Wed Jan 03 11:02:59 2018 +0100
+++ b/Resources/LinuxStandardBaseToolchain.cmake	Wed Jan 03 13:07:57 2018 +0100
@@ -48,16 +48,19 @@
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include" CACHE INTERNAL "" FORCE)
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward" CACHE INTERNAL "" FORCE)
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH}" CACHE INTERNAL "" FORCE)
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH} --lsb-besteffort" CACHE INTERNAL "" FORCE)
 
 if (NOT "${LSB_CXX}" STREQUAL "")
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cxx=${LSB_CXX}")
   SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
+  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cxx=${LSB_CXX}")
 endif()
 
 if (NOT "${LSB_CC}" STREQUAL "")
   SET(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} --lsb-cc=${LSB_CC}")
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-cc=${LSB_CC}")
   SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
+  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --lsb-cc=${LSB_CC}")
 endif()
 
--- a/UnitTestsSources/PluginsTests.cpp	Wed Jan 03 11:02:59 2018 +0100
+++ b/UnitTestsSources/PluginsTests.cpp	Wed Jan 03 13:07:57 2018 +0100
@@ -58,6 +58,16 @@
   ASSERT_TRUE(l.HasFunction("GetVersionExW"));
   ASSERT_FALSE(l.HasFunction("world"));
 
+#elif defined(__LSB_VERSION__)
+  // For Linux Standard Base, we use a low-level shared library coming
+  // with glibc:
+  // http://www.linuxfromscratch.org/lfs/view/6.5/chapter06/glibc.html
+  SharedLibrary l("libSegFault.so");
+  ASSERT_THROW(l.GetFunction("world"), OrthancException);
+  ASSERT_TRUE(l.GetFunction("_init") != NULL);
+  ASSERT_TRUE(l.HasFunction("_init"));
+  ASSERT_FALSE(l.HasFunction("world"));
+
 #elif defined(__linux__) || defined(__FreeBSD_kernel__)
   SharedLibrary l("libdl.so");
   ASSERT_THROW(l.GetFunction("world"), OrthancException);