From patchwork Sun Jan 8 21:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 18097 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 12ADDC322E for ; Sun, 8 Jan 2023 21:44:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6EBB961F09; Sun, 8 Jan 2023 22:44:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1673214242; bh=zbC0kfQiM9AaXVSfuuTuR8MbtN5g/ZBQEEMcK3ezzMQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=se2nGJVe6n17ikJGdo54LWjKju+0RY1owgzr2o+Y96gFCQUCKudvEae1vNlO1RTFl NCi3/Au2eKVBSbZzD6DozCKOMamT7GnPl7QUAobxD6wrCff3vk5zLR1kxafbN3jneX TUkdG8EFJUm8TKD2rhKms/si5pLgSpCqgpEmn5WYPOvblKomgy1VFNMVl4Tn2TKBLy H8YIy7I4yMnUDvg53p3yCjySYktd45F57jxhYSSvHfUJy8bz3PhCTzeQ81iMVLJcda 5xJAA7AbVwLq3HpAV8iXRfGmL6g4592V3l7V+T4CIH74Nl1XqNU4utv5ho6ZoctleY oO2k8+aA0a0ew== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F24461F09 for ; Sun, 8 Jan 2023 22:44:01 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GmcIp5IX"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D4E326CF for ; Sun, 8 Jan 2023 22:44:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673214241; bh=zbC0kfQiM9AaXVSfuuTuR8MbtN5g/ZBQEEMcK3ezzMQ=; h=From:To:Subject:Date:From; b=GmcIp5IXdS8H2O0xH1J8b/xvR48kI9lo2krxq48/agMDDoxn1hvqayW3aGVplQSEr EgrTzB8BRBzyq2B/1LEL4RcF5O1b7kkUZtDVrjaq5uzxLICOey+kY+TymFWhvmgZF+ BtdnCAWNF2SZmOHPKAC8opuHSl3RoITvVtRZfoHc= To: libcamera-devel@lists.libcamera.org Date: Sun, 8 Jan 2023 23:43:55 +0200 Message-Id: <20230108214357.12641-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.38.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 0/2] libcamera Fix compilation with uClibc X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hello, This patch series fixes compilation errors with uClibc that were introduced in commit e8ae254970cf ("libcamera: yaml_parser: Use C locale"). uClibc can be compiled with different levels of locale support: - Full locale object (locale_t) support, with strto*_l() functions - Locale support without locale object and strto*_l() functions - Hardcoded "C" locale In the second and third cases, compilation of libcamera fails due to missing newlocale(), freelocale() and strtod_l() functions. Patch 1/2 first moves the strtod_l() and the locale_t RAII wrapper from yaml_parser.h to utils.h, as the fix exceeds the scope of an implementation private to the YAML parser. Patch 2/2 then fixes the issue by using strtod() when locale object support isn't available. This fixes compilation with all the cases described above, but leaves a runtime issue in the second case if the locale has different numeric parsing rules. As this is a corner case (locale support without locale object support) of a corner case (uClibc), I don't expect it to be an issue in practice. If it turns out to cause problems, a reimplementation of strtod() in libcamera may be needed. Laurent Pinchart (2): base: utils: Add and use strtod() helper libcamera: base: utils: Support C libraries lacking locale support include/libcamera/base/utils.h | 2 ++ meson.build | 4 +++ src/libcamera/base/utils.cpp | 58 ++++++++++++++++++++++++++++++++++ src/libcamera/yaml_parser.cpp | 34 +------------------- 4 files changed, 65 insertions(+), 33 deletions(-) base-commit: c15ff6b59de877ab8ee19b09e9315e5eaffdb818