[CONC-304] Rename the static library to libmariadb.a and other libmariadb files in a consistent manner Created: 2018-01-11  Updated: 2020-04-13  Resolved: 2020-04-05

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: 3.1.8

Type: Bug Priority: Major
Reporter: Otto Kekäläinen Assignee: Otto Kekäläinen
Resolution: Fixed Votes: 0
Labels: None

Attachments: File filelist-42bf04d0b3b.log    
Issue Links:
Blocks
blocks MDEV-14921 Fix mariadb/mysql client library pack... Closed
is blocked by MDEV-22053 Missing support for Debian Install La... Closed

 Description   

The old libmariadbclient18 package included libmariadbclient.so.18. The development package included dynamic libmariadbclient.so and static libmariadbclient.a.

In the new Connnector/C we have dynamic libmariadb.so and libmariadbclient.a. This name mismatch is really confusing for humans using this library, and it creates conflicts in packages as files overwrite each other in wrong places. Please rename the static library to libmariadb.a.

There has been a patch for this since 2014 (does not apply anymore): https://anonscm.debian.org/cgit/pkg-mysql/mariadb-connector-c.git/tree/debian/patches/rename_static_lib.patch?id=08de8a73c371d4fbbccb1bd8ffb739acf64867db

Thanks!

Related issue: MDEV-14921



 Comments   
Comment by Sergei Golubchik [ 2018-01-15 ]

otto, what do you mean by

it creates conflicts in packages as files overwrite each other in wrong places

could you please elaborate on that?

Comment by Otto Kekäläinen [ 2018-01-15 ]

The file libmariadbclient.a from libmariadb-dev is duplicate to the file from libmariadbclient18-dev. It creates conflicts for people using official Debian packages, where libmariadb2 and libmariadbclient18 are co-installable.

In our upstream mariadb.org packages we don't need to be polite or care about any Debian policy, but I think it would still be a good idea to have in the libmariadb-dev package libmariadb.so and libmariadb.a for clarity.

Comment by Sergei Golubchik [ 2018-01-15 ]

There should be no need to co-install libmariadbclient18-dev and libmariadb-dev. I don't know any valid use case for that.

I agree that it would be a good idea to have in the libmariadb-dev package libmariadb.so and libmariadb.a for clarity.
It should've been named this way from the beginning.

But it wasn't, so renaming the library is a compatibility issue. Basically, it'll break compilation of every single tool that links with libmariadbclient.a. The only way to prevent it would be to create a compatibility symlink libmariadb.a → libmariadbclient.a. We can do it, but then you'll have package conflicts just the same.

Comment by Otto Kekäläinen [ 2018-01-15 ]

I think we should fix the rename now, and have symlinks for backwards compatibility on repositories that had the old behavior. In Debian official repos the .so and .a has been renamed "correctly" all the time. In Debian official repos everything would go perfectly with this rename. In other repos we can have symlinks as the names were already conflicting, so the situation will not get any worse.

So please rename. Thank you.

Comment by Georg Richter [ 2018-01-15 ]

Otto,

how about to provide the name in installation layout?
mariadb_config (and also mysql_config) doesn't provide the name of the static library, so a lot of projects will break (despite that nobody uses mariadb_config on Windows)

Comment by Otto Kekäläinen [ 2018-01-15 ]

I also filed the related issue https://jira.mariadb.org/browse/MDEV-14953

For reference, current file list of libmariadb2 in Debian official is:

/usr/lib/x86_64-linux-gnu/libmariadb.so.2
/usr/lib/x86_64-linux-gnu/mariadb/plugin/dialog.so
/usr/lib/x86_64-linux-gnu/mariadb/plugin/mysql_clear_password.so

And for libmariadb-dev:

/usr/bin/mariadb_config
/usr/include/mariadb/config-win.h
/usr/include/mariadb/dbug.h
/usr/include/mariadb/errmsg.h
/usr/include/mariadb/getopt.h
/usr/include/mariadb/hash.h
/usr/include/mariadb/m_ctype.h
/usr/include/mariadb/m_string.h
/usr/include/mariadb/ma_common.h
/usr/include/mariadb/...
...
/usr/lib/x86_64-linux-gnu/libmariadb.a
/usr/lib/x86_64-linux-gnu/libmariadb.so

