From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id C8383A653DD; Tue, 26 Mar 2024 11:35:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C8383A653DD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1711442124; bh=fJrkcKVpF5YdXs3wHGBhmkVN0kyGLdz+xZA9nc7sBmA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=hnl7nVqx1IiiMFoXZRykOZ1XB0XJQPChpwENl/Q0d6NLJclsTkJ8cGBH9CNnuoyr2 pOSOhbjuoE3LncgiQ6O+UcyY74pIX0rguC7SPg5S4jfhxLnxseBSUX4JIMN8OQM7xt 0ZWl48cPKBjlvLA6iJ5DzJXL7hn2O8zJgcL/XBmg= Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 873EFA653D0 for ; Tue, 26 Mar 2024 11:34:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 873EFA653D0 Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-513dc9d6938so6623924e87.2 for ; Tue, 26 Mar 2024 01:34:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711442067; x=1712046867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dd6swJKpnw6+7ou7ofcasWHTm7JErPEfm/rTIWb7sag=; b=iINbeGQMlh+p79vvqUTtdVHEl+vi/zamfMGFdphea/Fy8o0up/rtKfM63L/FDeC47v PVW+qAUVYzoKk+UKTVCOSEhEEh3pFWo/McFxgY6ttp+hwWKT95GAzvPQF7ygbKa++A5E zxtRRsXxqH1LUA2mf/oZQUWr4L/3kryYMA9GGXTG655S8OeY0ASR3nEgOQJhaGp4pGNV 1vW7Pzypp5Yonb4icYzmD68yxIOOYLVU7ZNkjwSShrDQmc5IimhsxyPckAPsaY82gzQ1 IgvCe6CcX9nA5tl3RvlVc9aZTmwy9kbmjgR7Sq68wd8Ik8X/O2CTs61PF6TIeCP1EXNv LGSw== X-Gm-Message-State: AOJu0YwbMejbTd7MT/z02o8SJ25ZY3uVqGWKwCGsSXZ9tpARpAYd2NKe p4ubjDA3Iuole6wrfMGaTLWfJk2lgQcswPn2I5EfELG5oZcmlb2svjvv/CbFL1U= X-Google-Smtp-Source: AGHT+IEmBLZhEgmgriWt+2T63XfCOiyMn9hjUM45VfCRQjTz5avN5x+0j/Eb+bbt+NRxAYSB+JFFbw== X-Received: by 2002:a05:6512:96f:b0:513:5951:61a4 with SMTP id v15-20020a056512096f00b00513595161a4mr407919lft.6.1711442066393; Tue, 26 Mar 2024 01:34:26 -0700 (PDT) Received: from pony.. ([5.181.62.126]) by smtp.gmail.com with ESMTPSA id y11-20020a056512044b00b005159c7939basm1434099lfk.185.2024.03.26.01.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 01:34:26 -0700 (PDT) To: tarantool-patches@dev.tarantool.org, Sergey Kaplun , Maxim Kokryashkin Date: Tue, 26 Mar 2024 11:33:28 +0300 Message-Id: <943fd56f6ea4c207074f9f978f8c6c458dbe1bb0.1711441864.git.sergeyb@tarantool.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 2/6] test: refactor CMake macro LibRealPath X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Sergey Bronnikov The patch refactors the CMake macro LibRealPath: - Replace CMAKE_CXX_COMPILER with CMAKE_C_COMPILER because LuaJIT doesn't require the CXX compiler, and thus it can be unavailable on a build system. - Add a check for a code returned by a command with the compiler. - Add a check for a value returned by the compiler. A value equal to a passed one means that the library was not found in the system. - Unset local variables to avoid namespace pollution. Needed for tarantool/tarantool#9656 --- test/LuaJIT-tests/CMakeLists.txt | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt index a0fb5440..badec91d 100644 --- a/test/LuaJIT-tests/CMakeLists.txt +++ b/test/LuaJIT-tests/CMakeLists.txt @@ -33,18 +33,41 @@ if(LUAJIT_USE_ASAN) # https://github.com/google/sanitizers/issues/934. macro(LibRealPath output lib) execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=${lib} + # CMAKE_C_COMPILER is used because it has the same behaviour + # as CMAKE_CXX_COMPILER, but CMAKE_CXX_COMPILER is not + # required for building LuaJIT and can be missed in GH + # Actions. + COMMAND ${CMAKE_C_COMPILER} -print-file-name=${lib} OUTPUT_VARIABLE LIB_LINK OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RES ) + + if(NOT RES EQUAL 0) + message(FATAL_ERROR + "Executing '${CMAKE_C_COMPILER} -print-file-name=${lib}' has failed" + ) + endif() + + # GCC and Clang return a passed filename when a library is + # not found. + if(LIB_LINK STREQUAL ${lib}) + message(FATAL_ERROR "Library '${lib}' is not found") + endif() + # Fortunately, we are not interested in macOS here, so we can - # use realpath. + # use realpath. Beware, `realpath` always returns an exit code + # equal to 0, so we cannot check if it fails. execute_process( COMMAND realpath ${LIB_LINK} OUTPUT_VARIABLE ${output} OUTPUT_STRIP_TRAILING_WHITESPACE ) + + unset(LIB_LINK) + unset(RES) endmacro() + LibRealPath(LIB_STDCPP libstdc++.so) # XXX: GCC requires both. Clang requires only libstdc++. if(CMAKE_C_COMPILER_ID STREQUAL "GNU") -- 2.34.1