Bug 218645

Summary: databases/mysql-connector-odbc: Fails to run with MariaDB 10.1.22 (libmyodbc5w.so: Undefined symbol "strmov")
Product: Ports & Packages Reporter: OlivierW <olivierw1+bugzilla-freebsd>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: brnrd, mmokhi, olivierw1+bugzilla-freebsd
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: koobs: merge-quarterly?
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218599

Description OlivierW 2017-04-13 22:51:33 UTC
Hello,

For reference, I found out about this bug while trying a patch for asterisk13: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218599
It started as an asterisk13 crash, then I found out it was more an ODBC bug, with mysql-connector-odbc not compatible with MariaDB 10.1.22.

I'll paste here the important part:
To test, I just have to run: "odbcinst -s -q" to get my ODBC source ("MySQL-asterisk" in my case).
Then: "isql -v MySQL-asterisk".
With MariaDB 10.1.21, I'm getting a successful:
"+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>"

With MariaDB 10.1.22, I'm getting an error:
/usr/local/lib/libmyodbc5w.so: Undefined symbol "strmov"


For each of my tests, I've rebuilt and reinstalled unixODBC mariadb101-client mysql-connector-odbc mariadb101-server.




From what I've found, "strmov" has been removed from MariaDB 10.1.22 (and MySQL):
https://jira.mariadb.org/browse/MDEV-11752
https://github.com/MariaDB/server/commit/5d40ed864eb91314c894c713cd0d3d03c62ec8c5#diff-a32c08846626002914c1e36dd4ea0694

When I look at the source of mysql-connector-odbc 5.3.4 (the version in FreeBSD ports), there are a lot of calls to strmov().

In recents versions of mysql-connector-odbc, it seems to have been replaced by my_stpmov() : https://github.com/mysql/mysql-connector-odbc/blob/4f6159d8dde269d9f90ccb74d239f047ed5ad3a3/driver/catalog.c#L159

Is it possible to upgrade mysql-connector-odbc to a newer version?
Or should I provide a patch to replace strmov() by my_stpmov()?

Best Regards,
Olivier
Comment 1 OlivierW 2017-04-13 23:49:26 UTC
Well, it seems it isn't as easy as replacing strmov() calls by my_stpmov()… I tried it and:
# isql -v MySQL-asterisk
/usr/local/lib/libmyodbc5w.so: Undefined symbol "my_stpmov"

It may have worked for recent versions of MySQL, but not MariaDB :-(
Comment 2 OlivierW 2017-08-01 10:18:58 UTC
Hello,

For anyone who was blocked like me, I've been using successfully "mariadb-connector-odbc" from: https://github.com/Sp1l/ports/tree/master/databases/mariadb-connector-odbc together with my PR: https://github.com/Sp1l/ports/pull/1

It used to work with mariadb-connector-odbc 2.0.14, and now it's updated to 3.0.0, to be compatible with mariadb-connector-c 3.0.2.

Best Regards,
Olivier
Comment 3 Bernard Spil freebsd_committer freebsd_triage 2017-08-02 15:52:04 UTC
(In reply to OlivierW from comment #2)
Can you please test the version 3.0.1-beta from my Github repo?

The mysql-connector-odbc should add later versions of MariaDB to IGNORE_WITH_MYSQL and point the user to the MariaDB version (and vice-versa)
Comment 4 OlivierW 2017-08-02 18:05:25 UTC
(In reply to Bernard Spil from comment #3)
Hello,

Thanks!
I've tried to compile your new version, but there's an error I don't know how to solve:
=======================<phase: lib-depends    >============================
===>   mariadb-connector-odbc-3.0.1.b depends on shared library: libodbc.so - not found
===>   Installing existing package /packages/All/unixODBC-2.3.4.txz
[111amd64-HEAD-job-01] Installing unixODBC-2.3.4...
[111amd64-HEAD-job-01] Extracting unixODBC-2.3.4: .......... done
Message from unixODBC-2.3.4:
===>   NOTICE:

The unixODBC port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
===>   mariadb-connector-odbc-3.0.1.b depends on shared library: libodbc.so - found (/usr/local/lib/libodbc.so)
===>   Returning to build of mariadb-connector-odbc-3.0.1.b
===>   mariadb-connector-odbc-3.0.1.b depends on shared library: libmariadb.so - not found
===>   Installing existing package /packages/All/mariadb-connector-c-3.0.2.txz
[111amd64-HEAD-job-01] Installing mariadb-connector-c-3.0.2...
[111amd64-HEAD-job-01] `-- Installing libiconv-1.14_10...
[111amd64-HEAD-job-01] `-- Extracting libiconv-1.14_10: .......... done
[111amd64-HEAD-job-01] Extracting mariadb-connector-c-3.0.2: .......... done
ldconfig: warning: /usr/local/lib/mysql: No such file or directory
===>   mariadb-connector-odbc-3.0.1.b depends on shared library: libmariadb.so - not found
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mariadb-connector-odbc
====>> Cleaning up wrkdir
===>  Cleaning for mariadb-connector-odbc-3.0.1.b
build of databases/mariadb-connector-odbc | mariadb-connector-odbc-3.0.1.b ended at Wed Aug  2 19:53:11 CEST 2017
build time: 00:00:10
!!! build failure encountered !!!



I don't understand why poudriere can't find "libmariadb.so", the name looks correct (from the server where I have mariadb-connector-c 3.0.2 installed):
"# pkg info -l mariadb-connector-c | grep libmariadb.so
        /usr/local/lib/mariadb/libmariadb.so
        /usr/local/lib/mariadb/libmariadb.so.3"


And have you seen my patch from yesterday: https://github.com/O2Graphics/ports/commit/ad8edd02076bae230fe5e98f127b08d36548ef0c ? I think your version would have SSL missing.

Best Regards,
Olivier
Comment 5 OlivierW 2018-01-24 11:16:21 UTC
Hello,

I've updated databases/mariadb-connector-odbc to the last 3.0.2 stable version: https://github.com/Sp1l/ports/pull/1/commits/076444f2a71d2f269b0338319520b22e757a1985

This 3.0.2 version was released back in October 2017 but couldn't be compiled because it required mariadb-connector-c 3.0.3 which has only be released on January 2018.

Now all is well :-)

Best Regards,
Olivier
Comment 6 Bernard Spil freebsd_committer freebsd_triage 2018-01-24 16:11:02 UTC
Can you please check if this now works with a regular

> LIB_DEPENDS= libmariadb.so:databases/mariadb-connector-c
Comment 7 Bernard Spil freebsd_committer freebsd_triage 2018-05-11 09:18:46 UTC
(In reply to OlivierW from comment #5)
Thanks for confirming you've fixed this!