Using pthread on L4/Fiasco

석현철 hcseok at
Wed May 23 09:01:41 CEST 2012

Hi. Hackers


I’m trying to use pthread in an application which runs on L4.

I modified “main.c” in Hello application, including “#include

And when I compiled L4Re, I got error messages:



main.o: In function `main':

/root/l4re-core-2011081207/src/l4/pkg/hello/server/src/main.c:39: undefined
reference to `pthread_create'

/root/l4re-core-2011081207/src/l4/pkg/hello/server/src/main.c:44: undefined
reference to `pthread_join'

make[5]: *** [hello] Error 1



I think this is because it cannot fine pthread.h header file. But I don’t
know how to fix it.


When I looked up previous lists, I could find one thread related to pthread
in 2011 list.

(the thread title is “Silly Pthread Issues”)

I think that it is the same problem, but the reply is only one. Said “Add
REQUIRES_LIBS = libpthread to the Makefile.”

Actually, I tried it, but I couldn’t solve the problem.


How can I use the pthread? Please, Help me!!


Thank you!

Hyunchul Seok




The modified code is below:

#include <stdio.h>

#include <unistd.h>


//#include <pthread-l4.h>

#include <pthread.h>


void *process_test(void *arg)


    int i = (int)arg;

    int j;


    for (;;)


        for (j = 0; j < i; j++) {

            printf("  ");


        printf("%d thread\n", i);





int main(void)


    pthread_t threads[10];

    int status[10];

    int i;


    for (i = 0; i < 3; i++) {

        pthread_create(&threads[i], NULL, process_test, (void *)i);

        puts("New thread creation!");



for (i = 0; i < 3; i++) {

        pthread_join(threads[i], (void **)&status[i]);



    return 0;



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the l4-hackers mailing list