open-rmf / rmf

Root repository for the RMF software
Apache License 2.0
223 stars 58 forks source link

REPORT - Package build week 20221121 - 2022125 #280

Closed orensbruli closed 1 year ago

orensbruli commented 1 year ago

Continuation of https://github.com/open-rmf/rmf/issues/265

orensbruli commented 1 year ago

20221125

nlohmann_json_schema_validator_vendor Build Status

Check if downgraded version compiles on systems:

After pointing to a downgraded version we are getting the package compiled for redhat: Build Status

But several packages

Built on galactic with validator 3.6 and Humble with version 3.8.

Comparing the contents of the two .deb files generated for json validator, the main content difference is this:

--- /home/orensbruli/Downloads/ros-rolling-nlohmann-json-schema-validator-vendor_0.2.3-1jammy.20221115.180749_amd64/opt/ros/rolling/lib/cmake/nlohmann_json_schema_validator/nlohmann_json_schema_validatorTargets.cmake
+++ /home/orensbruli/Downloads/ros-humble-nlohmann-json-schema-validator-vendor_0.2.1-1jammy.20221108.150414_amd64/opt/ros/humble/lib/cmake/nlohmann_json_schema_validator/nlohmann_json_schema_validatorTargets.cmake
@@ -41,8 +41,14 @@
 unset(_expectedTargets)

-# The installation prefix configured by this project.
-set(_IMPORT_PREFIX "/tmp/binarydeb/ros-rolling-nlohmann-json-schema-validator-vendor-0.2.3/.obj-x86_64-linux-gnu/json_external_project/install")
+# Compute the installation prefix relative to this file.
+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+if(_IMPORT_PREFIX STREQUAL "/")
+  set(_IMPORT_PREFIX "")
+endif()

 # Create imported target nlohmann_json_schema_validator
 add_library(nlohmann_json_schema_validator SHARED IMPORTED)

Comparison between the two versions of the json validator package: https://github.com/pboettch/json-schema-validator/compare/5ef4f903af055550e06955973a193e17efded896..1063c9adbafc25f5a14bae15c3babdb039de86c6

What I think that is currently happening: On the last release, we pointed out the commit on the head of https://github.com/pboettch/json-schema-validator. On a previous commit, they had fixed the installation of their files. But, on another commit, they have also added the dependency restriction for json-dev >= 3.8

How do we point to a version that doesn't depend on json-dev >= 3.8 but has the needed fixes on the CMakeList? Is it possible without our own patch?

Trying to get the minimum changes to the cmakelists file to get it working.

With this patch applied to the CMakeLists.txt it should work:

--- ./CMakeLists.txt
+++ ./CMakeLists.txt
@@ -156,34 +156,33 @@
 endif()

 if(JSON_VALIDATOR_INSTALL)
-    # Set Up the Project Targets and Config Files for CMake
-
-    # Set the install path to the cmake config files
-    set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME})
-
-    # Create the ConfigVersion file
-    include(CMakePackageConfigHelpers) # write_basic_package_version_file
-    write_basic_package_version_file( ${PROJECT_NAME}ConfigVersion.cmake
-                                      VERSION ${PACKAGE_VERSION}
-                                      COMPATIBILITY SameMajorVersion)
-
-    # Get the relative path from the INSTALL_CMAKE_DIR to the include directory
-    file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/include")
-
-
-    # Configure the Config.cmake file with the proper include directory
-    set(CONF_INCLUDE_DIRS "\${JSON_SCHEMA_VALIDATOR_CMAKE_DIR}/${REL_INCLUDE_DIR}")
-    configure_file(${PROJECT_NAME}Config.cmake.in
-                   "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY)
-
-    # Install the Config.cmake and ConfigVersion.cmake files
-    install(FILES
-            "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
-            "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
-            DESTINATION "${INSTALL_CMAKE_DIR}")
+    # Set the install path to the cmake config files (Relative, so install works correctly under Hunter as well)
+    set(INSTALL_CMAKE_DIR "lib/cmake/${PROJECT_NAME}")
+    set(INSTALL_CMAKEDIR_ROOT share/cmake)

     # Install Targets
     install(EXPORT ${PROJECT_NAME}Targets
             FILE ${PROJECT_NAME}Targets.cmake
             DESTINATION "${INSTALL_CMAKE_DIR}")
+
+    include(CMakePackageConfigHelpers)
+    write_basic_package_version_file(
+        ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+        VERSION ${PROJECT_VERSION}
+        COMPATIBILITY SameMajorVersion
+        )
+
+    configure_package_config_file(
+        ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in
+        ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+        INSTALL_DESTINATION ${INSTALL_CMAKEDIR_ROOT}/${PROJECT_NAME}
+        )
+
+    install(
+        FILES
+            ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+            ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+        DESTINATION
+            ${INSTALL_CMAKE_DIR}
+        )
 endif()

Created in testing branch: https://github.com/open-rmf/nlohmann_json_schema_validator_vendor/compare/rolling...emartinena/fix_with_patch

Releasing for rolling to test in buildfarm:

Vishal24rg commented 1 year ago

Similar Build issue of nlohmann_json_schema_validator version is observed for galactic branch on Ubuntu 20.04 error

orensbruli commented 1 year ago

Releasing fix for humble:

orensbruli commented 1 year ago

Similar Build issue of nlohmann_json_schema_validator version is observed for galactic branch on Ubuntu 20.04 error

@Vishal24rg can you try with the code of nlohmann_json_schema_validator in the rolling or humble branches and confirm if it fixes the problem?