Re: [Mingw-w64-public] libintl incompatible w/ Python_x64-2.7.3 ctypes

2013-04-17 Thread Mark Mikofski
From: JonY 
>To: mingw-w64-public@lists.sourceforge.net
>Sent: Wednesday, April 17, 2013 3:19 PM
>Subject: Re: [Mingw-w64-public] libintl incompatible w/ Python_x64-2.7.3 ctypes
> 
>
>On 4/18/2013 06:07, Mark Mikofski wrote:
>> I built libiconv and gettext with reubenv's 64 bit toolchain,
>> x86_64-w64-mingw32-gcc-4.7.2 (for x64 os)
>> 
>> builds fine, but I can't call the dll from Python.
>> 
>> I assume that since the build targets x64 it builds an x64 dll, but still 
>> python says it's not valid win32 application
>> 
 Traceback (most recent call last):
   File "c:/meld/bin/meld", line 98, in 
     libintl = cdll.intl
   File
>>> "c:\Python27\lib\ctypes\__init__.py", line 435, in __getattr__
     dll = self._dlltype(name)
   File "c:\Python27\lib\ctypes\__init__.py", line 365, in __init__
     self._handle = _dlopen(self._name, mode)
 WindowsError: [Error 193] "%1 is not a valid Win32 application
>> 
>> I
just ran ./configure, make & make install with no options. Maybe I need to link 
against msvcrt90.dll to linker?
>> 
>
>This has nothing to do with msvcr*, check your python code.
>
>
>
>--
>Precog is a next-generation analytics platform capable of advanced
>analytics on semi-structured data. The platform includes APIs for building
>apps and a phenomenal toolset for data science. Developers can use
>our toolset for easy data analysis & visualization. Get a free account!
>http://www2.precog.com/precogplatform/slashdotnewsletter
>___
>Mingw-w64-public mailing list
>Mingw-w64-public@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>


Thanks for your quick response JonY


I am not using any python "code" other than the standard library.

Steps to reproduce
1. get a windows7 x64 computer
2. install python-2.7.3 for x64
3. download x86_64-w64-mingw32-gcc-4.7.2-release-win64_rubenvb.7z and extract 
to c:\mingw64
4. download MSYS-2023.zip and extract to c:\msys
5. run msys postinstall and edit fstab to point /mingw to c:\mingw64
6. download and extract libiconv and gettext
7. start msys and browse to downloads
8. in libiconv run ./configure, make then make install
9. in gettext run ./configure, make then make install

10. cd to /local/bin
11. start python interpreter
12. from ctypes import *

13. intl = cdll.LoadLibrary('libintl-8.dll') or cdll.intl whichever works, and 
depending on your version of libintl
14. traceback complains it is not a valid win32 application, which means that 
the compiled version is incompatible with Python

Anyway, sort of a moot point, the version of libintl-8 in gtk/runtime for x64 
works fine.

Thanks again for your help.


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] msvcr*: add aliases for some underscore prefixed funtions:

2013-04-17 Thread Rafaël Carré
getcwd, putenv
swab, strdup, stricmp, lfind
open, write, close, fdopen, read, dup, access, fileno, isatty, setmode
---
 mingw-w64-crt/lib32/msvcr100.def |   16 
 mingw-w64-crt/lib32/msvcr110.def |   16 
 mingw-w64-crt/lib32/msvcr80.def  |   16 
 mingw-w64-crt/lib32/msvcr90.def  |   16 
 mingw-w64-crt/lib32/msvcr90d.def |   16 
 mingw-w64-crt/lib64/msvcr100.def |   16 
 mingw-w64-crt/lib64/msvcr110.def |   16 
 mingw-w64-crt/lib64/msvcr80.def  |   16 
 mingw-w64-crt/lib64/msvcr90.def  |   16 
 mingw-w64-crt/lib64/msvcr90d.def |   16 
 10 files changed, 160 insertions(+)

diff --git a/mingw-w64-crt/lib32/msvcr100.def b/mingw-w64-crt/lib32/msvcr100.def
index f877e33..409f791 100644
--- a/mingw-w64-crt/lib32/msvcr100.def
+++ b/mingw-w64-crt/lib32/msvcr100.def
@@ -717,6 +717,7 @@ __winitenv DATA
 _abnormal_termination
 _abs64
 _access
+access == _access
 _access_s
 _acmdln DATA
 _aligned_free
