From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maxim Kokryashkin <m.kokryashkin@tarantool.org>, Sergey Bronnikov <sergeyb@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine Date: Fri, 13 Dec 2024 15:59:29 +0300 [thread overview] Message-ID: <20241213125929.22051-1-skaplun@tarantool.org> (raw) Since Alpine uses musl [1] as its C standard library, the build for it failed after the commit af0f59da76292f30ff75be1ab01458d47b226995 ("test: fix LuaJIT-tests for old libc version"), since `GetLibCVersion()` raises an error. This patch adds the check of the ID in the /etc/os-release [2] of the Linux distribution and avoids setting the GLibC version if the distro is "alpine". [1]: https://wiki.alpinelinux.org/wiki/Musl [2]: https://www.linux.org/docs/man5/os-release.html --- Branch: https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-alpine-build PR for tests on master: https://github.com/tarantool/tarantool/pull/10824 Side note: build locally in Docker for test for Alpine. test/CMakeLists.txt | 1 + test/LuaJIT-tests/CMakeLists.txt | 18 +++++++++++------- test/cmake/GetLinuxDistro.cmake | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 test/cmake/GetLinuxDistro.cmake diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index be02d2e4..86de9ed1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -74,6 +74,7 @@ separate_arguments(LUAJIT_TEST_COMMAND) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(AddTestLib) include(GetLibCVersion) +include(GetLinuxDistro) include(LibRealPath) # CTEST_FLAGS is used by CMake targets in test suites. diff --git a/test/LuaJIT-tests/CMakeLists.txt b/test/LuaJIT-tests/CMakeLists.txt index 0df3f4ea..adc630f0 100644 --- a/test/LuaJIT-tests/CMakeLists.txt +++ b/test/LuaJIT-tests/CMakeLists.txt @@ -62,13 +62,17 @@ if(CMAKE_C_FLAGS MATCHES "-march=skylake-avx512") list(APPEND LUAJIT_TEST_TAGS_EXTRA +avx512) endif() -if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - GetLibCVersion(LIBC_VERSION) - # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of - # which have the bug [1] for "0x1p-2075" parsing. Add the skip - # check for it. - # [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151 - list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION}) +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + GetLinuxDistro(LINUX_DISTRO) + # Alpine uses musl instead of GLibC. + if(NOT LINUX_DISTRO MATCHES "alpine") + GetLibCVersion(LIBC_VERSION) + # XXX: <tonumber_scan.lua> uses `strtod()`, old versions of + # which have the bug [1] for "0x1p-2075" parsing. Add the skip + # check for it. + # [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=16151 + list(APPEND LUAJIT_TEST_TAGS_EXTRA +libc=${LIBC_VERSION}) + endif() endif() if(LUAJIT_ENABLE_TABLE_BUMP) diff --git a/test/cmake/GetLinuxDistro.cmake b/test/cmake/GetLinuxDistro.cmake new file mode 100644 index 00000000..027368be --- /dev/null +++ b/test/cmake/GetLinuxDistro.cmake @@ -0,0 +1,18 @@ +# Determine the Linux distro id and return it in the `output` +# variable. See https://www.linux.org/docs/man5/os-release.html +# for details. +macro(GetLinuxDistro output) + if(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") + message(FATAL_ERROR "GetLinuxDistro macro must be used only on Linux") + endif() + file(READ /etc/os-release OS_RELEASE) + string(REGEX MATCH "ID=([0-9a-z._-]+)" MATCH ${OS_RELEASE}) + if(MATCH) + set(${output} ${CMAKE_MATCH_1}) + else() + set(${output} linux) + endif() + unset(OS_RELEASE) + unset(MATCH) + unset(CMAKE_MATCH_1) +endmacro() -- 2.47.0
next reply other threads:[~2024-12-13 13:00 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-12-13 12:59 Sergey Kaplun via Tarantool-patches [this message] 2024-12-13 13:47 ` Sergey Bronnikov via Tarantool-patches 2024-12-13 14:45 ` Sergey Kaplun via Tarantool-patches 2024-12-13 15:19 ` Sergey Bronnikov via Tarantool-patches 2024-12-15 8:53 ` Maxim Kokryashkin via Tarantool-patches 2024-12-17 12:33 ` Sergey Kaplun via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20241213125929.22051-1-skaplun@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=m.kokryashkin@tarantool.org \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit] cmake: fix build for Alpine' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox