Download it now!
Bug 107579 - Native mysql connector extension fails to be loaded
Summary: Native mysql connector extension fails to be loaded
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version:
(earliest affected)
5.4.0.0.alpha0+
Hardware: All Mac OS X (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2017-05-03 09:02 UTC by Alex Thurgood
Modified: 2017-08-18 15:46 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Thurgood 2017-05-03 09:02:09 UTC
Description:
When attempting to load the list of tables from the Tables icon in the ODB main window from a mysql local instance database, the following error message is displayed :

SQL Status: 08001

Unable to load the libmysqlcppconn.dylib library.

Steps to Reproduce:
1. Open a ODB file configured to use the native mysql connector extension.
2. Attempt to list the tables in the database by clicking on the Tables icon of the main ODB window.
3. Enter id/password if required.


Actual Results:  
When attempting to load the list of tables from the Tables icon in the ODB main window from a mysql local instance database, the following error message is displayed :

SQL Status: 08001

Unable to load the libmysqlcppconn.dylib library.

Expected Results:
The list of tables should be displayed.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Alex Thurgood 2017-05-03 09:09:26 UTC
Note that so far, I have only been able to confirm this on OSX (10.12.4)


Version: 5.4.0.0.alpha0+
Build ID: 55833ef28adb67a34a61f545219f9ba9a7c1a4e5
CPU threads: 2; OS: Mac OS X 10.12.4; UI render: default; 
Locale: fr-FR (fr_FR.UTF-8); Calc: group

The extension was built at the same time as the main master build with the following :


export MARIADBCONFIG="/Volumes/BUILDHD/Shared/packages/mysql-connector-c-6.1.6-osx10.8-x86_64/bin/mysql_config"

--enable-ext-mariadb-connector
--with-system-mariadb
--enable-bundle-mariadb

The extension appears in the workdir tree under Extension/mysql-connector-ooo/root:

components.rdb
description-en-US.txt
description-fr.txt
description-qtz.txt
description.xml
images
libmysqlclient.dylib
libmysqlcppconn.dylib
META-INF
mysqlc.uno.dylib
registration
registry

and is packaged as 

mysql-connector-ooo.oxt

It is automatically included in the final build when I look at the list of registered extensions.
Comment 2 Alex Thurgood 2017-05-03 09:35:06 UTC
Tracing in lldb gives :

warn:legacy.osl:89876:1:mysqlc/source/mysqlc_driver.cxx:142: MysqlCDriver::impl_initCppConn_lck_throw: could not load the libmysqlcppconn.dylib library!
Comment 3 Alex Thurgood 2017-05-03 09:43:12 UTC
This warning appears to be thrown by this block:

    if ( !m_bAttemptedLoadCppConn )
  133     {
  134         const rtl::OUString sModuleName(CPPCONN_LIB);
  135         m_hCppConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
  136         m_bAttemptedLoadCppConn = true;
  137     }
  138 
  139     // attempted to load - was it successful?
  140     if ( !m_hCppConnModule )
  141     {
  142         OSL_FAIL( "MysqlCDriver::impl_initCppConn_lck_throw: could not load the " CPPCONN_LIB " library!");
  143         throw SQLException(
  144             "Unable to load the " CPPCONN_LIB " library.",
  145             *this,
  146             rtl::OUString( "08001"  ),  // "unable to connect"
  147             0,
  148             Any()
  149         );
  150     }


in mysqlc_driver.cxx
Comment 4 Julien Nabet 2017-05-03 09:46:07 UTC
Sorry Alex, with the arrival of MariaDB, I must recognize I don't know:
- if we want to migrate towards MariaDB or keep both (MariaDB and Mysql)
- how to configurate autogen.input
- if MariaDB is still compatible with Mysql or, since this one is a fork, it begins to differ too much
  So with MariaDB connector, can you access Mysql and MariaDB DB or only MariaDB DB?
- if the connector must still be named mysqlconnector whereas we use MariaDB

In brief, I'm quite lost and some explanation would be useful in LO Dev wiki.
Comment 5 Alex Thurgood 2017-05-03 09:55:42 UTC
Hi Julien, I have no idea either. MariaDB for OSX only appears to be installable via HomeBrew, which is why I still use MySQL Server from Oracle and MySQL C Connector source code from the Oracle MySQL download site.
Comment 6 Alex Thurgood 2017-05-03 10:01:12 UTC
My understanding of this block


void MysqlCDriver::impl_initCppConn_lck_throw()
  107 {
  108 #ifdef SYSTEM_MYSQL_CPPCONN
  109     cppDriver = get_driver_instance();
  110 #else
  111 #ifdef BUNDLE_MARIADB
  112     if ( !m_bAttemptedLoadCConn )
  113     {
  114         const rtl::OUString sModuleName(BUNDLE_MARIADB);
  115         m_hCConnModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
  116         m_bAttemptedLoadCConn = true;
  117     }
  118 
  119     // attempted to load - was it successful?
  120     if ( !m_hCConnModule )
  121     {
  122         OSL_FAIL( "MysqlCDriver::impl_initCppConn_lck_throw: could not load the " BUNDLE_MARIADB " library!");
  123         throw SQLException(
  124             "Unable to load the " BUNDLE_MARIADB " library.",
  125             *this,
  126             rtl::OUString( "08001"  ),  // "unable to connect"
  127             0,
  128             Any()
  129         );



is that it checks for the BUNDLE MARIADB directive from autogen.sh input and if it finds it, then loads the corresponding library. I don't know why it isn't doing this in current master builds.
Comment 7 Alex Thurgood 2017-05-03 10:09:28 UTC
Hoping that this isn't a resurgence of bug 60907.
Comment 8 Alex Thurgood 2017-05-05 07:07:16 UTC
Having built master on Linux Mint with the native connector extension at build time, I can confirm that this doesn't affect my Linux build, i.e. the libmysqlcppconn is loaded correctly.
Comment 9 Lionel Elie Mamane 2017-08-18 10:28:25 UTC
(In reply to Julien Nabet from comment #4)
> (...) I must recognize I don't know:
> - if we want to migrate towards MariaDB or keep both (MariaDB and Mysql)

We ship one connector (that is an SDBC driver) that can connect to both.

> - if MariaDB is still compatible with Mysql or, since this one is a fork, it
> begins to differ too much

Supposed to be compatible.

Technically the only change that happened is that we changed from MySQL's libmysqlclient C library (GPL licensed + exceptions, also called C connector) to MariaDB's fork of it (LGPL licensed). We still use on top of that MySQL's libmysqlcppconn (C++ Connector) which is GPL licensed. (The LibreOffice code uses only libmysqlcppconn but that one uses libmysqlclient underneath.)

There was a desire at some point to remove libmysqlcppconn from the stack, but the workforce to implement that never materialised.

> - if the connector must still be named mysqlconnector whereas we use MariaDB

<shrug>
Comment 10 Alex Thurgood 2017-08-18 15:44:14 UTC
No idea what has happened since I reported this, but currently this is now WFM in

Version: 6.0.0.0.alpha0+
Build ID: 75539963e621faafdc0d3ef6759cadb2e0a5d9b4
CPU threads: 4; OS: Mac OS X 10.12.6; UI render: default; 
Locale: fr-FR (fr_FR.UTF-8); Calc: group
Comment 11 Alex Thurgood 2017-08-18 15:46:07 UTC
FWIW, the main differences between my current build (of today) and the previous build:

- previous build was dbgutl enabled
- previous build was also built with lang=fr-FR