@@ -764,6 +765,7 @@ _chsize
 _chsize_s
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -808,6 +810,7 @@ _difftime64 DATA
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _ecvt
@@ -836,6 +839,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -844,6 +848,7 @@ _filbuf
 _filelength
 _filelengthi64
 _fileno
+fileno == _fileno
 _findclose
 _findfirst32
 _findfirst32i64
@@ -931,6 +936,7 @@ _getch_nolock
 _getche
 _getche_nolock
 _getcwd
+getcwd == _getcwd
 _getdcwd
 _getdcwd_nolock
 _getdiskfree
@@ -981,6 +987,7 @@ _iob DATA
 _isalnum_l
 _isalpha_l
 _isatty
+isatty == _isatty
 _iscntrl_l
 _isctype
 _isctype_l
@@ -1075,6 +1082,7 @@ _j1
 _jn
 _kbhit
 _lfind
+lfind == _lfind
 _lfind_s
 _loaddll
 _local_unwind2
@@ -1254,6 +1262,7 @@ _msize
 _nextafter
 _onexit
 _open
+open == _open
 _open_osfhandle
 _outp
 _outpd
@@ -1271,6 +1280,7 @@ _purecall
 _putch
 _putch_nolock
 _putenv
+putenv == _putenv
 _putenv_s
 _putw
 _putwch
@@ -1278,6 +1288,7 @@ _putwch_nolock
 _putws
 _pwctype DATA
 _read
+read == _read
 _realloc_crt
 _recalloc
 _recalloc_crt
@@ -1321,6 +1332,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1371,10 +1383,12 @@ _strcoll_l
 _strdate
 _strdate_s
 _strdup
+strdup == _strdup
 _strerror
 _strerror_s
 _strftime_l
 _stricmp
+stricmp == _stricmp
 _stricmp_l
 _stricoll
 _stricoll_l
@@ -1408,6 +1422,7 @@ _strupr_s
 _strupr_s_l
 _strxfrm_l
 _swab
+swab == _swab
 _swprintf
 _swprintf_c
 _swprintf_c_l
@@ -1618,6 +1633,7 @@ _wputenv_s
 _wremove
 _wrename
 _write
+write == _write
 _wrmdir
 _wscanf_l
 _wscanf_s_l
diff --git a/mingw-w64-crt/lib32/msvcr110.def b/mingw-w64-crt/lib32/msvcr110.def
index c3413f5..33d975b 100644
--- a/mingw-w64-crt/lib32/msvcr110.def
+++ b/mingw-w64-crt/lib32/msvcr110.def
@@ -841,6 +841,7 @@ __winitenv DATA
 _abnormal_termination
 _abs64
 _access
+access == _access
 _access_s
 _acmdln DATA
 _aligned_free
@@ -888,6 +889,7 @@ _chsize
 _chsize_s
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -932,6 +934,7 @@ _difftime64
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _ecvt
@@ -959,6 +962,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -967,6 +971,7 @@ _filbuf
 _filelength
 _filelengthi64
 _fileno
+fileno == _fileno
 _findclose
 _findfirst32
 _findfirst == _findfirst32
@@ -1054,6 +1059,7 @@ _getch_nolock
 _getche
 _getche_nolock
 _getcwd
+getcwd == _getcwd
 _getdcwd
 _getdiskfree
 _getdllprocaddr
@@ -1103,6 +1109,7 @@ _iob DATA
 _isalnum_l
 _isalpha_l
 _isatty
+isatty == _isatty
 _iscntrl_l
 _isctype
 _isctype_l
@@ -1197,6 +1204,7 @@ _j1
 _jn
 _kbhit
 _lfind
+lfind == _lfind
 _lfind_s
 _libm_sse2_acos_precise
 _libm_sse2_asin_precise
@@ -1387,6 +1395,7 @@ _msize
 _nextafter
 _onexit
 _open
+open == _open
 _open_osfhandle
 _outp
 _outpd
@@ -1404,6 +1413,7 @@ _purecall ; Check!!! Couldn't determine function argument 
count. Function doesn'
 _putch
 _putch_nolock
 _putenv
+putenv == _putenv
 _putenv_s
 _putw
 _putwch
@@ -1411,6 +1421,7 @@ _putwch_nolock
 _putws
 _pwctype DATA
 _read
+read == _read
 _realloc_crt
 _recalloc
 _recalloc_crt
@@ -1454,6 +1465,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1504,10 +1516,12 @@ _strcoll_l
 _strdate
 _strdate_s
 _strdup
+strdup == _strdup
 _strerror
 _strerror_s
 _strftime_l
 _stricmp
+stricmp == _stricmp
 _stricmp_l
 _stricoll
 _stricoll_l
@@ -1541,6 +1555,7 @@ _strupr_s
 _strupr_s_l
 _strxfrm_l
 _swab
+swab == _swab
 _swprintf
 _swprintf_c
 _swprintf_c_l
@@ -1751,6 +1766,7 @@ _wputenv_s
 _wremove
 _wrename
 _write
+write == _write
 _wrmdir
 _wscanf_l
 _wscanf_s_l
diff --git a/mingw-w64-crt/lib32/msvcr80.def b/mingw-w64-crt/lib32/msvcr80.def
index 9c28d30..f2c87b8 100644
--- a/mingw-w64-crt/l

Re: [Mingw-w64-public] _wstat issue

2013-04-17 Thread Antony Riakiotakis
Yes, the x64 target.
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] libintl incompatible w/ Python_x64-2.7.3 ctypes

2013-04-17 Thread JonY
On 4/18/2013 06:07, Mark Mikofski wrote:
> I built libiconv and gettext with reubenv's 64 bit toolchain,
> x86_64-w64-mingw32-gcc-4.7.2 (for x64 os)
> 
> builds fine, but I can't call the dll from Python.
> 
> I assume that since the build targets x64 it builds an x64 dll, but still 
> python says it's not valid win32 application
> 
>>> Traceback (most recent call last):
>>>   File "c:/meld/bin/meld", line 98, in 
>>> libintl = cdll.intl
>>>   File
>> "c:\Python27\lib\ctypes\__init__.py", line 435, in __getattr__
>>> dll = self._dlltype(name)
>>>   File "c:\Python27\lib\ctypes\__init__.py", line 365, in __init__
>>> self._handle = _dlopen(self._name, mode)
>>> WindowsError: [Error 193] "%1 is not a valid Win32 application
> 
> I just ran ./configure, make & make install with no options. Maybe I need to 
> link against msvcrt90.dll to linker?
> 

This has nothing to do with msvcr*, check your python code.




signature.asc
Description: OpenPGP digital signature
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] libintl incompatible w/ Python_x64-2.7.3 ctypes

2013-04-17 Thread Mark Mikofski
I built libiconv and gettext with reubenv's 64 bit toolchain,
x86_64-w64-mingw32-gcc-4.7.2 (for x64 os)

builds fine, but I can't call the dll from Python.

I assume that since the build targets x64 it builds an x64 dll, but still 
python says it's not valid win32 application

>>Traceback (most recent call last):
>>  File "c:/meld/bin/meld", line 98, in 
>>    libintl = cdll.intl
>>  File
> "c:\Python27\lib\ctypes\__init__.py", line 435, in __getattr__
>>    dll = self._dlltype(name)
>>  File "c:\Python27\lib\ctypes\__init__.py", line 365, in __init__
>>    self._handle = _dlopen(self._name, mode)
>>WindowsError: [Error 193] "%1 is not a valid Win32 application

I just ran ./configure, make & make install with no options. Maybe I need to 
link against msvcrt90.dll to linker?


Thanks,
Mark Mikofski
poquitopicante.blogspot.com
breakingbytes.blogspot.com
www.breaking-bytes.com--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] _wstat issue

2013-04-17 Thread Rafaël Carré
Hello,

Are you using x86_64 target ?

Any reason for needing HAVE_32BIT_TIME_T btw?

Le 17/04/2013 20:38, Antony Riakiotakis a écrit :
> Hi, I have identified a pretty nasty bug in the MinGW64 headers.
> 
> The case that follows happens for _USE_32BIT_TIME_T undefined
> 
> _wstat is defined as _wstat64i32 in _mingw_stat64.h
> 
> This function expects a stat argument, and judging from the name the
> argument should be of type _stat64i32 instead, stat is defined as_stat64 in
> the relevant header (sys/stat.h). We have run into this issue in blender
> and _wstat returns erratic sizes, making our thumbnail system, possibly
> others too, misbehave.
> 
> Indeed substituting stat with _stat64i32 in the code seems to fix the issue

--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] msvcr*: add aliases for strdup, close, dup, fdopen, setmode

2013-04-17 Thread Rafaël Carré
---
 mingw-w64-crt/lib32/msvcr100.def |5 +
 mingw-w64-crt/lib32/msvcr110.def |5 +
 mingw-w64-crt/lib32/msvcr80.def  |5 +
 mingw-w64-crt/lib32/msvcr90.def  |5 +
 mingw-w64-crt/lib32/msvcr90d.def |5 +
 mingw-w64-crt/lib64/msvcr100.def |5 +
 mingw-w64-crt/lib64/msvcr110.def |5 +
 mingw-w64-crt/lib64/msvcr80.def  |5 +
 mingw-w64-crt/lib64/msvcr90.def  |5 +
 mingw-w64-crt/lib64/msvcr90d.def |5 +
 10 files changed, 50 insertions(+)

diff --git a/mingw-w64-crt/lib32/msvcr100.def b/mingw-w64-crt/lib32/msvcr100.def
index f877e33..e0ed2c5 100644
--- a/mingw-w64-crt/lib32/msvcr100.def
+++ b/mingw-w64-crt/lib32/msvcr100.def
@@ -764,6 +764,7 @@ _chsize
 _chsize_s
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -808,6 +809,7 @@ _difftime64 DATA
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _ecvt
@@ -836,6 +838,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -1321,6 +1324,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1371,6 +1375,7 @@ _strcoll_l
 _strdate
 _strdate_s
 _strdup
+strdup == _strdup
 _strerror
 _strerror_s
 _strftime_l
diff --git a/mingw-w64-crt/lib32/msvcr110.def b/mingw-w64-crt/lib32/msvcr110.def
index c3413f5..32ee80d 100644
--- a/mingw-w64-crt/lib32/msvcr110.def
+++ b/mingw-w64-crt/lib32/msvcr110.def
@@ -888,6 +888,7 @@ _chsize
 _chsize_s
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -932,6 +933,7 @@ _difftime64
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _ecvt
@@ -959,6 +961,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -1454,6 +1457,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1504,6 +1508,7 @@ _strcoll_l
 _strdate
 _strdate_s
 _strdup
+strdup == _strdup
 _strerror
 _strerror_s
 _strftime_l
diff --git a/mingw-w64-crt/lib32/msvcr80.def b/mingw-w64-crt/lib32/msvcr80.def
index 9c28d30..5f19400 100644
--- a/mingw-w64-crt/lib32/msvcr80.def
+++ b/mingw-w64-crt/lib32/msvcr80.def
@@ -126,6 +126,7 @@ _chmod
 _chsize
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _control87
@@ -140,6 +141,7 @@ _cwait
 _daylight DATA
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _ecvt
 _endthread
@@ -162,6 +164,7 @@ _expand
 _fcloseall
 _fcvt
 _fdopen
+fdopen == _fdopen
 _fgetchar
 _fgetwchar
 _filbuf
@@ -384,6 +387,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -408,6 +412,7 @@ _statusfp
 _strcmpi
 _strdate
 _strdup
+strdup == _strdup
 _strerror
 _stricmp
 _stricoll
diff --git a/mingw-w64-crt/lib32/msvcr90.def b/mingw-w64-crt/lib32/msvcr90.def
index cca9dc8..f7e7f99 100644
--- a/mingw-w64-crt/lib32/msvcr90.def
+++ b/mingw-w64-crt/lib32/msvcr90.def
@@ -389,6 +389,7 @@ _chsize
 _chsize_s
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -434,6 +435,7 @@ _difftime64 DATA
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _ecvt
@@ -463,6 +465,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -955,6 +958,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1005,6 +1009,7 @@ _strcoll_l
 _strdate
 _strdate_s
 _strdup
+strdup == _strdup
 _strerror
 _strerror_s
 _strftime_l
diff --git a/mingw-w64-crt/lib32/msvcr90d.def b/mingw-w64-crt/lib32/msvcr90d.def
index 245ce2a..718cf1b 100644
--- a/mingw-w64-crt/lib32/msvcr90d.def
+++ b/mingw-w64-crt/lib32/msvcr90d.def
@@ -442,6 +442,7 @@ _chvalidator
 _chvalidator_l
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -490,6 +491,7 @@ _difftime64
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _dupenv_s_dbg
@@ -521,6 +523,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -1019,6 +1022,7 @@ _setjmp3
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1069,6 +1073,7 @@ _strcoll_l
 _strdate
 _strdate_s
 _strdup
+strdup == _strdup
 _strdup_dbg
 _strerror
 _strerror_s
diff --git a/mingw-w64-crt/lib64/msvcr100.def b/mingw-w64-crt/lib64/msvcr100.def
index f316807..0c788ad 100644
--- a/mingw-w64-crt/lib64/msvcr100.def
+++ b/mingw-w64-crt/lib64/msvcr100.def
@@ -722,6 +722,7 @@ _chsize
 _chsize_s
 _clearfp
 _close
+close == _close
 _commit
 _commode DATA
 _configthreadlocale
@@ -766,6 +767,7 @@ _difftime64 DATA
 _dosmaperr
 _dstbias DATA
 _dup
+dup == _dup
 _dup2
 _dupenv_s
 _ecvt
@@ -791,6 +793,7 @@ _fcloseall
 _fcvt
 _fcvt_s
 _fdopen
+fdopen == _fdopen
 _fflush_nolock
 _fgetchar
 _fgetwc_nolock
@@ -1269,6 +1272,7 @@ _setjmpex
 _setmaxstdio
 _setmbcp
 _setmode
+setmode == _setmode
 _setsystime
 _sleep
 _snprintf
@@ -1318,6 +1322,

Re: [Mingw-w64-public] _wstat issue

2013-04-17 Thread Antony Riakiotakis
Substituting _wstat with _wstati64, works too of course.
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] _wstat issue

2013-04-17 Thread Antony Riakiotakis
Hi, I have identified a pretty nasty bug in the MinGW64 headers.

The case that follows happens for _USE_32BIT_TIME_T undefined

_wstat is defined as _wstat64i32 in _mingw_stat64.h

This function expects a stat argument, and judging from the name the
argument should be of type _stat64i32 instead, stat is defined as_stat64 in
the relevant header (sys/stat.h). We have run into this issue in blender
and _wstat returns erratic sizes, making our thumbnail system, possibly
others too, misbehave.

Indeed substituting stat with _stat64i32 in the code seems to fix the issue
--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] pthread_create() vs pthread_join() race

2013-04-17 Thread LRN
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09.04.2013 19:36, LRN wrote:
> pthread_join () checks tv->ended to see if it needs to wait for
> the thread to terminate. However, sometimes tv->ended = 1 is set
> by __dyn_tls_pthread() before pthread_create_wrapper() is invoked
> (why, i know not), thus pthread_join() doesn't wait for the thread
> to terminate, and proceeds to push its memory back into the pool, 
> memsetting it in the process. When the thread finally runs 
> pthread_create_wrapper(), it is presented with an "args" pointer
> that points to a block of 0s.
> 
Here's something i hacked up to fix this.
It creates an extra event (which is bad; events aren't infinite; maybe
you can make do without an event, use some spinlock or whatnot), which
is set by __dyn_tls_pthread() when thread detaches, and waits for it
before proceeding with joining the thread.

This forces thread_join to only proceed after __dyn_tls_pthread(). The
reason why that breaks things is the fact that __dyn_tls_pthread()
sets ended = 1. If that function is run out of order, it might set
ended=1 on a piece of memory that is used by the next thread, and that
thread will be joined (and have its memory pushed) before it is finished.

Some thing to note:
Beside __dyn_tls_pthread(), pthread_create_wrapper() also sets ended =
1 - that might have contributed even more to the out-of-order execution.
Ktietz, i don't think it's a good practice to do the same thing in two
places.

Same thing applies to evStart - that event is closed everywhere, with
no synchronization, and that's very scary. I can't predict how this
code will behave in truly multi-threaded environment.
Also, things like this:
  if ((t->p_state & PTHREAD_CREATE_DETACHED) ==
PTHREAD_CREATE_DETACHED)
{
  t->valid = DEAD_THREAD;
  if (t->h != NULL)
CloseHandle (t->h);
  t->h = NULL;
  push_pthread_mem (t);
  t = NULL;
  TlsSetValue (_pthread_tls, t);
}
  pthread_mutex_destroy(&t->p_clock);
  t->spin_keys = new_spin_keys;

It's obvious that t might be NULL at the end of that piece of code,
but you don't seem to care.

winpthreads also almost never checks for errors after doing W32API
calls. While some calls are thought to be very reliable, that does not
excuse the lack of error handling, and some of the calls CAN fail
(wait functions, for example).

Also, this bug becomes obvious if you run the pthreads-w32 testsuite,
as create2 test always fails due to it. Integrating that testsuite
with winpthreads is not difficult. But you didn't do that, thus
failing to spot the bug. Then you didn't try to fix it after it was
reported.
This is not some utility library, this is pthreads! Libgcc is going to
be built against it, and you said that winpthreads is ready for that,
and even blessed moving it out of the experimental branch into the
trunk. Maybe it would be better to move it back again, and postpone
the threaded libgcc for a few months? Or years? Or how long will it
take to shape up winpthreads.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRbneaAAoJEOs4Jb6SI2CweIoIAL10wwBoEcRN4oGcAHq14ajb
n6SJk3LhupxotuumvTgGIXTCIcu80YlhVY1zH1awI53uufG+tw+31TeS+OtlWDGl
mEOSVrYv6Ozum7USCBy7AuZTOmf8V4N2dAGET7c8u6oipnTa8FbJN2K6ONDXXZM5
hP3DJgV6vYk+BshyO/s55FBNRDOIXSpa0FUh84kAx+7/1JIopdiV9sNt7zcbK6nO
D6bZ95WleWKmhgv3OIbVGX/ZnMwsHW3KKRaGaXRFAutD4+AiGyMqBRxHj4mo2Meb
Cn1e2MCD+pCZ5107eM/qlJcTycluGMdM7lmHwaQUwN+kqn6f9dWI3+ZGIM6y6qI=
=A8//
-END PGP SIGNATURE-
--- winpthreads-svn-r5794/src/thread.c.orig 2013-04-14 09:59:16 +0400
+++ winpthreads-svn-r5794/src/thread.c  2013-04-17 13:28:09 +0400
@@ -346,6 +346,8 @@
}
  pthread_mutex_destroy (&t->p_clock);
  t->spin_keys = new_spin_keys;
+  if (t->ended_event)
+SetEvent (t->ended_event);
  push_pthread_mem (t);
  t = NULL;
  TlsSetValue (_pthread_tls, t);
@@ -369,6 +371,8 @@
}
  pthread_mutex_destroy(&t->p_clock);
  t->spin_keys = new_spin_keys;
+  if (t->ended_event)
+SetEvent (t->ended_event);
}
   else if (t)
{
@@ -377,6 +381,8 @@
  t->evStart = NULL;
  pthread_mutex_destroy (&t->p_clock);
  t->spin_keys = new_spin_keys;
+  if (t->ended_event)
+SetEvent (t->ended_event);
}
 }
   return TRUE;
@@ -898,6 +904,7 @@
   t->sched.sched_priority = GetThreadPriority(t->h);
   t->ended = 0;
   t->thread_noposix = 1;
+  t->ended_event = CreateEvent (NULL, 1, 0, NULL);
 
   /* Save for later */
   if (!TlsSetValue(_pthread_tls, t))
@@ -1405,7 +1412,6 @@
 }
   else
 {
-  tv->ended = 1;
   pthread_mutex_unlock (&tv->p_clock);
   pthread_mutex_destroy (&tv->p_clock);
 

Re: [Mingw-w64-public] GStreamer Crash

2013-04-17 Thread Erik van Pienbroek
Erik van Pienbroek schreef op wo 17-04-2013 om 12:06 [+0200]:
> It might help for your case as well:
> https://bugzilla.gnome.org/show_bug.cgi?id=698118

One small addition: the patch in that bug report is based on glib git
master, for one which can be applied to glib 2.36.0 see
http://pkgs.fedoraproject.org/cgit/mingw-glib2.git/plain/glib-prefer-constructors-over-DllMain.patch

Regards,

Erik van Pienbroek
Fedora MinGW SIG




--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] GStreamer Crash

2013-04-17 Thread Erik van Pienbroek
Kyle Schwarz schreef op di 16-04-2013 om 21:47 [-0400]:
> I had very few issues compiling the dependencies for GStreamer. I did 
> have to edit the code of glib or GStreamer to change a multiple 
> definition of DllMain.
> 
> I am trying to compile the build statically.

I can't help you with the gstreamer crash in wine (it contains too
little information to say where the crash is exactly happening), but for
the multiple definition of DllMain I recently proposed a patch to glib
upstream which fixes that one. It might help for your case as well:
https://bugzilla.gnome.org/show_bug.cgi?id=698118

Regards,

Erik van Pienbroek
Fedora MinGW SIG




--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] porting applications from other platforms to Windows

2013-04-17 Thread Yaakov (Cygwin/X)
On 2013-04-16 11:09, LM wrote:
> Was curious if any other developers on this list were into porting
> applications from other platforms.  Would like to compare notes with
> other developers.  For instance, I built the X11 libraries and XWin
> server (natively not in Cygwin) and now that I'm checking some of the
> other libraries/applications that previously built fine, they seem to be
> colliding with some of the X11 header files.

There are indeed some conflicting types in the X11 and Win32 headers. 
In order to use both in the same file, you must use xproto-7.0.24 and 
#include  or  instead of  or 
, respectively.

HTH,


Yaakov
Cygwin Ports


--
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public