peadar / pstack

Print stack traces from running processes, or core files. Supports aarch64, x86_64, and i386
BSD 2-Clause "Simplified" License
134 stars 34 forks source link

Compilation fails on systems with glibc version < 2.30 #21

Open Dologan opened 7 months ago

Dologan commented 7 months ago
pstack-2.5.1/self.cc: In member function ‘virtual void pstack::Procman::SelfProcess::listLWPs(std::function<void(int)>)’:
pstack-2.5.1/self.cc:31:7: error: ‘gettid’ was not declared in this scope; did you mean ‘getuid’?

This is discussed in https://stackoverflow.com/questions/30680550/c-gettid-was-not-declared-in-this-scope

And the solution:

#include <sys/syscall.h>
#define gettid() syscall(SYS_gettid)
#endif

fixes the issue

Dologan commented 7 months ago

Ah, well, I see now it doesn't support glibc versions < 3.4 anyway, so I guess this is moot.

peadar commented 7 months ago

I can certainly try and make this work for slightly older systems out of the box