Bug 453929 - "make check" fails to compile for aarch64-linux with musl C library. FIX PROPOSED.
Summary: "make check" fails to compile for aarch64-linux with musl C library. FIX PROP...
Status: RESOLVED DUPLICATE of bug 382034
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.19.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-17 10:23 UTC by Ivan Nikolaenko
Modified: 2023-01-26 07:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch that fixes compilation error (1.63 KB, patch)
2022-05-17 10:23 UTC, Ivan Nikolaenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Nikolaenko 2022-05-17 10:23:53 UTC
Created attachment 148912 [details]
Patch that fixes compilation error

SUMMARY
make check fails at compilation stage with multiple errors (only first of them is "real" error). 
System: aarch64-linux (native compilation), musl C library.

STEPS TO REPRODUCE
1. git clone git://sourceware.org/git/valgrind.git
2. cd valgrind
3. ./autogen.sh
4. ./configure
5. make check

OBSERVED RESULT
> In file included from scalar.c:5:
> scalar.h: In function 'syscall':
> scalar.h:17:49: error: expected declaration specifiers before '__THROW'
>   17 | extern long int syscall (long int __sysno, ...) __THROW;
>     |                                                 ^~~~~~~ </code>
> /* Cascade of "wrong syntax" errors */

EXPECTED RESULT
make check ends without errors


SOFTWARE/OS VERSIONS
Valgrind 3.18.1
OS Alpine Linux
Musl C Library
aarch64-linux
Kernel 5.17.0-rc7

ADDITIONAL INFORMATION
Error analysis:
The error comes from file memcheck/tests/arm64-linux/scalar.h:
> extern long int syscall (long int __sysno, ...) __THROW;
__THROW macro is glibc-specific. There is no such macro in Musl, thus, that is undefined.
Proposed fix: check if __THROW is defined, and if not define it to empty.
https://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-multimedia/cdrkit/files/0001-define-__THROW-to-avoid-build-issue-with-musl.patch?h=rocko

Possibly there is another similar issue with file memcheck/tests/x86-linux/scalar.h:
> extern long int syscall (long int __sysno, ...) __THROW;
I do not have proper HW to test.
Comment 1 Paul Floyd 2023-01-26 07:03:14 UTC

*** This bug has been marked as a duplicate of bug 382034 ***