[Mono-dev] FW: mono make on cygwin 32 including atomic.c windows x86 has atomic operations

Mark Lintner mlintner at sinenomine.net
Thu Sep 5 18:36:40 UTC 2013


I think this is of interest to you guys. This is as far as I get. I tried taking out the Werror=implicit-function-declaration by commenting it out in the configure.in then reconfiguring. It results in the InterlockedCompareExchange64 being not defined.  So I deleted mono and pulled the latest again and get the original error. This is as of about 1 hour ago, which is after Rodrigo's fix. I have been using Cygwin 32 but I have a 64 bit machine. I don't think that should make a difference though. this is with make V=1 -d



threads.c:2008:2: error: implicit declaration of function 'InterlockedCompareE
hange64' [-Werror=implicit-function-declaration]
threads.c:2008:2: warning: nested extern declaration of 'InterlockedCompareExc
nge64' [-Wnested-externs]
threads.c: In function 'signal_thread_state_change':
threads.c:2235:2: warning: passing argument 3 of 'QueueUserAPC' makes integer
om pointer without a cast [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1637:25: note: expected
LONG_PTR' but argument is of type 'void *'
threads.c: In function 'mono_thread_push_appdomain_ref':
threads.c:3473:3: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'volatile int *'
threads.c: In function 'mono_thread_pop_appdomain_ref':
threads.c:3488:3: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'volatile int *'
threads.c: In function 'mono_thread_internal_has_appdomain_ref':
threads.c:3498:2: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'volatile int *'
threads.c: In function 'mono_thread_execute_interruption':
threads.c:4163:2: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4166:3: warning: passing argument 1 of 'InterlockedDecrement' from i
ompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1491:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c: In function 'mono_thread_request_interruption':
threads.c:4240:2: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4242:2: warning: passing argument 1 of 'InterlockedIncrement' from i
ompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1504:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4258:3: warning: passing argument 3 of 'QueueUserAPC' makes integer
om pointer without a cast [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1637:25: note: expected
LONG_PTR' but argument is of type 'void *'
threads.c: In function 'mono_thread_resume_interruption':
threads.c:4287:2: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4289:2: warning: passing argument 1 of 'InterlockedIncrement' from i
ompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1504:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c: In function 'abort_thread_internal':
threads.c:4635:2: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4639:2: warning: passing argument 1 of 'InterlockedIncrement' from i
ompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1504:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4652:12: warning: unused variable 'interrupt_handle' [-Wunused-varia
e]
threads.c: In function 'suspend_thread_internal':
threads.c:4719:4: warning: passing argument 1 of 'InterlockedCompareExchange'
om incompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1486:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4720:5: warning: passing argument 1 of 'InterlockedIncrement' from i
ompatible pointer type [enabled by default]
In file included from /usr/i686-pc-mingw32/sys-root/mingw/include/windows.h:62
,
                 from /usr/i686-pc-mingw32/sys-root/mingw/include/winsock2.h:4

                 from ../../mono/io-layer/io-layer.h:24,
                 from ../../mono/metadata/domain-internals.h:15,
                 from threads.c:26:
/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h:1504:13: note: expected
olatile LONG *' but argument is of type 'gint32 *'
threads.c:4717:13: warning: unused variable 'interrupt_handle' [-Wunused-varia
e]
cc1: some warnings being treated as errors
Reaping losing child 0x80176828 PID 9632
Makefile:2284: recipe for target `libmonoruntime_la-threads.lo' failed
make[3]: *** [libmonoruntime_la-threads.lo] Error 1
Removing child 0x80176828 PID 9632 from chain.
make[3]: Leaving directory `/usr/src/mono/mono/metadata'
Reaping losing child 0x80065338 PID 5624
Makefile:429: recipe for target `all-recursive' failed
make[2]: *** [all-recursive] Error 1
Removing child 0x80065338 PID 5624 from chain.
make[2]: Leaving directory `/usr/src/mono/mono'
Reaping losing child 0x80060d80 PID 9548
Makefile:510: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
Removing child 0x80060d80 PID 9548 from chain.
make[1]: Leaving directory `/usr/src/mono'
Reaping losing child 0x80088c08 PID 5964
Makefile:437: recipe for target `all' failed
make: *** [all] Error 2
Removing child 0x80088c08 PID 5964 from chain.

________________________________
From: mono-devel-list-bounces at lists.ximian.com [mono-devel-list-bounces at lists.ximian.com] on behalf of Mark Lintner [mlintner at sinenomine.net]
Sent: Wednesday, September 04, 2013 9:53 PM
To: Rodrigo Kumpera
Cc: mono-devel
Subject: Re: [Mono-dev] mono make on cygwin 32 including atomic.c windows x86 has atomic operations




I changed this in configure-in and ran configure and make



if test x"$GCC" = xyes; then
    # Implicit function declarations are not 64 bit safe
 # Do this late, since this causes lots of configure tests to fail
 #CFLAGS="$CFLAGS -m-implicit-function-declaration"
 # jay has a lot of implicit declarations
 JAY_CFLAGS="-Wno-implicit-function-declaration"
fi

Now it looks like it was a mistake because Im getting some errors I really don't understand and they are again related to the interlocked functions which were erroring because they were implicit. So I give up for tonight. I would imagine someone who knows the makefiles knows just what the problem is



       No implicit rule found for `../utils/libmonoutils.la'.
       Finished prerequisites of target file `../utils/libmonoutils.la'.
      No need to remake target `../utils/libmonoutils.la'.
   Finished prerequisites of target file `pedump.exe'.
    Must remake target `pedump.exe'.
make[3]: Entering directory `/usr/src/mono/mono/metadata'
Putting child 0x8029f090 (pedump.exe) PID 9504 on the chain.
Live child 0x8029f090 (pedump.exe) PID 9504
Reaping winning child 0x8029f090 PID 9504
/bin/sh ../../libtool  --tag=CC    --mode=link i686-pc-mingw32-gcc -O -g -O2 -fn
o-strict-aliasing -Wdeclaration-after-statement -Wno-unused-but-set-variable -g
-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-str
ings -Wno-switch -Wno-switch-enum -Wno-unused-value -mno-tls-direct-seg-refs   -
lmswsock -lws2_32 -lole32 -loleaut32 -lpsapi -lversion -ladvapi32 -lwinmm -lkern
el32 -o pedump.exe pedump.o libmonoruntime.la ../io-layer/libwapi.la ../utils/li
bmonoutils.la  ../../libgc/libmonogc.la -L../../eglib/src -leglib -lm -lm   -lws
2_32 -lpsapi -lole32 -lwinmm -loleaut32 -ladvapi32 -lversion
Live child 0x8029f090 (pedump.exe) PID 1676
libtool: link: i686-pc-mingw32-gcc -O -g -O2 -fno-strict-aliasing -Wdeclaration-
after-statement -Wno-unused-but-set-variable -g -Wall -Wunused -Wmissing-prototy
pes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-ext
erns -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum
 -Wno-unused-value -mno-tls-direct-seg-refs -o .libs/pedump.exe pedump.o  ./.lib
s/libmonoruntime.a ../io-layer/.libs/libwapi.a ../utils/.libs/libmonoutils.a -lm
swsock -lkernel32 ../../libgc/.libs/libmonogc.a -L../../eglib/src /usr/src/mono/
eglib/src/.libs/libeglib.a -lws2_32 -lpsapi -lole32 -lwinmm -loleaut32 -ladvapi3
2 -lversion
./.libs/libmonoruntime.a(libmonoruntime_la-threads.o): In function `ves_icall_Sy
stem_Threading_Interlocked_CompareExchange_Long':
/usr/src/mono/mono/metadata/threads.c:2008: undefined reference to `InterlockedC
ompareExchange64'
./.libs/libmonoruntime.a(libmonoruntime_la-threads.o): In function `ves_icall_Sy
stem_Threading_Thread_VolatileRead8':
/usr/src/mono/mono/metadata/threads.c:2536: undefined reference to `InterlockedC
ompareExchange64'
collect2: error: ld returned 1 exit status

________________________________
From: Rodrigo Kumpera [kumpera at gmail.com]
Sent: Wednesday, September 04, 2013 7:22 PM
To: Mark Lintner
Cc: Zoltan Varga [vargaz at gmail.com]; mono-devel
Subject: Re: [Mono-dev] mono make on cygwin 32 including atomic.c windows x86 has atomic operations

I just pushed a fix for that.


On Wed, Sep 4, 2013 at 7:32 PM, Mark Lintner <mlintner at sinenomine.net<mailto:mlintner at sinenomine.net>> wrote:



I previously found an issue in mingw/include/ddk/ntapi.h

/* FIXME: Unknown definitions */

typedef PVOID POBJECT_TYPE_LIST;

typedef PVOID PEXECUTION_STATE;

typedef PVOID PLANGID;

commenting out as follows:

/* FIXME: Unknown definitions */

typedef PVOID POBJECT_TYPE_LIST;

//typedef PVOID PEXECUTION_STATE;

typedef PVOID PLANGID;



Is this a problem for Cygwin or ming?
----------------------------------------------
went back to the mono directory and

did make clean
followed by make

It looks like a mingw header problem not mono as I thought. It would seem like everyone should hit this now that mono must use mingw to do cygwin build. I guess this has to be fixed by mingw.



-------------------------------------------------------------------------------------------------------------------



Unfortunately build does not complete. There is more. Next stop is here. Why is atomic.c even here? I think somehow configure is setting up the makefile wrong.



ogc.a -L../../eglib/src /usr/src/mono/eglib/src/.libs/libeglib.a -lws2_32 -lpsap
i -lole32 -lwinmm -loleaut32 -ladvapi32 -lversion
../utils/.libs/libmonoutils.a(atomic.o): In function `InterlockedCompareExchange
64':
/usr/src/mono/mono/utils/atomic.c:240: undefined reference to `_imp__pthread_mut
ex_lock'
/usr/src/mono/mono/utils/atomic.c:246: undefined reference to `_imp__pthread_mut
ex_unlock'
collect2: error: ld returned 1 exit status
Reaping losing child 0x8029f118 PID 6776
Makefile:1243: recipe for target `pedump.exe' failed
make[3]: *** [pedump.exe] Error 1
Removing child 0x8029f118 PID 6776 from chain.
make[3]: Leaving directory `/usr/src/mono/mono/metadata'
Reaping losing child 0x800652c0 PID 8344
Makefile:429: recipe for target `all-recursive' failed
make[2]: *** [all-recursive] Error 1
Removing child 0x800652c0 PID 8344 from chain.
make[2]: Leaving directory `/usr/src/mono/mono'
Reaping losing child 0x80060de8 PID 8968
Makefile:510: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
Removing child 0x80060de8 PID 8968 from chain.
make[1]: Leaving directory `/usr/src/mono'
Reaping losing child 0x80088b28 PID 8692
Makefile:437: recipe for target `all' failed
make: *** [all] Error 2
Removing child 0x80088b28 PID 8692 from chain.



grep tells me this really is not defined



me at My-PC<mailto:me at My-PC> /usr/src/mono
$ grep -rl _imp__pthread_mutex_unlock .
./mono/utils/.libs/atomic.o
./mono/utils/.libs/libmonoutils.a
./mono/utils/atomic.o





So looking at atomic.c



#if defined (TARGET_MACH) && defined (TARGET_ARM) && (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__))

gint64 InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp)  __attribute__ ((naked));

gint64
InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp)
{
 __asm__ (
 "push {r4, r5, r6, r7}\n"
 "ldr r4, [sp, #16]\n"
 "dmb\n"
"1:\n"
 "ldrexd r6, r7, [r0]\n"
 "cmp r7, r4\n"
 "bne 2f\n"
 "cmp r6, r3\n"
 "bne 2f\n"
 "strexd r5, r1, r2, [r0]\n"
 "cmp r5, #0\n"
 "bne 1b\n"
"2:\n"
 "dmb\n"
 "mov r0, r6\n"
 "mov r1, r7\n"
 "pop {r4, r5, r6, r7}\n"
 "bx lr\n"
 );
}

#else

gint64
InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp)
{
 gint64 old;

 pthread_mutex_lock (&spin);

 old = *dest;
 if(old == comp)
  *dest = exch;

 pthread_mutex_unlock (&spin);
 return old;
}





Windows has interlocked operations. The if statement does not seem to be relevant to windows, neither option is correct for windows, I don't believe it should be building this file on windows and intel hardware. This all built fine a couple of months ago and it builds fine on Centos 6.4 but then Centos has pthreads.

________________________________
From: Zoltan Varga [vargaz at gmail.com<mailto:vargaz at gmail.com>]
Sent: Tuesday, September 03, 2013 11:45 PM
To: Mark Lintner
Cc: mono-devel
Subject: Re: [Mono-dev] mono from git will not build on cygwin 32

Hi,

  Try running with make V=1, that will print more information.

           Zoltan


On Wed, Sep 4, 2013 at 6:05 AM, mlgo <mlintner at sinenomine.net<mailto:mlintner at sinenomine.net>> wrote:
I updated Cygwin and now it no longer supports compilation of mono with gcc.
There is no way to backlevel it. I found Zoltan's suggestion to use this
configure statement:

"Hi,

  mono master can be built on windows using the mingw cross-compiler gcc,
i.e. install the mingw-gcc package, and configure using:

./autogen.sh --host=i686-pc-mingw32
                  Zoltan"


I'm using mono from git. Cygwin has all the recommended packages and I did
not install the gcc-g++ but installed all mingw packages.  The build now
always stops here. I have reinstalled Cygwin several times and pulled a new
mono each time. I'm wondering now since there is a 64 bit Cygwin and a I
have 64 bit machine should I be configuring with mingw64 or something.
However I had the old Cygwin environment down to a science and now I'm
crippled again. Has anybody seen this yet. This seems like something
configure is failing to generate properly to map ming types to mono types.
Zoltan will know what to do about this if anybody. It doesn't seem like it
could be a bug in ming.

al':
process.c:912:3: warning: passing argument 1 of 'EnumProcesses' from
incompatibl
e pointer type [enabled by default]
In file included from ../../mono/io-layer/io-layer.h:34:0,
                 from ../../mono/metadata/domain-internals.h:15,
                 from ../../mono/metadata/metadata-internals.h:8,
                 from ../../mono/metadata/class-internals.h:10,
                 from ../../mono/metadata/object-internals.h:8,
                 from process.c:16:
/usr/i686-pc-mingw32/sys-root/mingw/include/psapi.h:108:13: note: expected
'DWOR
D *' but argument is of type 'guint32 *'
Makefile:2221: recipe for target `libmonoruntime_la-process.lo' failed
make[3]: *** [libmonoruntime_la-process.lo] Error 1
make[3]: Leaving directory `/usr/src/mono/mono/metadata'
Makefile:429: recipe for target `all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/src/mono/mono'
Makefile:510: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/mono'
Makefile:437: recipe for target `all' failed
make: *** [all] Error 2



--
View this message in context: http://mono.1490590.n4.nabble.com/mono-from-git-will-not-build-on-cygwin-32-tp4660749.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com<mailto:Mono-devel-list at lists.ximian.com>
http://lists.ximian.com/mailman/listinfo/mono-devel-list


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com<mailto:Mono-devel-list at lists.ximian.com>
http://lists.ximian.com/mailman/listinfo/mono-devel-list


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130905/9da730c4/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT00001.txt
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130905/9da730c4/attachment-0001.txt>


More information about the Mono-devel-list mailing list