From 26cf8bec0a340ce1ea2c5625468e2237c9b2a937 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Wed, 26 Feb 2025 17:40:26 +0100 Subject: [PATCH] Fix compatibility with musl libc 1.2.4 --- .github/workflows/test_workflow.yml | 2 +- ddprof-lib/src/main/cpp/symbols_linux.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_workflow.yml b/.github/workflows/test_workflow.yml index 65f5c2cc7..604f4a7bb 100644 --- a/.github/workflows/test_workflow.yml +++ b/.github/workflows/test_workflow.yml @@ -120,7 +120,7 @@ jobs: config: ${{ fromJson(inputs.configuration) }} runs-on: ubuntu-latest container: - image: "alpine:3.14" + image: "alpine:3.21" options: --cpus 4 --workdir /github/workspace -v /home/runner/work/_temp:/home/runner/work/_temp timeout-minutes: 180 steps: diff --git a/ddprof-lib/src/main/cpp/symbols_linux.cpp b/ddprof-lib/src/main/cpp/symbols_linux.cpp index f0e35f3f2..a76969b7c 100644 --- a/ddprof-lib/src/main/cpp/symbols_linux.cpp +++ b/ddprof-lib/src/main/cpp/symbols_linux.cpp @@ -24,6 +24,9 @@ #include #include #include + +// make sure lseek will use 64 bits offset +#define _FILE_OFFSET_BITS 64 #include ElfSection *ElfParser::findSection(uint32_t type, const char *name) { @@ -68,7 +71,7 @@ bool ElfParser::parseFile(CodeCache *cc, const char *base, return false; } - size_t length = (size_t)lseek64(fd, 0, SEEK_END); + size_t length = (size_t)lseek(fd, 0, SEEK_END); void *addr = mmap(NULL, length, PROT_READ, MAP_PRIVATE, fd, 0); close(fd);