This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

pthread_create failed with Codesourcery gcc on OMAPL138

Other Parts Discussed in Thread: OMAPL138

I just compiled a small test code using POSIX thread API under linux with the Codesourcery gcc cross compiler:

william@ubuntu:~$ arm-none-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)

And the code:

#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>

void thread(void)
{
        int i;
        for(i=0;i<3;i++)
                printf("This is a pthread.\n");
}

int main(void)
{
        pthread_t id;
        int i,ret;

        ret=pthread_create(&id,NULL,(void *) thread,NULL);
        if(ret!=0){
                printf ("Create pthread error!\n");
                exit (1);
        }

        for(i=0;i<3;i++)
                printf("This is the main process.\n");

        pthread_join(id,NULL);

        return (0);
}

with the compile command:

william@ubuntu:~$  arm-none-linux-gnueabi-gcc -lpthread thread_test.c -o thread_test

Then when I run this program on my OMAPL138 board, I got the error say pthread_create failed with error code 11 which means EAGAIN.

I even include the header file and lib with: -I/opt/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/usr/include and

 -L/opt/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/usr/lib/

or just link the lib statically with "-static" but with no luck.

Is this the Codesourcery tool chain problem or what?

Has someone got this error coding a POSIX thread programme with Codesourcery's tool chain?

Thank you!

William Young

  • I got it.

    There is nothing wrong with the gcc compiler or everything.

    I found that every time I modify(just copy some file into it) the original arago ramdisk fs.

    gunzip,mount,umount,gzip......boot my board and log into the fs,

    Then the execution of some programme will go wrong.It is wired!