This is the mail archive of the
mailing list for the pthreas-win32 project.
Re: CONDITION_VARIABLE native_cond - threading issue on mysql-connector-c and pthreads-win32 with gcc (mingw)
- From: Ross Johnson <Ross dot Johnson at homemail dot com dot au>
- To: pthreads-win32 at sourceware dot org
- Date: Mon, 17 Jun 2013 11:07:56 +1000
- Subject: Re: CONDITION_VARIABLE native_cond - threading issue on mysql-connector-c and pthreads-win32 with gcc (mingw)
- References: <51BD9A91 dot 10101 at dl5rcw dot de>
Use MinGW64 instead.
Pthreads-win32 does, of course, provide POSIX condition variables
(pthread_cond_t) and reader-writer locks (pthread_rwlock_t). The
implementation of these doesn't rely in any way on the Windows native
versions. Pthreads-win32 doesn't define or use the symbols
CONDITION_VARIABLE or SWRLOCK.
The mysql client code (my_pthread.h) assumes there is no POSIX support
if either _WIN32 or _WIN64 is defined, so MinGW needs to support native
CONDITION_VARIABLE and SWRLOCK. I have both MinGW32 and MinGW64 and only
MinGW64 appears to define CONDITION_VARIABLE and PSRWLOCK (didn't
actually see SRWLOCK when I grepped the header files there).
I've found that Ming64 causes me fewer problems and can produce both 64
and 32 bit builds.
On 16/06/2013 8:59 PM, Lars wrote:
I want to add libmysql to mxe (www.mxe.cc). MXE (M cross environment) is
a Makefile that compiles a cross compiler and cross compiles many free
libraries such as SDL and Qt. Thus, it provides a nice cross compiling
environment for various target platforms.
There is one issue that I would like to check with you could possibly be
a threading issue. Upon build, unknown type name 'CONDITION VARIABLE'
CONDITION VARIABLE native_cond; came up and broke it. native_cond seems
to belong to windows implementations. It was stated that pthrads-win32
should provide those. Unfortunately, SWRLOCK seems to be native Vista
and later versions and not provided by pthreads 2.9.1 (?).
Here is the commplete output:
[ 0%] Built target INFO_BIN
[ 0%] Built target INFO_SRC
[ 6%] Built target zlib
[ 6%] Building C object
In file included from
error: unknown type name 'CONDITION_VARIABLE'
In file included from
error: unknown type name 'SRWLOCK'
SRWLOCK srwlock; /* native reader writer lock */
In function 'yassl_mysql_get_tty_password_ext':
warning: implicit declaration of function 'iscntrl'
if (iscntrl(tmp) || pos == end)
warning: implicit declaration of function 'isspace'
while (pos != to && isspace(pos[-1]) == ' ')
warning: unused variable 'i' [-Wunused-variable]
[extra/yassl/CMakeFiles/yassl.dir/__/__/client/get_password.c.obj] Fehler 1
make: *** [extra/yassl/CMakeFiles/yassl.dir/all] Fehler 2
make: *** [all] Fehler 2
I wrote the mysql-connect-c.mk file to add the download and build into
mxe. For the build process based on cmake, I chose following definition:
cd '$(1).build' && cmake \
$(MAKE) -C '$(1).build' -j '$(JOBS)' VERBOSE=1
$(MAKE) -C '$(1).build' -j 1 install VERBOSE=1
Toolchain file is:
/share/mxe+mysql-connector-c/usr/i686-pc-mingw32 CACHE PATH
set(CMAKE_BUILD_TYPE Release CACHE STRING
As prerequirement, I had gcc, boost, openssl and pthreads added.
gcc version is 4.8.0
boost version is 1.53.0
pthreads version is 2.9.1
openssl version is 1.0.1e
If anyone would like to reproduce this, please feel free to contact me
and I can provide the index.html and mysql-connect-c.mk file for MXE.
Any help or hint is highly appreciated as I would like to quickly see
this contributed to MXE.