[Mono-bugs] [Bug 621468] New: cross-compile script get confused by phread-win32 semaphore.h

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jul 11 10:04:30 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=621468

http://bugzilla.novell.com/show_bug.cgi?id=621468#c0


           Summary: cross-compile script get confused by phread-win32
                    semaphore.h
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: io-layer
        AssignedTo: lupus at novell.com
        ReportedBy: htl10 at users.sourceforge.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (compatible; Konqueror/4.4; Linux) KHTML/4.4.4
(like Gecko) Fedora/4.4.4-1.fc13

It is on Fedora 13, which can optionally have mingw32-pthreads ; with current
svn head (r160202 today): 
The problem is that fedora 13 's mingw32-pthreads comes with <semaphore.h> (
/usr/i686-pc-mingw32/sys-root/mingw/include/semaphore.h) which the configure
script can detect when driven by ./build-mingw32.sh . Now, of course if
building for windows (cross-compiling), one should be using windows semaphore
rather than pthread-win32 semaphore. Things gets very confused and broken due
to the presence of /usr/i686-pc-mingw32/sys-root/mingw/include/semaphore.h and
/configure setting HAVE_SEMAPHORE_H .

I found that I need to unset HAVE_SEMAPHORE_H like this below in two places for
svn r160202 to build. (or move the header
"/usr/i686-pc-mingw32/sys-root/mingw/include/semaphore.h", for it not to be
detected, which is more troublesome).

-----------------
diff --git a/mono/io-layer/semaphores.c b/mono/io-layer/semaphores.c
index 73fda73..bb526b1 100644
--- a/mono/io-layer/semaphores.c
+++ b/mono/io-layer/semaphores.c
@@ -10,6 +10,9 @@
 #include <config.h>
 #include <glib.h>
 #include <pthread.h>
+#if defined(__WIN32)
+#undef HAVE_SEMAPHORE_H
+#endif
 #ifdef HAVE_SEMAPHORE_H
 #include <semaphore.h>
 #endif
diff --git a/mono/utils/mono-semaphore.h b/mono/utils/mono-semaphore.h
index d6be806..1ed0518 100644
--- a/mono/utils/mono-semaphore.h
+++ b/mono/utils/mono-semaphore.h
@@ -12,6 +12,9 @@

 #include <config.h>
 #include <glib.h>
+#if defined(__WIN32)
+#undef HAVE_SEMAPHORE_H
+#endif
 #ifdef HAVE_SEMAPHORE_H
 #include <semaphore.h>
 #endif
--------------------------------------

Can you consider putting something similar (TARGET_WIN32?) to undef
HAVE_SEMAPHORE_H so as to use windows semaphore?

Reproducible: Always

Steps to Reproduce:
1. have semaphore.h from pthreads and put it somewhere findable by the mingw
cross-compiler
2. run ./build-mingw32.sh to attempt cross-compiling
3. compilation fails when compiling a file ...../mono-semephore.c , about
mode_t 
Actual Results:  
compilation fails

Expected Results:  
compilation continues and build finishes.

The message:
--------

make[4]: Entering directory
`/home/Hin-Tak/tmp-git/mono-svn/build-cross-windows/mono/utils'
/bin/sh ../../libtool --tag=CC   --mode=compile i686-pc-mingw32-gcc
-DHAVE_CONFIG_H -I. -I../../../mono/utils -I../.. -I../../.. -I../../../mono
-I../../../libgc/include -I../../../eglib/src -I../../eglib/src 
-DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE
-DWIN32_THREADS -DFD_SETSIZE=1024  -g -O2 -fno-strict-aliasing
-Wdeclaration-after-statement -g -Wall -Wunused -Wmissing-prototypes
-Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes
-Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings
-mno-tls-direct-seg-refs -MT mono-semaphore.lo -MD -MP -MF
deps/mono-semaphore.Tpo -c -o mono-semaphore.lo
./../../mono/utils/mono-semaphore.c
libtool: compile:  i686-pc-mingw32-gcc -DHAVE_CONFIG_H -I.
-I../../../mono/utils -I../.. -I../../.. -I../../../mono
-I../../../libgc/include -I../../../eglib/src -I../../eglib/src -DWINVER=0x0500
-D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS
-DFD_SETSIZE=1024 -g -O2 -fno-strict-aliasing -Wdeclaration-after-statement -g
-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual
-Wwrite-strings -mno-tls-direct-seg-refs -MT mono-semaphore.lo -MD -MP -MF
deps/mono-semaphore.Tpo -c ../../../mono/utils/mono-semaphore.c  -DDLL_EXPORT
-DPIC -o .libs/mono-semaphore.o
./../../mono/utils/mono-semaphore.c: In function 'mono_sem_timedwait':
./../../mono/utils/mono-semaphore.c:37: error: storage size of 'ts' isn't
known
./../../mono/utils/mono-semaphore.c:37: error: storage size of 'copy' isn't
known
./../../mono/utils/mono-semaphore.c:51: warning: implicit declaration of
function 'gettimeofday'
./../../mono/utils/mono-semaphore.c:51: warning: nested extern declaration of
'gettimeofday'
./../../mono/utils/mono-semaphore.c:37: warning: unused variable 'copy'
./../../mono/utils/mono-semaphore.c:37: warning: unused variable 'ts'
make[4]: *** [mono-semaphore.lo] Error 1
-------------

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list