From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2076 invoked by alias); 17 Jun 2013 01:08:05 -0000 Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org Received: (qmail 2066 invoked by uid 89); 17 Jun 2013 01:08:04 -0000 X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SPF_PASS,TW_MX autolearn=ham version=3.3.1 Received: from icp-osb-irony-out8.external.iinet.net.au (HELO icp-osb-irony-out8.external.iinet.net.au) (203.59.1.225) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 17 Jun 2013 01:08:01 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhAFANZgvlHKN5wE/2dsb2JhbABagwkxAb8SgQIWdIIjAQEFOBslEQsNCwkWBAsJAwIBAgE3AQ0TCAEBEId5tzGPIS2DYAOdYSODWocmgViBSQ Received: from unknown (HELO mail03.grapevine.net.au) ([202.55.156.4]) by icp-osb-irony-out8.iinet.net.au with ESMTP; 17 Jun 2013 09:07:56 +0800 Received: from [180.200.173.65] (helo=[192.168.2.2]) by mail03.grapevine.net.au with esmtp (Exim 4.77) (envelope-from ) id 1UoNvI-00053R-Fh for pthreads-win32@sourceware.org; Mon, 17 Jun 2013 11:07:56 +1000 Message-ID: <51BE616C.1070604@homemail.com.au> Date: Mon, 17 Jun 2013 01:08:00 -0000 From: Ross Johnson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: pthreads-win32@sourceware.org Subject: Re: CONDITION_VARIABLE native_cond - threading issue on mysql-connector-c and pthreads-win32 with gcc (mingw) References: <51BD9A91.10101@dl5rcw.de> In-Reply-To: <51BD9A91.10101@dl5rcw.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013/txt/msg00008.txt.bz2 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