Hi Pedro,

thanks for the hints, I got libpthread compiling now. Since __MINGW32__ is 
defined, the code assumes some things that are not true for WinCE, e.g. like 
having errno. Instead of modifying mingw32ce now I just modify the 
pthread-w32-2.8.0 code and add a few more compiler flags, see the attached diff 
file. I compile with

make CROSS=arm-wince-mingw32ce- CC="arm-wince-mingw32ce-g++ -DWINCE 
-DNEED_ERRNO -D_ARM_ -D__CRTDLL__ -D_DLL" clean GC

PS: I still can't compile jamvm because of missing liltdl. Do you know where I 
can find it for WinCE? It seems to be part of glibc...

Kind Regards,
Leonardo.

----- Ursprüngliche Mail ----
Von: Pedro Alves <[EMAIL PROTECTED]>
An: Leonardo Weiss Chaves <[EMAIL PROTECTED]>
CC: cegcc-devel@lists.sourceforge.net
Gesendet: Freitag, den 20. Juli 2007, 16:01:45 Uhr
Betreff: Re: AW: [Cegcc-devel] Building pthread.


Leonardo Weiss Chaves wrote:
> I am still not able to compile any kind of pthreads with cegcc/mingw32ce.
>  
> I did some smaller modifications to the source of mingw32e and to 
> pthread-w32-2.8.0, and it almost compiles. But at the end I get lots of 
> undefined references. This is strange, since the compiler flag "-DWINCE" 
> should take care of this, for instance by using the errno hack you mentioned.
>  
> I commented the following lines out on mingw32Ce files:
>   errno.h 12,13,14,109
>   signal.h 12
>   process.h 99,102
>  

You shouldn't do this.  That include_next is there to make it as if the files
didn't exist.  Either provide your own versions of these files in the include
path (-I), so the include_next picks them up, or don't include them in
the first place:

#ifndef _WIN32_WCE
#include <errno.h>
#endif

or,

#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif

or similar.


> arm-wince-mingw32ce-g++ -DWINCE -D__CLEANUP_C -O3 -finline-functions -shared 
> -o pthreadGC2.dll attr.o barrier.o cancel.o cleanup.o condvar.o create.o 
> dll.o errno.o exit.o fork.o global.o misc.o mutex.o nonportable.o private.o 
> rwlock.o sched.o semaphore.o signal.o spin.o sync.o tsd.o version.o

I don't see any libs being linked in here?  Where is the -lws2 ?

