google / google/perfetto

traced, traced_probes MUSL compatibility

Open
#6,079 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
6.5k
Forks
868
Avg merge
2d 1h
Merged PRs (30d)
218

Description

Version: HEAD (main)
Clang: 10.0.1

I have been trying to cross-compile traced, traced_probes for AArch64 Linux MUSL, but there are some compile errors. Fixing some of the issues was quite easy in order to get it compiling, when excluding heap-profiling and some other modules.

Would it be possible to upstream such changes with some ifdefs, or is there no interest in having traced and traced_probes to be compatible with MUSL?

## Args config

```
target_os = "linux"
target_cpu = "arm64"
is_clang = true
is_hermetic_clang = false
is_debug = false
target_cc="..."
target_cxx="..."
target_ar="..."
target_sysroot="..."
target_strip="..."
extra_ldflags="..."
extra_target_ldflags="..."
enable_perfetto_heapprofd=false
enable_perfetto_traced_perf=false
target_triplet = "aarch64-linux-musl"
```

Had to disable `heapprofd` and `traced_perf`, because of further compiler issues.

## Compile error

```
In file included from ../../src/base/thread_utils.cc:18:
../../include/perfetto/ext/base/thread_utils.h:66:7: error: use of undeclared identifier 'pthread_getname_np'
if (pthread_getname_np(pthread_self(), buf, sizeof(buf)) != 0)
```

## Patch

Just fiddled around until it compiled.

[000-musl-fix.patch](https://github.com/user-attachments/files/28434576/000-musl-fix.patch)

Contributor guide

Open the contributing guide

Research direction

Start with include/perfetto/ext/base/thread_utils.h and src/base/thread_utils.cc, then reproduce the AArch64 Linux MUSL build using the Args config in the issue. Review 000-musl-fix.patch and identify the compatibility changes needed for traced and traced_probes. Done means the requested targets compile for aarch64-linux-musl without the reported errors, with any remaining module limitations documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.