Bug #82852 WIN: Can't compile w/libmysqlclient 6.1.6: undefined reference to mysql_options4
Submitted: 3 Sep 2016 19:29 Modified: 4 Sep 2016 9:19
Reporter: Michiel Beijen Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / C Severity:S3 (Non-critical)
Version:6.1.6 OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[3 Sep 2016 19:29] Michiel Beijen
Description:
If I compile DBD::mysql on Windows against libmysqlclient 6.1.6, I get this error:

dbdimp.o: In function `mysql_dr_connect':
C:\Users\michi\DBD-mysql/dbdimp.c:1779: undefined reference to `mysql_options4'
collect2.exe: error: ld returned 1 exit status
dmake:  Error code 129, while making 'blib\arch\auto\DBD\mysql\mysql.xs.dll'

Please note I *CAN* compile using the 6.1.6 mysqlclient on Debian! It seems a Windows-only issue.
(using mysql-connector-c-6.1.6-linux-glibc2.5-x86_64)

How to repeat:
 - install StrawberryPerl
 - fetch DBD::mysql from git: https://github.com/perl5-dbi/DBD-mysql
 - extract the Connector/c zip file (mysql-connector-c-6.1.6-winx64.zip)
 - execute these commands in CMD.exe:

perl Makefile.PL --testuser=root --testpassword=secret --cflags="-IC:\work\mysql-connector-c-6.1.6-winx64\include" --libs="-LC:\work\mysql-connector-c-6.1.6-winx64\lib -lmysql"
dmake

(please note you need to get DBD::mysql from git, I'm a maintainer and try to get it to work with the newest C-connector, and there is a problem with a macro used in the CPAN version)
[3 Sep 2016 23:07] Miguel Solorzano
Thank you for the bug report.

<CUT>

"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"DBD::mysql\", 'DLBASE' => 'mysql', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ mysql.def -o blib\arch\auto\DBD\mysql\mysql.xs.dll -mdll -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" dbdimp.o
mysql.o   "C:\STRAWB~1\perl\lib\CORE\libperl524.a" "C:\STRAWB~1\c\lib\libmysql.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libkernel32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuser32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomdlg32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\liboleaut32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmpr.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-image-base
dbdimp.o: In function `mysql_dr_connect':
c:\DBD-mysql/dbdimp.c:1779: undefined reference to `mysql_options4'
collect2.exe: error: ld returned 1 exit status
dmake:  Error code 129, while making 'blib\arch\auto\DBD\mysql\mysql.xs.dll'
[4 Sep 2016 9:19] Michiel Beijen
Hi Miguel,

also note it seems similar to http://bugs.mysql.com/bug.php?id=69204 which should have been solved in 6.1.1; so it seems like it's a regression.

I wanted to compile from source with MinGW, to see if that would get around the issue, but that's not so easy, see my results in:

http://forums.mysql.com/read.php?117,650075,650075#msg-650075
[4 Sep 2016 9:19] Michiel Beijen
Hi Miguel,

also note it seems similar to http://bugs.mysql.com/bug.php?id=69204 which should have been solved in 6.1.1; so it seems like it's a regression.

I wanted to compile from source with MinGW, to see if that would get around the issue, but that's not so easy, see my results in:

http://forums.mysql.com/read.php?117,650075,650075#msg-650075