Skip to content

Conversation

@timsong1
Copy link

@timsong1 timsong1 commented Jan 8, 2026

Summary

Building tools/rvsim with mini-gdbstub enabled can fail on systems with glibc < 2.34 due to missing pthread symbols such as pthread_create / pthread_join.
Because libgdbstub.a uses pthread APIs, but rvsim’s link flags do not include pthread, causing the final link step to fail.
On glibc >= 2.34, this issue may not trigger a link error because glibc merged libpthread functionality into libc

Change

Add pthread to the link flags in tools/Makefile:

- LDFLAGS += -Lmini-gdbstub/build -lgdbstub
+ LDFLAGS += -Lmini-gdbstub/build -lgdbstub -lpthread

Note

This change is required on glibc < 2.34 where pthread symbols are not provided by libc by default.
On glibc >= 2.34, -lpthread remains safe because glibc keeps the linker option working for backwards compatibility (empty libpthread.a is provided), so this should not affect newer systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant