From patchwork Tue Dec 1 06:43:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Mittal X-Patchwork-Id: 106727 X-Patchwork-Delegate: anuj.mittal@oss.qualcomm.com Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5868.1796107482733333087 for ; Mon, 30 Nov 2026 22:44:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@qualcomm.com header.s=qcppdkim1 header.b=KMFeUnq1; dkim=pass header.i=@oss.qualcomm.com header.s=google header.b=EtMtClTy; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: oss.qualcomm.com, ip: 205.220.168.131, mailfrom: anuj.mittal@oss.qualcomm.com) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B12L2pk2784607 for ; Tue, 1 Dec 2026 06:44:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=DT6K7Q9EdMQ YZ+E5qEyIQ5uwElv+HcA3/CfZQlxzBr4=; b=KMFeUnq1hsLyixJcaJWU8ivcE0h Z9e6n2CDuqKThUVoXT5aTVAvOOkqX9FhZkX3MdoztwQM2QXyQZyR4AFF5aTkB6UI Z2xeRMBCnbKmblH7AQscU0EYdpTdLBMiSJfBZWO1EF+SD7aRXFU2/JNElIoHiHsf GyhUuQ2wZusqPpw2v9ilc0QoQp+M4U7FdpU3+4eY3R5qWz9+R4kISG6OG43FVKEN /F0DrwN3tygj7o+tYoX8XEMT1du9Vu4CYs2o3OAyXHpXI5UdgRGopCauL7xBlJ/Z MGE9ueMLD2DYmQKxoueMQz8yixsyS7RYQorSuNEd7KRmwtOs7Kcp7zsWRxA== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j9enx29m8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 06:44:42 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-386a65fca25so10974885eec.0 for ; Mon, 30 Nov 2026 22:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796107481; x=1796712281; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=DT6K7Q9EdMQYZ+E5qEyIQ5uwElv+HcA3/CfZQlxzBr4=; b=EtMtClTyOreJHK6x85IoKLBJA3XE8GfdrSiF5gcHqRb90tghR6zj5EXD/wEYJ2qukz KMOGoHjdco8zCemCl6ho8zV3azohK4o+s0UjhuBRvlDqifGhlWBcpLYb0KHL9b107lAr tmmfnEBk43NyZmyAibyf1+EQaNOxNC+NHXy2POLX9RKhz1e7dp4SX+sb6alJgg5NCNyX bbmnThI23A2lZ42ohMpIGrj10CWdyRoIjNe4P3ZSr9CTY4Sdt0DI6ZudfC5Fh083oerk WwAfYAMTLJwm/nNV0j/HwbnnCLrc5QS0H/YEIW6KvTg2fPEPSl+KhA1+TNr6YhreNiMN rkLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796107481; x=1796712281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=DT6K7Q9EdMQYZ+E5qEyIQ5uwElv+HcA3/CfZQlxzBr4=; b=imjMswLSi8LI+JquV97GcsWuWl8gkeJZzpPMnUdqiQQhl5Q+h+i+QSaqHkdvlBxGiW GN2Bqgkle6zAzJV5bmbZ3w8+/xg94FK3A1SdSCgdkZBYq9i5+szjLG/L53oqXSHK9qai gotxKYGIcqGIiXg4MjkAybCPTfNuQcktmz7hzKizOesFk3hGiTjxQqIttFcNjp6S+s/k wdWoc8zc+reeHan7a3RoRYxQVhH+ScnOYVmhuhOdsNstf+c0Z9ZRgIeWTW5e3wlZbHTR OoRUTE1H4bGycJtnfFREpqj7+BAu42yXZf0Lu5aMiysbzpailVz1VM+8gIdktHe08yNZ G88A== X-Gm-Message-State: APuU4Z/SrtAODSvM7zPXjftHLdHIBlJqheWOVFSJ8BkJpLsR2nrIHUj5 LhmZZnzPitrpPghe8UtQ2eGGxFPIDmh0DOzrNb63UrA5bAgtnW53P6qSKNclaqzl3XBCLODM70P kyZYaCgvksVw4rp3N0LKjf6jwl1+8XkPw/9wKaCojwGXjyGML8MX9rqDfXEiH1+wPHihhc5+aR9 aUVv1OAZwOkwKr0CQ8sxCDzA== X-Gm-Gg: AZFdTZdRlkxRGMxvmQGEqp7PHt9ZuLQhRRoiaP0pJBb1q6fIMjsfwrlen7rhwo6DqaX oG6fEqvTH+tfx8wfHHAFqe43832eOWtSfZde5u9dMIUx2GB/P9MHVIadT/CrTHQKm/Yr8n2//zn pZumn9h+irm2iZmMDtO32oRnSzFjQy/yknhzortww/j5mQmgHIRfL7M903d8a7DeCjE1QG0WhEI Iue9cOpdDEImXYMisR0y2OH8Fuq5FBOy5x2uS0rUcJNb8Q87yEs2oKQVmOV3P//Kjat7MXhVFgL RHf0aWPAqQN1bbfiqIkA7KV9J8VgAVWZnvPE8VAtips4yv73lz9rHMiZ6I9enFmsCovcKSxAy0o Tm70WO/fe8XjE9iLblJywTjh9mKJ4jwczhAY9+nUaM/NmxLGzKYjnMON7w7WKIIh2mAEI4E6ewY EJgold X-Received: by 2002:a05:693c:8947:20b0:386:9ef2:8e01 with SMTP id 5a478bee46e88-3869ef28fe2mr26963260eec.0.1796107481220; Mon, 30 Nov 2026 22:44:41 -0800 (PST) X-Received: by 2002:a05:693c:8947:20b0:386:9ef2:8e01 with SMTP id 5a478bee46e88-3869ef28fe2mr26963245eec.0.1796107480628; Mon, 30 Nov 2026 22:44:40 -0800 (PST) Received: from hu-anujmitt-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38566cd46c5sm132830468eec.11.2026.11.30.22.44.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 22:44:40 -0800 (PST) From: Anuj Mittal To: openembedded-devel@lists.openembedded.org Subject: [wrynose][meta-oe][PATCH 18/45] cjson: Install CMake package files with relative paths Date: Tue, 1 Dec 2026 12:13:34 +0530 Message-ID: <20261201064402.3934788-18-anuj.mittal@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261201064402.3934788-1-anuj.mittal@oss.qualcomm.com> References: <20261201064402.3934788-1-anuj.mittal@oss.qualcomm.com> MIME-Version: 1.0 X-Authority-Analysis: v=2.4 cv=Lv0HWXdc c=1 sm=1 tr=0 ts=6b0e6cda cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=NEAV23lmAAAA:8 a=a53S_ioBdJSOK3AIzX0A:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-ORIG-GUID: HouCLfGMWa-Pmlxm2Vb45qPQPkjNM1_5 X-Proofpoint-GUID: HouCLfGMWa-Pmlxm2Vb45qPQPkjNM1_5 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDAyNiBTYWx0ZWRfX9GRtDEMrb+c8 AKiL3xZ1RrbPVYntWJIB3PQE6mkAMmRlCu+hNJ3Px2MvIqGs4RLPydXDAuFpaZ9eXstGjiLGsXL 4yAwHRQbwd8YhkQQb/799J67DvgpBh0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDAyNiBTYWx0ZWRfX+tm9DpE//VOr PS2BWj5nnha3iZ7iFMUj0kPM7THvyuLkDkk6yPocgkjiCDtYRXckec6+d51tnMWkVgIZzHLNr9P aI+SXpQXP8PjVGdiObeHWPDM3aULdbEXTUjfhhkaOYj4MOoox2D//wSoKMDPb2Xub+SP5bwTnq6 kiKhc/ASidd7F6HgW+6TK11aU7udaGOz7Joe1mluhieQ9o3MWjIuNfdnH0U0ZJnStyfQOmPyksW 2/ukIwIH9Dkic6y7wbgjBqJ4TdjSsFdoGkcz8s45BJPDsTU1+3hfJQ+Re+mMosqdIeF8vlj5YbQ yhPsiFLsp4tt7XG4m8Ai1IZyqOxvwDdy3kNglaiXicveE/NXtnXtxSO9HORaUswn2w+inDKK3C2 TVTOxI+NWX2zHcVyLoXN2EqMGfgsLzMpRkjqF/tJrPY7b2XbQGYMNUUM/PS7J/G5mKnXt/2iA4h p/7PWXGUV7FICH1yZ2g== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-01_01,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010026 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 01 Dec 2026 06:44:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/133712 From: Khem Raj cJSON installs with CMAKE_INSTALL_FULL_* destinations, so the exported cjson targets record absolute /usr/lib and /usr/include paths instead of paths relative to _IMPORT_PREFIX. A consumer using find_package(cJSON CONFIG) against the sysroot, as mosquitto 2.1.4 does, then looks on the build host and fails: The imported target "cjson-static" references the file "/usr/lib/libcjson.a" but this file does not exist. Add a patch that installs to relative destinations and derives CJSON_INCLUDE_DIRS from the config file's location. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj (cherry picked from commit ca263309d8c450124935b6622e21bbae7e5a76e0) Signed-off-by: Anuj Mittal --- ...ake-Install-to-relative-destinations.patch | 122 ++++++++++++++++++ .../recipes-devtools/cjson/cjson_1.7.19.bb | 1 + 2 files changed, 123 insertions(+) create mode 100644 meta-oe/recipes-devtools/cjson/cjson/0001-CMake-Install-to-relative-destinations.patch diff --git a/meta-oe/recipes-devtools/cjson/cjson/0001-CMake-Install-to-relative-destinations.patch b/meta-oe/recipes-devtools/cjson/cjson/0001-CMake-Install-to-relative-destinations.patch new file mode 100644 index 0000000000..91f45de2d9 --- /dev/null +++ b/meta-oe/recipes-devtools/cjson/cjson/0001-CMake-Install-to-relative-destinations.patch @@ -0,0 +1,122 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 25 Nov 2026 23:12:10 -0800 +Subject: [PATCH] CMake: Install to relative destinations + +Installing with CMAKE_INSTALL_FULL_* destinations makes the exported +cjson/cjson_utils targets record absolute paths such as /usr/lib/libcjson.a +and /usr/include instead of paths relative to _IMPORT_PREFIX. Consumers +that cross-compile against a sysroot then look for the library on the +build host, and find_package(cJSON CONFIG) fails with +"The imported target "cjson-static" references the file /usr/lib/libcjson.a +but this file does not exist". + +Use the relative CMAKE_INSTALL_* variables for the install destinations +and derive CJSON_INCLUDE_DIRS in cJSONConfig.cmake from the location of +the config file. The pkg-config files keep their absolute paths. + +Upstream-Status: Pending +AI-Generated: Uses Claude Code +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 38 ++++++++++++++--------------- + library_config/cJSONConfig.cmake.in | 5 ++-- + 2 files changed, 22 insertions(+), 21 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c7ca27f..4c909c1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -142,25 +142,25 @@ endif() + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/library_config/libcjson.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" @ONLY) + +-install(FILES cJSON.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/cjson") +-install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") ++install(FILES cJSON.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cjson") ++install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + install(TARGETS "${CJSON_LIB}" + EXPORT "${CJSON_LIB}" +- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" +- LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" +- RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" +- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + if (BUILD_SHARED_AND_STATIC_LIBS) + install(TARGETS "${CJSON_LIB}-static" + EXPORT "${CJSON_LIB}" +- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" +- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + endif() + if(ENABLE_TARGET_EXPORT) + # export library information for CMake projects +- install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON") ++ install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON") + endif() + + if(ENABLE_CJSON_VERSION_SO) +@@ -195,23 +195,23 @@ if(ENABLE_CJSON_UTILS) + + install(TARGETS "${CJSON_UTILS_LIB}" + EXPORT "${CJSON_UTILS_LIB}" +- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" +- LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" +- RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" +- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + if (BUILD_SHARED_AND_STATIC_LIBS) + install(TARGETS "${CJSON_UTILS_LIB}-static" + EXPORT "${CJSON_UTILS_LIB}" +- ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" +- INCLUDES DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + ) + endif() +- install(FILES cJSON_Utils.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/cjson") +- install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson_utils.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") ++ install(FILES cJSON_Utils.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cjson") ++ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson_utils.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + if(ENABLE_TARGET_EXPORT) + # export library information for CMake projects +- install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON") ++ install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON") + endif() + + if(ENABLE_CJSON_VERSION_SO) +@@ -234,7 +234,7 @@ if(ENABLE_TARGET_EXPORT) + # Install package config files + install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake + ${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake +- DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON") ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON") + endif() + + option(ENABLE_CJSON_TEST "Enable building cJSON test" ON) +diff --git a/library_config/cJSONConfig.cmake.in b/library_config/cJSONConfig.cmake.in +index 909f7a9..21a14f2 100644 +--- a/library_config/cJSONConfig.cmake.in ++++ b/library_config/cJSONConfig.cmake.in +@@ -2,8 +2,9 @@ + set(CJSON_UTILS_FOUND @ENABLE_CJSON_UTILS@) + + # The include directories used by cJSON +-set(CJSON_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@") +-set(CJSON_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@") ++get_filename_component(_cjson_prefix "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) ++set(CJSON_INCLUDE_DIRS "${_cjson_prefix}/@CMAKE_INSTALL_INCLUDEDIR@") ++set(CJSON_INCLUDE_DIR "${_cjson_prefix}/@CMAKE_INSTALL_INCLUDEDIR@") + + get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + diff --git a/meta-oe/recipes-devtools/cjson/cjson_1.7.19.bb b/meta-oe/recipes-devtools/cjson/cjson_1.7.19.bb index b4e57d7297..6f169b1724 100644 --- a/meta-oe/recipes-devtools/cjson/cjson_1.7.19.bb +++ b/meta-oe/recipes-devtools/cjson/cjson_1.7.19.bb @@ -8,6 +8,7 @@ SRC_URI = "git://github.com/DaveGamble/cJSON.git;branch=master;protocol=https \ file://run-ptest \ file://0001-allow-build-with-cmake-4.patch \ file://CVE-2026-87933.patch \ + file://0001-CMake-Install-to-relative-destinations.patch \ " SRCREV = "c859b25da02955fef659d658b8f324b5cde87be3"