Skip to contentSkip to conversation

glog: fix installation path

PATCH New Vyacheslav Yurkov 3 participants 4 messages Dec 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 glog: fix installation path

From: Vyacheslav Yurkov <[email protected]>

When glog is compiled with multilib support, it shouldn't use hardcoded paths. Paths substitued by CMake should be used instead.

---
 .../glog/0003-installation-path-fix.patch     | 65 +++++++++++++++++++
 meta-oe/recipes-support/glog/glog_0.3.5.bb    |  1 +
 2 files changed, 66 insertions(+)
 create mode 100644 meta-oe/recipes-support/glog/glog/0003-installation-path-fix.patch
meta-oe/recipes-support/glog/glog/0003-installation-path-fix.patch new file +65 -0
new file mode 100644
index 000000000..641f70cb2
@@ -0,0 +1,65 @@
+diff -uNr a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt	2018-12-05 12:55:59.630792054 +0100
++++ b/CMakeLists.txt	2018-12-05 13:00:22.922269200 +0100
+@@ -403,10 +403,15 @@
+ 
+ set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}")
+ 
++set (_glog_CMake_BINDIR ${CMAKE_INSTALL_BINDIR})
++set (_glog_CMake_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
++set (_glog_CMake_LIBDIR ${CMAKE_INSTALL_LIBDIR})
++set (_glog_CMake_INSTALLDIR ${_glog_CMake_LIBDIR}/cmake/glog)
++
+ target_include_directories (glog BEFORE PUBLIC
+   "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
+   "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
+-  "$<INSTALL_INTERFACE:include>"
++  "$<INSTALL_INTERFACE:${_glog_CMake_INCLUDE_DIR}>"
+   PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
+   PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
+ 
+@@ -543,10 +548,10 @@
+ 
+ install (TARGETS glog
+   EXPORT glog-targets
+-  RUNTIME DESTINATION bin
+-  PUBLIC_HEADER DESTINATION include/glog
+-  LIBRARY DESTINATION lib
+-  ARCHIVE DESTINATION lib)
++  RUNTIME DESTINATION ${_glog_CMake_BINDIR}
++  PUBLIC_HEADER DESTINATION ${_glog_CMake_INCLUDE_DIR}/glog
++  LIBRARY DESTINATION ${_glog_CMake_LIBDIR}
++  ARCHIVE DESTINATION ${_glog_CMake_LIBDIR})
+ 
+ if (gflags_FOUND)
+   set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION})")
+@@ -554,7 +559,7 @@
+ 
+ configure_package_config_file (glog-config.cmake.in
+   ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
+-  INSTALL_DESTINATION lib/cmake/glog
++  INSTALL_DESTINATION ${_glog_CMake_INSTALLDIR}
+   NO_CHECK_REQUIRED_COMPONENTS_MACRO)
+ 
+ write_basic_package_version_file (glog-config-version.cmake VERSION
+@@ -567,6 +572,7 @@
+   ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
+   ${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake
+   ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLibunwind.cmake
+-  DESTINATION lib/cmake/glog)
++  DESTINATION ${_glog_CMake_INSTALLDIR})
+ 
+-install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog)
++install (EXPORT glog-targets NAMESPACE glog:: DESTINATION
++  ${_glog_CMake_INSTALLDIR})
+diff -uNr a/glog-config.cmake.in b/glog-config.cmake.in
+--- a/glog-config.cmake.in	2018-12-05 12:55:59.630792054 +0100
++++ b/glog-config.cmake.in	2018-12-05 13:05:19.547196843 +0100
+@@ -4,6 +4,7 @@
+ 
+ @gflags_DEPENDENCY@
+ 
++list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+ find_dependency (Libunwind)
+ 
+ include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake")
meta-oe/recipes-support/glog/glog_0.3.5.bb +1 -0
index 5e58450c2..3de01ef5b 100644
@@ -12,6 +12,7 @@ SRC_URI = " \
     git://github.com/google/glog.git;branch=v035 \
     file://0001-Rework-CMake-glog-VERSION-management.patch \
     file://0002-Find-Libunwind-during-configure.patch \
+    file://0003-installation-path-fix.patch \
 "
 
 SRCREV = "a6a166db069520dbbd653c97c2e5b12e08a8bb26"
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/1 glog: fix libunwind search in components which depend on glog

* libunwind is not found when using find_package(glog) from some other recipe, without this change it fails with:

CMake Error at /OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot-native/usr/share/cmake-3.12/Modules/CMakeFindDependencyMacro.cmake:48 (find_package):
By not providing "FindLibunwind.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Libunwind", but CMake did not find one.

Could not find a package configuration file provided by "Libunwind" with any of the following names:

LibunwindConfig.cmake
libunwind-config.cmake

Add the installation prefix of "Libunwind" to CMAKE_PREFIX_PATH or set
"Libunwind_DIR" to a directory containing one of the above files. If
"Libunwind" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
/OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot/usr/lib/cmake/glog/glog-config.cmake:31 (find_dependency) CMakeLists.txt:17 (find_package)

-- Configuring incomplete, errors occurred!

* this might help others when upgrading to thud which has newer glog:

mtp-server in meta-luneos layer is the only user of glog I could find in public layers, it was failing to build with 0.3.5 version of glog (and building fine with 0.3.4 glog which was built with autotools instead of cmake and provided pkg-config instead of glog-config.cmake)

First part is relatively simple, update CMakeLists.txt to use cmake machinery instead of pkg-config:

-pkg_check_modules(GLOG REQUIRED libglog)
+find_package(glog 0.3.5 REQUIRED)

and update the use of GLOG_* variables, e.g.:
- ${GLOG_LIBRARIES}
+ glog::glog

interestingly glog::glog passes the glog library with whole path, in my case:
/OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/ \
mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot/usr/lib/ \
libglog.so.0.3.5 -lunwind -lunwind-aarch64
instead of just -lglog -unwind -lunwind-aarch64 which would work as well, because sysroot is configured correctly elsewhere.

I'm not sure if this is really expected behavior of glog::glog or another bug in glog-config.cmake.

---
 .../0002-Find-Libunwind-during-configure.patch    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch +12 -3
index 15cf67fd2e..4d7642a907 100644
@@ -109,12 +109,21 @@ diff -uNr a/CMakeLists.txt b/CMakeLists.txt
  
  install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog)
 diff -uNr a/glog-config.cmake.in b/glog-config.cmake.in
---- a/glog-config.cmake.in	2018-11-20 15:49:07.576278417 +0100
-+++ b/glog-config.cmake.in	2018-11-20 15:52:32.330418489 +0100
-@@ -4,4 +4,6 @@
+--- a/glog-config.cmake.in	2018-11-02 14:02:21.784835854 +0100
++++ b/glog-config.cmake.in	2018-11-02 14:03:16.796935594 +0100
+@@ -4,4 +4,15 @@
  
  @gflags_DEPENDENCY@
  
++# Record the state of the CMake module path when this script was
++# called so that we can ensure that we leave it in the same state on
++# exit as it was on entry, but modify it locally.
++set(UNWIND_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
++
++set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
 +find_dependency (Libunwind)
++
++# Restore original module path
++set(CMAKE_MODULE_PATH "${UNWIND_CMAKE_MODULE_PATH}")
 +
  include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake")
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH][meta-oe] glog: fix libunwind search in components which depend on glog

This might be actually unnecessary with the:

+list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

which sneaked in, in the "glog: fix installation path"

Quoted 99 lines · Martin Jansa

* libunwind is not found when using find_package(glog) from some other recipe, without this change it fails with:

CMake Error at /OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot-native/usr/share/cmake-3.12/Modules/CMakeFindDependencyMacro.cmake:48 (find_package):
By not providing "FindLibunwind.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Libunwind", but CMake did not find one.

Could not find a package configuration file provided by "Libunwind" with any of the following names:

LibunwindConfig.cmake
libunwind-config.cmake

Add the installation prefix of "Libunwind" to CMAKE_PREFIX_PATH or set "Libunwind_DIR" to a directory containing one of the above files. If "Libunwind" provides a separate development package or SDK, be sure it
has
been installed.
Call Stack (most recent call first):

/OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot/usr/lib/cmake/glog/glog-config.cmake:31 (find_dependency)
CMakeLists.txt:17 (find_package)

-- Configuring incomplete, errors occurred!

* this might help others when upgrading to thud which has newer glog:

mtp-server in meta-luneos layer is the only user of glog I could find in public layers, it was failing to build with 0.3.5 version of glog (and building fine with 0.3.4 glog which was built with autotools instead of cmake and provided pkg-config instead of glog-config.cmake)

First part is relatively simple, update CMakeLists.txt to use cmake machinery instead of pkg-config:

(quoted diff) +1 -1
-pkg_check_modules(GLOG REQUIRED libglog)
+find_package(glog 0.3.5 REQUIRED)

and update the use of GLOG_* variables, e.g.:

(quoted diff) +1 -1
-  ${GLOG_LIBRARIES}
+  glog::glog

interestingly glog::glog passes the glog library with whole path, in my case:
/OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/ \
mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot/usr/lib/ \
libglog.so.0.3.5 -lunwind -lunwind-aarch64
instead of just -lglog -unwind -lunwind-aarch64 which would work as well, because sysroot is configured correctly elsewhere.

I'm not sure if this is really expected behavior of glog::glog or another bug in glog-config.cmake.

---
 .../0002-Find-Libunwind-during-configure.patch    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch b/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch index 15cf67fd2e..4d7642a907 100644
---
a/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch
+++
b/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch

meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch +12 -4
@@ -109,12 +109,21 @@ diff -uNr a/CMakeLists.txt b/CMakeLists.txt
 
  install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog)
 diff -uNr a/glog-config.cmake.in b/glog-config.cmake.in