> condvar.o:condvar.c:(.text+0x184): undefined reference to `errno'
> condvar.o:condvar.c:(.text+0x25c): undefined reference to `errno'
> condvar.o:condvar.c:(.text+0x400): undefined reference to `errno'
> condvar.o:condvar.c:(.text+0x5a0): undefined reference to `errno'
> condvar.o:condvar.c:(.text+0x6f0): undefined reference to `errno'
> condvar.o:condvar.c:(.text+0x848): more undefined references to `errno' follow
> create.o:create.c:(.text+0x108): undefined reference to `_beginthread'
> exit.o:exit.c:(.text+0x2c): undefined reference to `_endthread'
> misc.o:misc.c:(.text+0x224): undefined reference to `ptw32_mcs_lock_acquire'
> misc.o:misc.c:(.text+0x244): undefined reference to `ptw32_mcs_lock_release'
> misc.o:misc.c:(.text+0x274): undefined reference to `ptw32_mcs_lock_release'
> mutex.o:mutex.c:(.text+0x3c8): undefined reference to `ptw32_relmillisecs'
> mutex.o:mutex.c:(.text+0x550): undefined reference to `ptw32_relmillisecs'
> private.o:private.c:(.text+0xe4): undefined reference to `errno'
> private.o:private.c:(.text+0x2b8): undefined reference to `_endthread'
> private.o:private.c:(.text+0x4d4): undefined reference to `_endthread'
> sched.o:sched.c:(.text+0x1c): undefined reference to `errno'
> sched.o:sched.c:(.text+0x3c): undefined reference to `errno'
> sched.o:sched.c:(.text+0xb4): undefined reference to `errno'
> sched.o:sched.c:(.text+0x130): undefined reference to `errno'
> semaphore.o:semaphore.c:(.text+0x14): undefined reference to `errno'
> semaphore.o:semaphore.c:(.text+0x2c): more undefined references to `errno' 
> follow
> semaphore.o:semaphore.c:(.text+0x32c): undefined reference to 
> `ptw32_relmillisecs'
> semaphore.o:semaphore.c:(.text+0x3ec): undefined reference to `errno'
> semaphore.o:semaphore.c:(.text+0x550): undefined reference to `errno'
> semaphore.o:semaphore.c:(.text+0x61c): undefined reference to `errno'
> semaphore.o:semaphore.c:(.text+0x6d4): undefined reference to `errno'

Looks like you are missing some .o's in the link command line.  Try to find
where the 'int errno' is defined as opposed to just declared (extern int errno).
Same for _beginthread/_endthread, they should be defined somewhere
in the pthreads WinCE port, as WinCE doesn't provide those.

> tsd.o:tsd.c:(.text+0x18): undefined reference to `WSAGetLastError'
> tsd.o:tsd.c:(.text+0x38): undefined reference to `WSASetLastError'

These come from ws2.dll, but you don't have it in the command line... (-lws2)

Cheers,
Pedro Alves


      __________________________________  Die etwas anderen Infos rund um das 
Thema Reisen. BE A BETTER WELTENBUMMLER!  www.yahoo.de/clever
diff pthreads-w32-2-8-0-release/create.c pthreads-w32-2-8-0-wince/create.c
203c203
< #if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) 
---
> #if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) || 
> defined (WINCE)
207,208c207,208
<     (HANDLE) _beginthreadex ((void *) NULL,   /* No security info             
*/
<                            (unsigned) stackSize,      /* default stack size   
*/
---
>     (HANDLE) _beginthreadex ((_SECURITY_ATTRIBUTES*) NULL,    /* No security 
> info             */
>                            (DWORD) stackSize, /* default stack size   */
211c211
<                            (unsigned)
---
>                            (DWORD)
213c213
<                            (unsigned *) &(tp->thread));
---
>                            (DWORD *) &(tp->thread));
diff pthreads-w32-2-8-0-release/errno.c pthreads-w32-2-8-0-wince/errno.c
77c77
<   if ((self = pthread_self ()) == NULL)
---
>   if ((self = pthread_self ()).p == NULL)
87c87
<       result = &(self->ptErrno);
---
>       result = 0; //&(self->ptErrno);
diff pthreads-w32-2-8-0-release/GNUmakefile pthreads-w32-2-8-0-wince/GNUmakefile
66c66
< LFLAGS                = -lwsock32
---
> LFLAGS                = -lws2
Only in pthreads-w32-2-8-0-wince: libpthreadGC2.a
Common subdirectories: pthreads-w32-2-8-0-release/manual and 
pthreads-w32-2-8-0-wince/manual
diff pthreads-w32-2-8-0-release/misc.c pthreads-w32-2-8-0-wince/misc.c
39a40
> #include "ptw32_MCS_lock.c"
diff pthreads-w32-2-8-0-release/mutex.c pthreads-w32-2-8-0-wince/mutex.c
45a46,47
> #include "ptw32_timespec.c"
> #include "ptw32_relmillisecs.c"
diff pthreads-w32-2-8-0-release/pthread_cancel.c 
pthreads-w32-2-8-0-wince/pthread_cancel.c
39a40,48
> #if defined(WINCE) && defined(_ARM_) 
>    /* This is a hack as i don't know what to use (Marcel Ruff 2006-11-29) */ 
>    static ULONG val; 
> #  define PTW32_PROGCTR(Context)  (val) 
>    /* TODO: What to use from 
>    /* typedef struct _CONTEXT in C:\Program Files\Microsoft Visual Studio 
> 8\SmartDevices\SDK\Smartphone2003\Include\winnt.h */ 
>    /*#define PTW32_PROGCTR(Context)  ((Context).FpExc)*/ 
> #endif 
> 
diff pthreads-w32-2-8-0-release/pthread_detach.c 
pthreads-w32-2-8-0-wince/pthread_detach.c
45c45
< #include <signal.h>
---
> // #include <signal.h>
diff pthreads-w32-2-8-0-release/pthread_exit.c 
pthreads-w32-2-8-0-wince/pthread_exit.c
91c91
< #if ! defined (__MINGW32__) || defined (__MSVCRT__)  || defined (__DMC__)
---
> #if ! defined (__MINGW32__) || defined (__MSVCRT__)  || defined (__DMC__) || 
> defined (WINCE)
Only in pthreads-w32-2-8-0-wince: pthreadGC2.dll
diff pthreads-w32-2-8-0-release/pthread_join.c 
pthreads-w32-2-8-0-wince/pthread_join.c
45c45
< #include <signal.h>
---
> //#include <signal.h>
diff pthreads-w32-2-8-0-release/pthread_kill.c 
pthreads-w32-2-8-0-wince/pthread_kill.c
44c44
< #include <signal.h>
---
> // #include <signal.h>
diff pthreads-w32-2-8-0-release/pthread_rwlockattr_destroy.c 
pthreads-w32-2-8-0-wince/pthread_rwlockattr_destroy.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlockattr_getpshared.c 
pthreads-w32-2-8-0-wince/pthread_rwlockattr_getpshared.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlockattr_init.c 
pthreads-w32-2-8-0-wince/pthread_rwlockattr_init.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlockattr_setpshared.c 
pthreads-w32-2-8-0-wince/pthread_rwlockattr_setpshared.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_destroy.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_destroy.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_init.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_init.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_rdlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_rdlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_timedrdlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_timedrdlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_timedwrlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_timedwrlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_tryrdlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_tryrdlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_trywrlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_trywrlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_unlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_unlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
diff pthreads-w32-2-8-0-release/pthread_rwlock_wrlock.c 
pthreads-w32-2-8-0-wince/pthread_rwlock_wrlock.c
37c37
< #include <errno.h>
---
> //#include <errno.h>
Only in pthreads-w32-2-8-0-wince: _pthreads-2006-11-29.patch.txt
diff pthreads-w32-2-8-0-release/ptw32_callUserDestroyRoutines.c 
pthreads-w32-2-8-0-wince/ptw32_callUserDestroyRoutines.c
43,44c43,44
< using
<   std::terminate;
---
> //using
> //  std::terminate;
193c193
<                     terminate ();
---
> //                  terminate ();
diff pthreads-w32-2-8-0-release/ptw32_threadStart.c 
pthreads-w32-2-8-0-wince/ptw32_threadStart.c
346c346
< #if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__)
---
> #if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) || 
> defined (WINCE)
diff pthreads-w32-2-8-0-release/ptw32_throw.c 
pthreads-w32-2-8-0-wince/ptw32_throw.c
94c94
< #if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__)
---
> #if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) || 
> defined (WINCE)
diff pthreads-w32-2-8-0-release/semaphore.c pthreads-w32-2-8-0-wince/semaphore.c
57a58,59
> #include "ptw32_timespec.c"
> #include "ptw32_relmillisecs.c"
Common subdirectories: pthreads-w32-2-8-0-release/tests and 
pthreads-w32-2-8-0-wince/tests
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to