I'm facing an issue that I'm not sure why is happening or how to solve it:
My problem is that I'm trying to compile inferno-os (A distributed OS) on a Virtual Machine, I've had some issues on the process like some libraries not being installed or GCC not being able to perform certain tasks (Inferno-OS is not particularly new), but I've found a way of solving that, all that is mainly because a part of the software is meant to run only on 32-bit mode only (You can check it here), and since I'm using a 64-bit VM (Xubuntu22.04), I did that. Anyway, now, I'm facing an error because of pthread_yield
function, basically, it said undefined reference when I was building the OS, so I decided to try the example I found here and it stills give me the undefined reference problem.
I have a file named thread.c where I've got the example I found, and I've tried to get the binary from it with:
cc -m32 thread.c -lpthread
cc -m32 -pthread thread.c
and
cc -m32 thread.c -lthread
but all of those give me the same message "undefined reference to pthread_yield
"
Here is a picture of the command that inferno's installation process executes, note that it's in Spanish but the output says basically undefined reference to pthread_yield
[]
I would really appreciate some help here, I would really like to know why is this happening
CodePudding user response:
You shouldn't ignore compiler warnings, especially those about implicit function declarations. The warning tells you that pthread_yield
is an undeclared function. Either build with -D_GNU_SOURCE
to get a declaration of pthread_yield
, or include <sched.h>
and change pthread_yield
to the standard sched_yield
function.