public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] POSIX layer and pthread:Unable to make the application
@ 2012-04-11 14:12 medamine
       [not found] ` <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: medamine @ 2012-04-11 14:12 UTC (permalink / raw)
  To: ecos-discuss

Hi every one,

I use
Hardware: ST STM3210E EVAL board
Packages: posix
in the section:POSIX threads

POSIX pthread implementation header Enabled=True Value=0
POSIX mutex/cond var implementation header Enabled=True Value=0

and I got the pthread.h :

#ifndef CYGONCE_ISO_PTHREAD_H
#define CYGONCE_ISO_PTHREAD_H
/*===========================================
//
// pthread.h
//
// POSIX pthread functions
//
//===========================================

/* CONFIGURATION */

#include <pkgconf/isoinfra.h> /* Configuration header */

/* INCLUDES */

#ifdef CYGINT_ISO_PTHREAD_IMPL
# ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
# include CYGBLD_ISO_PTHREAD_IMPL_HEADER
# endif
#endif

#ifdef CYGINT_ISO_PTHREAD_MUTEX
# ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
# include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
# endif
#endif

#endif /* CYGONCE_ISO_PTHREAD_H multiple inclusion protection */

/* EOF pthread.h */

After that, i wrote this application using thread

#include <pthread.h>
#include <stdio.h>
#define NUM_THREADS 5

void *PrintHello(void *threadid)
{
long tid;
tid = (long)threadid;
printf("Hello World! It's me, thread #%ld!\n", tid);
pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
pthread_t threads[NUM_THREADS];
int rc;
long t;
for(t=0; t<NUM_THREADS; t++){
printf("In main: creating thread %ld\n", t);
rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
if (rc){
printf("ERROR; return code from pthread_create() is %d\n", rc);
exit(-1);
}
}

/* Last thing that main() should do */
pthread_exit(NULL);
}

but when i build the application withe eCos library, i got these errors

/STM3240G/fork$ make hello
arm-eabi-gcc -c -o hello.o 
-I/home/st/config/standard_Posix_install/include -Wall -Wpointer-arith 
-Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings 
-mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections 
-fno-rtti -fno-exceptions hello.c
cc1: warning: command line option "-Woverloaded-virtual" is valid for 
C++/ObjC++ but not for C
cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ 
but not for C
hello.c: In function ‘PrintHello’:
hello.c:10: warning: implicit declaration of function ‘pthread_exit’
hello.c: In function ‘main’:
hello.c:15: error: ‘pthread_t’ undeclared (first use in this function)
hello.c:15: error: (Each undeclared identifier is reported only once
hello.c:15: error: for each function it appears in.)
hello.c:15: error: expected ‘;’ before ‘threads’
hello.c:20: warning: implicit declaration of function ‘pthread_create’
hello.c:20: error: ‘threads’ undeclared (first use in this function)
hello.c:23: warning: implicit declaration of function ‘exit’
hello.c:23: warning: incompatible implicit declaration of built-in 
function ‘exit’
make: *** [hello.o] Error 1

First view is that the thread functions doesn't exist in the header 
thread.h, the configtool generate uncompleted headers,

Please i need your help.

Thanks a lot.



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] POSIX layer and pthread:Unable to make the application
       [not found] ` <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>
@ 2012-04-11 18:38   ` Fabrizio Carrai
  2012-04-12  8:44     ` medamine
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrizio Carrai @ 2012-04-11 18:38 UTC (permalink / raw)
  To: ecos-discuss

Hi,
also this seems a problem on the eCos library configuration generated
with the configtool.
I used the configuration I suggested in a previous post (and that you
adopted!) and I'm able to compile your example. Some warnings, but no
errors.

The inclusion tree is the following:
"pthread.h"
"pkgconf/isoinfra.h"
"cyg/posix/pthread.h"

The latter include the declarations that you miss. Please, check it.
Your "standard_Posix" configuration should be good.

Fabrizio

Il giorno 11 aprile 2012 16:12, medamine <medamine.ecos@gmail.com> ha scritto:

> Hi every one,
>
> I use
> Hardware: ST STM3210E EVAL board
> Packages: posix
> in the section:POSIX threads
>
> POSIX pthread implementation header Enabled=True Value=0
> POSIX mutex/cond var implementation header Enabled=True Value=0
>
> and I got the pthread.h :
>
> #ifndef CYGONCE_ISO_PTHREAD_H
> #define CYGONCE_ISO_PTHREAD_H
> /*===========================================
> //
> // pthread.h
> //
> // POSIX pthread functions
> //
> //===========================================
>
> /* CONFIGURATION */
>
> #include <pkgconf/isoinfra.h> /* Configuration header */
>
> /* INCLUDES */
>
> #ifdef CYGINT_ISO_PTHREAD_IMPL
> # ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
> # include CYGBLD_ISO_PTHREAD_IMPL_HEADER
> # endif
> #endif
>
> #ifdef CYGINT_ISO_PTHREAD_MUTEX
> # ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
> # include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
> # endif
> #endif
>
> #endif /* CYGONCE_ISO_PTHREAD_H multiple inclusion protection */
>
> /* EOF pthread.h */
>
> After that, i wrote this application using thread
>
> #include <pthread.h>
> #include <stdio.h>
> #define NUM_THREADS 5
>
> void *PrintHello(void *threadid)
> {
> long tid;
> tid = (long)threadid;
> printf("Hello World! It's me, thread #%ld!\n", tid);
> pthread_exit(NULL);
> }
>
> int main (int argc, char *argv[])
> {
> pthread_t threads[NUM_THREADS];
> int rc;
> long t;
> for(t=0; t<NUM_THREADS; t++){
> printf("In main: creating thread %ld\n", t);
> rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
> if (rc){
> printf("ERROR; return code from pthread_create() is %d\n", rc);
> exit(-1);
> }
> }
>
> /* Last thing that main() should do */
> pthread_exit(NULL);
> }
>
> but when i build the application withe eCos library, i got these errors
>
> /STM3240G/fork$ make hello
> arm-eabi-gcc -c -o hello.o -I/home/st/config/standard_Posix_install/include -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions hello.c
> cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
> cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
> hello.c: In function ‘PrintHello’:
> hello.c:10: warning: implicit declaration of function ‘pthread_exit’
> hello.c: In function ‘main’:
> hello.c:15: error: ‘pthread_t’ undeclared (first use in this function)
> hello.c:15: error: (Each undeclared identifier is reported only once
> hello.c:15: error: for each function it appears in.)
> hello.c:15: error: expected ‘;’ before ‘threads’
> hello.c:20: warning: implicit declaration of function ‘pthread_create’
> hello.c:20: error: ‘threads’ undeclared (first use in this function)
> hello.c:23: warning: implicit declaration of function ‘exit’
> hello.c:23: warning: incompatible implicit declaration of built-in function ‘exit’
> make: *** [hello.o] Error 1
>
> First view is that the thread functions doesn't exist in the header thread.h, the configtool generate uncompleted headers,
>
> Please i need your help.
>
> Thanks a lot.
>
>
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] POSIX layer and pthread:Unable to make the application
  2012-04-11 18:38   ` Fabrizio Carrai
@ 2012-04-12  8:44     ` medamine
  2012-04-13 16:45       ` Fabrizio Carrai
  0 siblings, 1 reply; 5+ messages in thread
From: medamine @ 2012-04-12  8:44 UTC (permalink / raw)
  To: ecos-discuss

On 04/11/2012 07:38 PM, Fabrizio Carrai wrote:

Hi,

The problem is that I dont have the <cyg/fileio/limits.h> header in my 
install tree also the <cyg/posix/pthread.h> header
and I don't know why the confgtool did not generate these file when I 
build the library, Is it a problem of version of the configtool or what??
> Hi,
> also this seems a problem on the eCos library configuration generated
> with the configtool.
> I used the configuration I suggested in a previous post (and that you
> adopted!) and I'm able to compile your example. Some warnings, but no
> errors.
>
> The inclusion tree is the following:
> "pthread.h"
> "pkgconf/isoinfra.h"
> "cyg/posix/pthread.h"
>
> The latter include the declarations that you miss. Please, check it.
> Your "standard_Posix" configuration should be good.
>
> Fabrizio
>
> Il giorno 11 aprile 2012 16:12, medamine<medamine.ecos@gmail.com>  ha scritto:
>
>> Hi every one,
>>
>> I use
>> Hardware: ST STM3210E EVAL board
>> Packages: posix
>> in the section:POSIX threads
>>
>> POSIX pthread implementation header Enabled=True Value=0
>> POSIX mutex/cond var implementation header Enabled=True Value=0
>>
>> and I got the pthread.h :
>>
>> #ifndef CYGONCE_ISO_PTHREAD_H
>> #define CYGONCE_ISO_PTHREAD_H
>> /*===========================================
>> //
>> // pthread.h
>> //
>> // POSIX pthread functions
>> //
>> //===========================================
>>
>> /* CONFIGURATION */
>>
>> #include<pkgconf/isoinfra.h>  /* Configuration header */
>>
>> /* INCLUDES */
>>
>> #ifdef CYGINT_ISO_PTHREAD_IMPL
>> # ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
>> # include CYGBLD_ISO_PTHREAD_IMPL_HEADER
>> # endif
>> #endif
>>
>> #ifdef CYGINT_ISO_PTHREAD_MUTEX
>> # ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
>> # include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
>> # endif
>> #endif
>>
>> #endif /* CYGONCE_ISO_PTHREAD_H multiple inclusion protection */
>>
>> /* EOF pthread.h */
>>
>> After that, i wrote this application using thread
>>
>> #include<pthread.h>
>> #include<stdio.h>
>> #define NUM_THREADS 5
>>
>> void *PrintHello(void *threadid)
>> {
>> long tid;
>> tid = (long)threadid;
>> printf("Hello World! It's me, thread #%ld!\n", tid);
>> pthread_exit(NULL);
>> }
>>
>> int main (int argc, char *argv[])
>> {
>> pthread_t threads[NUM_THREADS];
>> int rc;
>> long t;
>> for(t=0; t<NUM_THREADS; t++){
>> printf("In main: creating thread %ld\n", t);
>> rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
>> if (rc){
>> printf("ERROR; return code from pthread_create() is %d\n", rc);
>> exit(-1);
>> }
>> }
>>
>> /* Last thing that main() should do */
>> pthread_exit(NULL);
>> }
>>
>> but when i build the application withe eCos library, i got these errors
>>
>> /STM3240G/fork$ make hello
>> arm-eabi-gcc -c -o hello.o -I/home/st/config/standard_Posix_install/include -Wall -Wpointer-arith -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions hello.c
>> cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
>> cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
>> hello.c: In function ‘PrintHello’:
>> hello.c:10: warning: implicit declaration of function ‘pthread_exit’
>> hello.c: In function ‘main’:
>> hello.c:15: error: ‘pthread_t’ undeclared (first use in this function)
>> hello.c:15: error: (Each undeclared identifier is reported only once
>> hello.c:15: error: for each function it appears in.)
>> hello.c:15: error: expected ‘;’ before ‘threads’
>> hello.c:20: warning: implicit declaration of function ‘pthread_create’
>> hello.c:20: error: ‘threads’ undeclared (first use in this function)
>> hello.c:23: warning: implicit declaration of function ‘exit’
>> hello.c:23: warning: incompatible implicit declaration of built-in function ‘exit’
>> make: *** [hello.o] Error 1
>>
>> First view is that the thread functions doesn't exist in the header thread.h, the configtool generate uncompleted headers,
>>
>> Please i need your help.
>>
>> Thanks a lot.
>>
>>
>>
>> --
>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] POSIX layer and pthread:Unable to make the application
  2012-04-12  8:44     ` medamine
@ 2012-04-13 16:45       ` Fabrizio Carrai
  2012-04-16  8:19         ` medamine
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrizio Carrai @ 2012-04-13 16:45 UTC (permalink / raw)
  To: medamine; +Cc: ecos-discuss

Please check the value of the "POSIX pthread implementation header"
(Macro name is CYGBLD_ISO_PTHREAD_IMPL_HEADER). The value should be
<cyg/posix/pthread.h>
If so, something went bad in the building: **delete** the target
_install and _build directory and start a build from scratch.

Ciao
Fabrizio

Il 12 aprile 2012 10:44, medamine <medamine.ecos@gmail.com> ha scritto:
> On 04/11/2012 07:38 PM, Fabrizio Carrai wrote:
>
> Hi,
>
> The problem is that I dont have the <cyg/fileio/limits.h> header in my
> install tree also the <cyg/posix/pthread.h> header
> and I don't know why the confgtool did not generate these file when I build
> the library, Is it a problem of version of the configtool or what??
>
>> Hi,
>> also this seems a problem on the eCos library configuration generated
>> with the configtool.
>> I used the configuration I suggested in a previous post (and that you
>> adopted!) and I'm able to compile your example. Some warnings, but no
>> errors.
>>
>> The inclusion tree is the following:
>> "pthread.h"
>> "pkgconf/isoinfra.h"
>> "cyg/posix/pthread.h"
>>
>> The latter include the declarations that you miss. Please, check it.
>> Your "standard_Posix" configuration should be good.
>>
>> Fabrizio
>>
>> Il giorno 11 aprile 2012 16:12, medamine<medamine.ecos@gmail.com>  ha
>> scritto:
>>
>>> Hi every one,
>>>
>>> I use
>>> Hardware: ST STM3210E EVAL board
>>> Packages: posix
>>> in the section:POSIX threads
>>>
>>> POSIX pthread implementation header Enabled=True Value=0
>>> POSIX mutex/cond var implementation header Enabled=True Value=0
>>>
>>> and I got the pthread.h :
>>>
>>> #ifndef CYGONCE_ISO_PTHREAD_H
>>> #define CYGONCE_ISO_PTHREAD_H
>>> /*===========================================
>>> //
>>> // pthread.h
>>> //
>>> // POSIX pthread functions
>>> //
>>> //===========================================
>>>
>>> /* CONFIGURATION */
>>>
>>> #include<pkgconf/isoinfra.h>  /* Configuration header */
>>>
>>> /* INCLUDES */
>>>
>>> #ifdef CYGINT_ISO_PTHREAD_IMPL
>>> # ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
>>> # include CYGBLD_ISO_PTHREAD_IMPL_HEADER
>>> # endif
>>> #endif
>>>
>>> #ifdef CYGINT_ISO_PTHREAD_MUTEX
>>> # ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
>>> # include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
>>> # endif
>>> #endif
>>>
>>> #endif /* CYGONCE_ISO_PTHREAD_H multiple inclusion protection */
>>>
>>> /* EOF pthread.h */
>>>
>>> After that, i wrote this application using thread
>>>
>>> #include<pthread.h>
>>> #include<stdio.h>
>>> #define NUM_THREADS 5
>>>
>>> void *PrintHello(void *threadid)
>>> {
>>> long tid;
>>> tid = (long)threadid;
>>> printf("Hello World! It's me, thread #%ld!\n", tid);
>>> pthread_exit(NULL);
>>> }
>>>
>>> int main (int argc, char *argv[])
>>> {
>>> pthread_t threads[NUM_THREADS];
>>> int rc;
>>> long t;
>>> for(t=0; t<NUM_THREADS; t++){
>>> printf("In main: creating thread %ld\n", t);
>>> rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
>>> if (rc){
>>> printf("ERROR; return code from pthread_create() is %d\n", rc);
>>> exit(-1);
>>> }
>>> }
>>>
>>> /* Last thing that main() should do */
>>> pthread_exit(NULL);
>>> }
>>>
>>> but when i build the application withe eCos library, i got these errors
>>>
>>> /STM3240G/fork$ make hello
>>> arm-eabi-gcc -c -o hello.o
>>> -I/home/st/config/standard_Posix_install/include -Wall -Wpointer-arith
>>> -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
>>> -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections -fno-rtti
>>> -fno-exceptions hello.c
>>> cc1: warning: command line option "-Woverloaded-virtual" is valid for
>>> C++/ObjC++ but not for C
>>> cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but
>>> not for C
>>> hello.c: In function ‘PrintHello’:
>>> hello.c:10: warning: implicit declaration of function ‘pthread_exit’
>>> hello.c: In function ‘main’:
>>> hello.c:15: error: ‘pthread_t’ undeclared (first use in this function)
>>> hello.c:15: error: (Each undeclared identifier is reported only once
>>> hello.c:15: error: for each function it appears in.)
>>> hello.c:15: error: expected ‘;’ before ‘threads’
>>> hello.c:20: warning: implicit declaration of function ‘pthread_create’
>>> hello.c:20: error: ‘threads’ undeclared (first use in this function)
>>> hello.c:23: warning: implicit declaration of function ‘exit’
>>> hello.c:23: warning: incompatible implicit declaration of built-in
>>> function ‘exit’
>>> make: *** [hello.o] Error 1
>>>
>>> First view is that the thread functions doesn't exist in the header
>>> thread.h, the configtool generate uncompleted headers,
>>>
>>> Please i need your help.
>>>
>>> Thanks a lot.
>>>
>>>
>>>
>>> --
>>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>>>
>
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] POSIX layer and pthread:Unable to make the application
  2012-04-13 16:45       ` Fabrizio Carrai
@ 2012-04-16  8:19         ` medamine
  0 siblings, 0 replies; 5+ messages in thread
