Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pthread error caused by libstdc++ 10.5 on Ubuntu 20.04 (glibc <2.34) <wide error ! when app don`t reply pthread but shared lib reply pthread> #14593

Open
WikiLiu opened this issue Dec 24, 2024 · 0 comments

Comments

@WikiLiu
Copy link

WikiLiu commented Dec 24, 2024

Summary

  1. This issue arises after upgrading libstdc++ from version 10.3 to 10.5.
  2. In version 10.5, a new check was introduced:
if (!__gthread_active_p())
{
    throw system_error(make_error_code(errc::operation_not_permitted),
                       "Enable multithreading to use std::thread");
}

If libstdc++ is loaded before libpthread, this check fails and triggers the error.
3. glmark2 uses libstdc++ but does not directly link against pthread, which leads to the issue.
4. In glibc 2.34, new functionality eliminates the need to explicitly link against -lpthread, which avoids this problem. However, Ubuntu 20.04 uses glibc 2.31, where this issue still exists.

Steps to reproduce the behavior

Running program not link pthread But so need pthread on Ubuntu 20.04 results in the following error:

terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted
Aborted

Expected behavior

The program does not need pthread, but the dynamic library needs pthread and it can still work.
Alternatively, update the glibc version in Ubuntu 20.04 to 2.34 or later.

Browser/device details

x86-64-pc

Reported from

https://ubuntu.com/blog/tag/20-04-lts

@WikiLiu WikiLiu changed the title pthread error caused by libstdc++ 10.5 on Ubuntu 20.04 (glibc <2.34) <wide error ! when app don`t reply pthread but shared lib reply pthread) pthread error caused by libstdc++ 10.5 on Ubuntu 20.04 (glibc <2.34) <wide error ! when app don`t reply pthread but shared lib reply pthread> Dec 24, 2024
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

No branches or pull requests

1 participant