And for libmariadb-dev-compat:

/usr/bin/mysql_config
/usr/include/mysql
/usr/lib/x86_64-linux-gnu/libmysqlclient.a
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.a
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so

(those are all symlinks to libmariadb.so or .so.2 or .a or mariadb_config etc..

Comment by Otto Kekäläinen [ 2018-01-15 ]

georg You mean that the filenames could be a flip that is changed at build time? I can accept that if that is the only way you want to implement it.

I am happy with whatever solution as long as we can stop patching the sources for this feature separately.

Comment by Otto Kekäläinen [ 2018-01-22 ]

I just released MariaDB Connector C 3.0.3 to Debian unstable. Those patches has been implemented upstream and I was able to remove all patches in debian/patches.

I will continue to work on this in the github.com/mariadb/server repo 10.3 branch to get these changes reflected there as well.

Comment by Georg Richter [ 2018-01-22 ]

Otto,

The fixes are not yet in 10.2-server branch (also used by server 10.3 branch) - however it's on my todo for this week.

Comment by Otto Kekäläinen [ 2018-01-22 ]

My suggestion is to have this change only in 10.3 and onwards if possible. This change seems a bit too "big" for a stable release.

Comment by Otto Kekäläinen [ 2020-02-24 ]

Current status:

mariadb-10.4/debian$ cat libmariadb-dev.install
usr/bin/mysql_config
usr/include/mysql
usr/lib/*/libmariadb.so
usr/lib/*/libmysqlclient.so
usr/lib/*/libmariadbclient.so
usr/lib/*/libmariadbclient.a
usr/lib/*/libmysqlservices.a
usr/share/aclocal/mysql.m4
usr/share/pkgconfig/mariadb.pc

Maybe this could be fixed in 10.5 with

  • rename libmariadbclient.a to libmariadb.a (to be symmetric with libmariadb.so)
  • add compatiblity symlink libmariadbclient.a -> libmariadb.a
Comment by Otto Kekäläinen [ 2020-02-27 ]

I've drafted a fix in https://salsa.debian.org/mariadb-team/mariadb-10.4/-/compare/master...feature%2Flibmariadb-consistent-naming

Comment by Otto Kekäläinen [ 2020-03-14 ]

georg Any chance you could have a look at this next week? Or at least comment it?

Comment by Georg Richter [ 2020-03-15 ]

Otto,

Please correct me if I'm wrong, but the INSTALL_LAYOUT=DEB already sets the name of the static library:

$ cmake .. -DINSTALL_LAYOUT=DEB;make -j8;ls libmariadb
CMakeFiles  cmake_install.cmake  libmariadb.a  libmariadb.so  libmariadb.so.3  ma_client_plugin.c  Makefile  mariadbclient.def

Comment by Otto Kekäläinen [ 2020-03-15 ]

Ok, in that case the problem is that the INSTALL_LAYOUT=DEB has never been used in https://github.com/MariaDB/server/blob/10.5/debian/rules#L78-L90

If I've understood correctly, this INSTALL_LAYOUT applies only for the libmariadb and is defined in libmariadb/CMakeLists.txt and libmariadb/cmake/install.cmake.

The exact same variable is also in the server CMake system and the server seems to set at CONC_INSTALL_LAYOUT variable.

Can you georg please clarify how this is intended to work?

Also, related to the topic of making all libmariadb files consistently named, I have a proposal at https://salsa.debian.org/mariadb-team/mariadb-10.4/-/compare/master...feature%2Flibmariadb-consistent-naming but doing it on packaging level is wrong. I was hoping you would consider this at the libmariadb build level..

Comment by Otto Kekäläinen [ 2020-03-15 ]

I've attached a full file listing of what files the current 10.5 git head produces, and there is no libmariadb.a yet ($ grep libmariadb.a filelist-42bf04d0b3b.log)

Comment by Otto Kekäläinen [ 2020-03-26 ]

PR https://github.com/mariadb-corporation/mariadb-connector-c/pull/130 will fix this

Comment by Otto Kekäläinen [ 2020-04-05 ]

PR merged and issue fixed in https://github.com/mariadb-corporation/mariadb-connector-c/commit/28e1467475e5e4cc113e031291e8371d3a2a9c36

Generated at Thu Feb 08 03:04:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.