Bug 453929

Summary: "make check" fails to compile for aarch64-linux with musl C library. FIX PROPOSED.
Product: [Developer tools] valgrind Reporter: Ivan Nikolaenko <ivan.nikolaenko>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: normal CC: hi, ivan.nikolaenko, pjfloyd
Priority: NOR    
Version: 3.19.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch that fixes compilation error

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 ***