This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CONDITION_VARIABLE native_cond - threading issue on mysql-connector-c and pthreads-win32 with gcc (mingw)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]