← Back to team overview

maria-developers team mailing list archive

mariadb-connector-c on mingw-w64 with pthreads

 

For the language bindings for the R programming language (RMySQL) I am
building mariadb-connector-c-2.3.2 on Windows using the mingw-w64
compiler. Our mingw-w64 compilers have been configured with pthreads
support  (same as msys2):

 - i686-493-posix-dwarf-rt_v3-s for win32
 - x86_64-493-posix-seh-rt_v3-s for win64

Building libmariadbclient succeeds, however when I try to link the
static library into the application I get these errors:

C:/Rtools/mingw_64/lib/gcc/x86_64-w64-mingw32/lib/libpthread.a(libwinpthread_la-cond.o):cond.c:(.text+0x300):
multiple definition of `pthread_cond_init'
libmariadbclient.a(my_pthread.c.obj):my_pthread.c:(.text+0x0): first
defined here

Same error for 'pthread_cond_destroy', 'pthread_cond_wait', and
'pthread_cond_timedwait'. From the source code of my_pthread.c it
seems that mariadb-connector-c is indeed redefining these functions on
_WIN32. I guess this assumes MSVC which does not have native pthreads?

Some questions:

 1. What would be the correct way to configure/build
mariadb-connector-c on mingw-w64 with native pthread support?
 2. Is there a cmake option to disable threading alltogether?

Thank you


Follow ups