From: medamine @ 2012-04-16  8:19 UTC (permalink / raw)
  To: Fabrizio Carrai; +Cc: ecos-discuss

On 04/13/2012 05:45 PM, Fabrizio Carrai wrote:

Thanks a lot Fabrizio, I corrected the error: I miss to add the POSIX 
File IO compatibility layer package to my configuration, So it's clear 
that the files are not generated by the configtool

Ciao
Mohamed Amine
> Please check the value of the "POSIX pthread implementation header"
> (Macro name is CYGBLD_ISO_PTHREAD_IMPL_HEADER). The value should be
> <cyg/posix/pthread.h>
> If so, something went bad in the building: **delete** the target
> _install and _build directory and start a build from scratch.
>
> Ciao
> Fabrizio
>
> Il 12 aprile 2012 10:44, medamine<medamine.ecos@gmail.com>  ha scritto:
>> On 04/11/2012 07:38 PM, Fabrizio Carrai wrote:
>>
>> Hi,
>>
>> The problem is that I dont have the<cyg/fileio/limits.h>  header in my
>> install tree also the<cyg/posix/pthread.h>  header
>> and I don't know why the confgtool did not generate these file when I build
>> the library, Is it a problem of version of the configtool or what??
>>
>>> Hi,
>>> also this seems a problem on the eCos library configuration generated
>>> with the configtool.
>>> I used the configuration I suggested in a previous post (and that you
>>> adopted!) and I'm able to compile your example. Some warnings, but no
>>> errors.
>>>
>>> The inclusion tree is the following:
>>> "pthread.h"
>>> "pkgconf/isoinfra.h"
>>> "cyg/posix/pthread.h"
>>>
>>> The latter include the declarations that you miss. Please, check it.
>>> Your "standard_Posix" configuration should be good.
>>>
>>> Fabrizio
>>>
>>> Il giorno 11 aprile 2012 16:12, medamine<medamine.ecos@gmail.com>    ha
>>> scritto:
>>>
>>>> Hi every one,
>>>>
>>>> I use
>>>> Hardware: ST STM3210E EVAL board
>>>> Packages: posix
>>>> in the section:POSIX threads
>>>>
>>>> POSIX pthread implementation header Enabled=True Value=0
>>>> POSIX mutex/cond var implementation header Enabled=True Value=0
>>>>
>>>> and I got the pthread.h :
>>>>
>>>> #ifndef CYGONCE_ISO_PTHREAD_H
>>>> #define CYGONCE_ISO_PTHREAD_H
>>>> /*===========================================
>>>> //
>>>> // pthread.h
>>>> //
>>>> // POSIX pthread functions
>>>> //
>>>> //===========================================
>>>>
>>>> /* CONFIGURATION */
>>>>
>>>> #include<pkgconf/isoinfra.h>    /* Configuration header */
>>>>
>>>> /* INCLUDES */
>>>>
>>>> #ifdef CYGINT_ISO_PTHREAD_IMPL
>>>> # ifdef CYGBLD_ISO_PTHREAD_IMPL_HEADER
>>>> # include CYGBLD_ISO_PTHREAD_IMPL_HEADER
>>>> # endif
>>>> #endif
>>>>
>>>> #ifdef CYGINT_ISO_PTHREAD_MUTEX
>>>> # ifdef CYGBLD_ISO_PTHREAD_MUTEX_HEADER
>>>> # include CYGBLD_ISO_PTHREAD_MUTEX_HEADER
>>>> # endif
>>>> #endif
>>>>
>>>> #endif /* CYGONCE_ISO_PTHREAD_H multiple inclusion protection */
>>>>
>>>> /* EOF pthread.h */
>>>>
>>>> After that, i wrote this application using thread
>>>>
>>>> #include<pthread.h>
>>>> #include<stdio.h>
>>>> #define NUM_THREADS 5
>>>>
>>>> void *PrintHello(void *threadid)
>>>> {
>>>> long tid;
>>>> tid = (long)threadid;
>>>> printf("Hello World! It's me, thread #%ld!\n", tid);
>>>> pthread_exit(NULL);
>>>> }
>>>>
>>>> int main (int argc, char *argv[])
>>>> {
>>>> pthread_t threads[NUM_THREADS];
>>>> int rc;
>>>> long t;
>>>> for(t=0; t<NUM_THREADS; t++){
>>>> printf("In main: creating thread %ld\n", t);
>>>> rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
>>>> if (rc){
>>>> printf("ERROR; return code from pthread_create() is %d\n", rc);
>>>> exit(-1);
>>>> }
>>>> }
>>>>
>>>> /* Last thing that main() should do */
>>>> pthread_exit(NULL);
>>>> }
>>>>
>>>> but when i build the application withe eCos library, i got these errors
>>>>
>>>> /STM3240G/fork$ make hello
>>>> arm-eabi-gcc -c -o hello.o
>>>> -I/home/st/config/standard_Posix_install/include -Wall -Wpointer-arith
>>>> -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
>>>> -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections -fno-rtti
>>>> -fno-exceptions hello.c
>>>> cc1: warning: command line option "-Woverloaded-virtual" is valid for
>>>> C++/ObjC++ but not for C
>>>> cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but
>>>> not for C
>>>> hello.c: In function ‘PrintHello’:
>>>> hello.c:10: warning: implicit declaration of function ‘pthread_exit’
>>>> hello.c: In function ‘main’:
>>>> hello.c:15: error: ‘pthread_t’ undeclared (first use in this function)
>>>> hello.c:15: error: (Each undeclared identifier is reported only once
>>>> hello.c:15: error: for each function it appears in.)
>>>> hello.c:15: error: expected ‘;’ before ‘threads’
>>>> hello.c:20: warning: implicit declaration of function ‘pthread_create’
>>>> hello.c:20: error: ‘threads’ undeclared (first use in this function)
>>>> hello.c:23: warning: implicit declaration of function ‘exit’
>>>> hello.c:23: warning: incompatible implicit declaration of built-in
>>>> function ‘exit’
>>>> make: *** [hello.o] Error 1
>>>>
>>>> First view is that the thread functions doesn't exist in the header
>>>> thread.h, the configtool generate uncompleted headers,
>>>>
>>>> Please i need your help.
>>>>
>>>> Thanks a lot.
>>>>
>>>>
>>>>
>>>> --
>>>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>>>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>>>>
>>
>> --
>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-16  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 14:12 [ECOS] POSIX layer and pthread:Unable to make the application medamine
     [not found] ` <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>
2012-04-11 18:38   ` Fabrizio Carrai
2012-04-12  8:44     ` medamine
2012-04-13 16:45       ` Fabrizio Carrai
2012-04-16  8:19         ` medamine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).