---- a/glog-config.cmake.in     2018-11-20 15:49:07.576278417 +0100
-+++ b/glog-config.cmake.in     2018-11-20 15:52:32.330418489 +0100
-@@ -4,4 +4,6 @@
+--- a/glog-config.cmake.in     2018-11-02 14:02:21.784835854 +0100
++++ b/glog-config.cmake.in     2018-11-02 14:03:16.796935594 +0100
+@@ -4,4 +4,15 @@
 
  @gflags_DEPENDENCY@
 
++# Record the state of the CMake module path when this script was
++# called so that we can ensure that we leave it in the same state on
++# exit as it was on entry, but modify it locally.
++set(UNWIND_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
++
++set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
 +find_dependency (Libunwind)
++
++# Restore original module path
++set(CMAKE_MODULE_PATH "${UNWIND_CMAKE_MODULE_PATH}")
 +
  include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake")
--

2.17.1

#3 lore raw

Re: [PATCH][meta-oe] glog: fix libunwind search in components which depend on glog

Thanks Martin, I have picked https://patchwork.openembedded.org/patch/156922/
hopefully that is all we need

Quoted 113 lines · Martin Jansa

This might be actually unnecessary with the:

+list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

which sneaked in, in the "glog: fix installation path"

Quoted 96 lines · Martin Jansa

* libunwind is not found when using find_package(glog) from some other recipe, without this change it fails with:

CMake Error at /OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot-native/usr/share/cmake-3.12/Modules/CMakeFindDependencyMacro.cmake:48 (find_package):
By not providing "FindLibunwind.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Libunwind", but CMake did not find one.

Could not find a package configuration file provided by "Libunwind" with any of the following names:

LibunwindConfig.cmake
libunwind-config.cmake

Add the installation prefix of "Libunwind" to CMAKE_PREFIX_PATH or set "Libunwind_DIR" to a directory containing one of the above files. If "Libunwind" provides a separate development package or SDK, be sure it
has
been installed.
Call Stack (most recent call first):

/OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot/usr/lib/cmake/glog/glog-config.cmake:31 (find_dependency)
CMakeLists.txt:17 (find_package)

-- Configuring incomplete, errors occurred!

* this might help others when upgrading to thud which has newer glog:

mtp-server in meta-luneos layer is the only user of glog I could find in public layers, it was failing to build with 0.3.5 version of glog (and building fine with 0.3.4 glog which was built with autotools instead of cmake and provided pkg-config instead of glog-config.cmake)

First part is relatively simple, update CMakeLists.txt to use cmake machinery instead of pkg-config:

(quoted diff) +1 -1
-pkg_check_modules(GLOG REQUIRED libglog)
+find_package(glog 0.3.5 REQUIRED)

and update the use of GLOG_* variables, e.g.:

(quoted diff) +1 -1
-  ${GLOG_LIBRARIES}
+  glog::glog

interestingly glog::glog passes the glog library with whole path, in my case:
/OE/build/owpb/webos-ports/tmp-glibc/work/tissot-webos-linux/ \
mtp-server/0.0.3+gitrAUTOINC+6159f1a143-r0/recipe-sysroot/usr/lib/ \
libglog.so.0.3.5 -lunwind -lunwind-aarch64
instead of just -lglog -unwind -lunwind-aarch64 which would work as well, because sysroot is configured correctly elsewhere.

I'm not sure if this is really expected behavior of glog::glog or another bug in glog-config.cmake.

---
 .../0002-Find-Libunwind-during-configure.patch    | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch b/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch index 15cf67fd2e..4d7642a907 100644
---
a/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch
+++
b/meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch

meta-oe/recipes-support/glog/glog/0002-Find-Libunwind-during-configure.patch +12 -4
@@ -109,12 +109,21 @@ diff -uNr a/CMakeLists.txt b/CMakeLists.txt
 
  install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog)
 diff -uNr a/glog-config.cmake.in b/glog-config.cmake.in
---- a/glog-config.cmake.in     2018-11-20 15:49:07.576278417 +0100
-+++ b/glog-config.cmake.in     2018-11-20 15:52:32.330418489 +0100
-@@ -4,4 +4,6 @@
+--- a/glog-config.cmake.in     2018-11-02 14:02:21.784835854 +0100
++++ b/glog-config.cmake.in     2018-11-02 14:03:16.796935594 +0100
+@@ -4,4 +4,15 @@
 
  @gflags_DEPENDENCY@
 
++# Record the state of the CMake module path when this script was
++# called so that we can ensure that we leave it in the same state on
++# exit as it was on entry, but modify it locally.
++set(UNWIND_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
++
++set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
 +find_dependency (Libunwind)
++
++# Restore original module path
++set(CMAKE_MODULE_PATH "${UNWIND_CMAKE_MODULE_PATH}")
 +
  include ("${CMAKE_CURRENT_LIST_DIR}/glog-targets.cmake")
--
Quoted 3 lines

2.17.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel