public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Ross Johnson <Ross.Johnson@homemail.com.au>
To: pthreads-win32@sourceware.org
Subject: Re: CONDITION_VARIABLE native_cond - threading issue on mysql-connector-c and pthreads-win32 with gcc (mingw)
Date: Mon, 17 Jun 2013 01:08:00 -0000	[thread overview]
Message-ID: <51BE616C.1070604@homemail.com.au> (raw)
In-Reply-To: <51BD9A91.10101@dl5rcw.de>

Hi Lars,

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.

Regards.

On 16/06/2013 8:59 PM, Lars wrote:
> Dear community,
>
> 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
> extra/yassl/CMakeFiles/yassl.dir/__/__/client/get_password.c.obj
> In file included from
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/include/my_sys.h:44:0,
> from
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/client/get_password.c:21:
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/include/my_pthread.h:59:3:
> error: unknown type name 'CONDITION_VARIABLE'
> CONDITION_VARIABLE native_cond;
> ^
> In file included from
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/include/my_sys.h:44:0,
> from
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/client/get_password.c:21:
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/include/my_pthread.h:682:5:
> error: unknown type name 'SRWLOCK'
> SRWLOCK srwlock; /* native reader writer lock */
> ^
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/client/get_password.c:
> In function 'yassl_mysql_get_tty_password_ext':
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/client/get_password.c:90:5:
> warning: implicit declaration of function 'iscntrl'
> [-Wimplicit-function-declaration]
> if (iscntrl(tmp) || pos == end)
> ^
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/client/get_password.c:95:3:
> warning: implicit declaration of function 'isspace'
> [-Wimplicit-function-declaration]
> while (pos != to && isspace(pos[-1]) == ' ')
> ^
> /share/mxe+mysql-connector/tmp-mysql-connector-c/mysql-connector-c-6.1.0-src/client/get_password.c:72:7:
> warning: unused variable 'i' [-Wunused-variable]
> int i=0;
> ^
> make[2]: ***
> [extra/yassl/CMakeFiles/yassl.dir/__/__/client/get_password.c.obj] Fehler 1
> make[1]: *** [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:
>
>      mkdir '$(1).build'
>      cd '$(1).build' && cmake  \
>          -DSTACK_DIRECTION=1 \
>          -DCMAKE_INSTALL_PREFIX=$(PREFIX)/$(TARGET) \
>          -DCMAKE_TARGET='$(TARGET)' \
>          -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)'  \
>          '$(1)'
>      $(MAKE) -C '$(1).build' -j '$(JOBS)' VERBOSE=1
>      $(MAKE) -C '$(1).build' -j 1 install VERBOSE=1
>
> Toolchain file is:
>     set(CMAKE_SYSTEM_NAME Windows)
>     set(MSYS 1)
>     set(BUILD_SHARED_LIBS OFF)
>     set(CMAKE_BUILD_TYPE Release)
>     set(CMAKE_FIND_ROOT_PATH
> /share/mxe+mysql-connector-c/usr/i686-pc-mingw32)
>     set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>     set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>     set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>     set(CMAKE_C_COMPILER
> /share/mxe+mysql-connector-c/usr/bin/i686-pc-mingw32-gcc)
>     set(CMAKE_CXX_COMPILER
> /share/mxe+mysql-connector-c/usr/bin/i686-pc-mingw32-g++)
>     set(CMAKE_Fortran_COMPILER
> /share/mxe+mysql-connector-c/usr/bin/i686-pc-mingw32-gfortran)
>     set(CMAKE_RC_COMPILER
> /share/mxe+mysql-connector-c/usr/bin/i686-pc-mingw32-windres)
>     set(PKG_CONFIG_EXECUTABLE
> /share/mxe+mysql-connector-c/usr/bin/i686-pc-mingw32-pkg-config)
>     set(QT_QMAKE_EXECUTABLE
> /share/mxe+mysql-connector-c/usr/i686-pc-mingw32/qt/bin/qmake)
>     set(CMAKE_INSTALL_PREFIX
> /share/mxe+mysql-connector-c/usr/i686-pc-mingw32 CACHE PATH
> "Installation Prefix")
>     set(CMAKE_BUILD_TYPE Release CACHE STRING
> "Debug|Release|RelWithDebInfo|MinSizeRel")
>
> 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.
>
> Best regards,
> Lars

      reply	other threads:[~2013-06-17  1:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16 10:59 Lars
2013-06-17  1:08 ` Ross Johnson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51BE616C.1070604@homemail.com.au \
    --to=ross.johnson@homemail.com.au \
    --cc=pthreads-win32@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).