Zak
Zak

Reputation: 12653

In function `uv__signal_global_init': ... undefined reference to `pthread_atfork'

I'm using libUV in my project and I'm getting the following error when I'm linking...

In function `uv__signal_global_init': ... undefined reference to `pthread_atfork'

The strange thing is, my project only fails to link on certain flavors of Linux, but works on MacOS and Windows.

Any idea how to resolve this error?

Upvotes: 4

Views: 1111

Answers (1)

Zak
Zak

Reputation: 12653

After scouring the internet, I found the solution in an obscure post from Ben Noordhuis in a Google group post.

#tl;dr

Link with -luv -ldl -lrt -pthread (in that order or it'll break when -W,--as-needed is in effect.)

Upvotes: 4

Related Questions