public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Fabrizio Carrai <f.carrai@libero.it>
To: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] POSIX layer and pthread:Unable to make the application
Date: Wed, 11 Apr 2012 18:38:00 -0000	[thread overview]
Message-ID: <CAJXPg6KnN_QMCR7L3Bmk+9et_F+17yEHmZSD3auSWUAMLuuvEw@mail.gmail.com> (raw)
In-Reply-To: <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>

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

  parent reply	other threads:[~2012-04-11 18:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 14:12 medamine
     [not found] ` <CAJXPg6Ja=tT3NR1s-S6skPb2E7ZmLwdSparKm+z4RaYH2xPG=w@mail.gmail.com>
2012-04-11 18:38   ` Fabrizio Carrai [this message]
2012-04-12  8:44     ` medamine
2012-04-13 16:45       ` Fabrizio Carrai
2012-04-16  8:19         ` medamine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJXPg6KnN_QMCR7L3Bmk+9et_F+17yEHmZSD3auSWUAMLuuvEw@mail.gmail.com \
    --to=f.carrai@libero.it \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).