← Back to team overview

maria-developers team mailing list archive

Re: mariadb-connector-c on mingw-w64 with pthreads

 

Hi, Jeroen!

mingw is not the officially supported platform for connector-c, and we
don't build or test on it internally.

But if you provide us with a patch, we'll be happy to apply it.

>From what I remeber about mingw issues in earlier MySQL days, the fix
could be something like

- #ifdef _WIN32
+ #if defined(_WIN32) && !defined(__MINGW__)

in selected places.

On Mar 19, Jeroen Ooms wrote:
> 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?
> 
Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


References