Bug 467505

Summary: When launching the latest version of digiKam, the old internal MySql database cannot be started.
Product: [Applications] digikam Reporter: ustuerzlinger
Component: Database-MysqlAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: critical CC: caulier.gilles, fmontagut, hackintoshhd, metzpinguin, michael_miller
Priority: NOR    
Version First Reported In: 8.7.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed/Implemented In: 9.0.0
Sentry Crash Report:
Attachments: Screenshot of error message
digikam 7.10 error message after upgrade
mysql error log
digikam error log macos related to mariadb initialization
searching macOSBundlePrefix() on git indicate the potential issue

Description ustuerzlinger 2023-03-17 20:16:11 UTC
Created attachment 157370 [details]
Screenshot of error message

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Install digikam 7.10 over 7.9
2. launch the application
3. Receive error message "An error occurred during the internal server start"

OBSERVED RESULT
Unable to start application

EXPECTED RESULT
Start application with old database

SOFTWARE/OS VERSIONS 
macOS: Ventura 13.2.1


ADDITIONAL INFORMATION
MacBook Pro M1 Max
Comment 1 caulier.gilles 2023-03-17 20:34:29 UTC
Hi,

i already responded in the user mailing list about this problem few days ago. Look this thread:

https://mail.kde.org/pipermail/digikam-users/2023-March/034674.html

See also this bugzilla entry for the story: https://bugs.kde.org/show_bug.cgi?id=462736

Best

Gilles Caulier
Comment 2 Hackintosh HD 2023-03-17 20:43:14 UTC
Created attachment 157372 [details]
digikam 7.10 error message after upgrade
Comment 3 Hackintosh HD 2023-03-17 20:44:34 UTC
Same here on a MacBook Pro mid-2012 (MacBookPro9,1) with Ventura 13.2.1 after an upgrade of digikam 7.9/internal mysql to digikam 7.10, cf. attached screenshot.
Comment 4 Hackintosh HD 2023-03-17 20:49:43 UTC
Sorry for my screenshot and comment after Gilles explanation of the problem - as you may notice from our comments' timestamps, we commented pretty much simultaneously, so I didn't have any knowledge about the problem's cause at the time of writing.
Comment 5 Maik Qualmann 2023-03-21 12:37:53 UTC
Can you please post the MySQL error log from the database directory ".../.mysql.digikam/db_data/mysql.err"?

Maik
Comment 6 ustuerzlinger 2023-03-21 13:38:31 UTC
Created attachment 157494 [details]
mysql error log

As requested the error log
Comment 7 caulier.gilles 2024-09-18 09:17:31 UTC
@ustuerzlinger

As you use a M1 macbook pro like me, i recommend to try the Silicon PKG installer build for 8.5.0 pre-release. It's use MariaDB 10.1 provided by Macports :

https://ports.macports.org/port/mariadb-10.11/

Files can be download here :

https://files.kde.org/digikam/

Please try and reports...

Gilles Caulier
Comment 8 caulier.gilles 2024-09-18 09:19:31 UTC
A screenshot from my MacBook pro M1 running digiKam 8.5.0 arm64 with the internal mysql database (here mariadb):

https://i.imgur.com/A3CTp2Y.png

Gilles Caulier
Comment 9 Michael Miller 2024-09-18 10:37:15 UTC
Sorry, but the latest 8.5.0-arm package still doesn't work for me.  My environment is a Mac arm64 VM.  I removed previous SQLlite DBs and MariaDM files and dirs.  I removed ~/Library/Preferences/digikamrc.  This screenshot is the inital run of digiKam.

https://bugs.kde.org/attachment.cgi?id=173822

If you try to run mariadbd from the command line using the parameters shown in the error message, you'll see what I mean in https://bugs.kde.org/show_bug.cgi?id=491042 about MariaDB files missing.
Comment 10 caulier.gilles 2024-09-20 02:34:51 UTC
Michael,

I found a severe (and stupid) bug in the PKG installer that i just fixed : the previous install was not removed from the /Applications.

Re-installing the application will mix different versions with all possible side effects that you can imagine.

I will rebuild arm64 pkg asap.

Gilles
Comment 11 caulier.gilles 2025-03-15 15:32:23 UTC
Hi,

digiKam 8.6.0 is just released:

https://www.digikam.org/news/2025-03-15-8.6.0_release_announcement/

Problem still exists with this version?

Thanks in advance

Gilles Caulier
Comment 12 Felipe 2025-07-28 13:00:47 UTC
Created attachment 183597 [details]
digikam error log macos related to mariadb initialization
Comment 13 Felipe 2025-07-28 13:01:56 UTC
Created attachment 183598 [details]
searching macOSBundlePrefix() on git indicate the potential issue
Comment 14 Felipe 2025-07-28 13:09:24 UTC
The error persists in version 8.7.0.

I found the issue. During the initialization phase the mariadb command has an argument with a "//" that is incorrect. The correct argument should be: "--basedir=/Applications/digiKam.org/digikam.app/Contents/lib/mariadb/" and the current code generates two // between Contents and lib.

I am not developer but searched through the code, and the issue might be on databaseserver.cpp, look how the argument is generated on lines 522 and 568:  mysqldServCmdArgs << QDir::toNativeSeparators(QString::fromLatin1("--basedir=%1/lib/mariadb/"). Looking other codelines, the output of macOSBundlePrefix always finish with "/", and combining both you get the wrong "..Contents//lib/... path.

I added an attachment to see the error string, and a screenshot of the search I used to find the potential typo in the code
Comment 15 caulier.gilles 2025-07-28 14:47:35 UTC
Git commit 0fb86864cbb9390c8b3182d9150e5be3dcc77aa5 by Gilles Caulier.
Committed on 28/07/2025 at 14:46.
Pushed by cgilles into branch 'master'.

try to fix MacOS ath for Mysql server.

M  +4    -2    core/libs/database/server/databaseserver.cpp
M  +2    -0    core/libs/database/server/databaseserver.h

https://invent.kde.org/graphics/digikam/-/commit/0fb86864cbb9390c8b3182d9150e5be3dcc77aa5
Comment 16 caulier.gilles 2025-07-28 14:57:36 UTC
I will rebuild this evening the PKG installer for MacOS version 8.8.0. It will be available at this place late today (Paris time):

https://files.kde.org/digikam/

Best regards

Gilles Caulier
Comment 17 Felipe 2025-07-28 16:06:27 UTC
(In reply to caulier.gilles from comment #15)
> Git commit 0fb86864cbb9390c8b3182d9150e5be3dcc77aa5 by Gilles Caulier.
> Committed on 28/07/2025 at 14:46.
> Pushed by cgilles into branch 'master'.
> 
> try to fix MacOS ath for Mysql server.
> 
> M  +4    -2    core/libs/database/server/databaseserver.cpp
> M  +2    -0    core/libs/database/server/databaseserver.h
> 
> https://invent.kde.org/graphics/digikam/-/commit/
> 0fb86864cbb9390c8b3182d9150e5be3dcc77aa5

Thanks. almost :). The / that create problems is the "/" after the %1 and before lib. The code line should be :

mysqlInitCmdArgs << QDir::toNativeSeparators(QString::fromLatin1("--basedir=%1lib/mariadb/")
                                                     .arg(macOSBundlePrefix()));
Comment 18 caulier.gilles 2025-07-28 16:16:48 UTC
Git commit 6daaa7f4254541ac9d2be77b34d14078d108a244 by Gilles Caulier.
Committed on 28/07/2025 at 16:16.
Pushed by cgilles into branch 'master'.

second try to fix path under MacOS

M  +2    -2    core/libs/database/server/databaseserver.cpp

https://invent.kde.org/graphics/digikam/-/commit/6daaa7f4254541ac9d2be77b34d14078d108a244
Comment 19 caulier.gilles 2025-07-28 16:52:51 UTC
The new PKG 8.8.0 is now online here : https://files.kde.org/digikam/
Comment 20 Felipe 2025-07-29 13:02:07 UTC
(In reply to caulier.gilles from comment #19)
> The new PKG 8.8.0 is now online here : https://files.kde.org/digikam/

Thank you Gilles. That part is fixed. I tested and unfortunately there is another error. I spent some time digging, and the problem is at the mariadb_install_db script that comes from the mysql code when you build the app. I tried to use that script manually with multiple "--basedir" combinations, and I was not successful. probably a bug on qt.

I found this workaround, for other users:
* Install mariadb 10.11 by yourself. If you have homebrew, run at the terminal : brew install mariadb@10.11
* Install digikam, select mysql as database.
* Change the directories of the mysql binaries. Make sure the ones selected are /opt/homebrew/opt/mariadb@10.11/bin/...
* will run error. select cancel and Close digikam
* go to terminal and run : /opt/homebrew/opt/mariadb@10.11/bin/mariadb-install-db --defaults-file=/Applications/digiKam.org/digikam.app/Contents/Resources/digikam/database/mysql-global.conf --basedir=/opt/homebrew/opt/mariadb@10.11/ --datadir=/users/your-user/desired-db-directory.mysql.digikam/db_data
replace above your-user for your user directory and -desired-dv-directory for the directory where you want the database.
* open digikam again. You got digikam running with mysql database.
Comment 21 caulier.gilles 2025-12-29 09:01:33 UTC
Felipe,

The next 9.0.0 release is fully rebuild from scratch using Macports. MariaDb is up-to-date. Can you reproduce the dysfunction using the 9.0.0 pre-release PKG installer ?

https://files.kde.org/digikam/

Gilles Caulier
Comment 22 Felipe 2025-12-31 10:46:21 UTC
(In reply to caulier.gilles from comment #21)
> Felipe,
> 
> The next 9.0.0 release is fully rebuild from scratch using Macports. MariaDb
> is up-to-date. Can you reproduce the dysfunction using the 9.0.0 pre-release
> PKG installer ?
> 
> https://files.kde.org/digikam/
> 
> Gilles Caulier

Hi Gilles,

Thanks, I tested it. Good news and bad news:
* the installation, app bundle and macports works well. The default database configuration for mysql internal works. Out of the box, the default paths to the mysql binaries are routed correctly to the mariadb version that is included in the digikam bundle. Which leads to my bad news,
* the mariadb version that is in the app bundle you sent me is 10.11.13. I checked in mariadb and 10.11.13 is from May 2025. latest version should be 10.11.15 (https://mariadb.com/docs/release-notes/community-server/10.11/10.11.15) . You mentioned that is the up to date, perhaps is a very small fix, you just need to check the configuration that picks 10.11.15 when you create the bundle.
Comment 23 caulier.gilles 2025-12-31 15:10:35 UTC
Hi felipe,

In fact i forced Macports to install a specific version of MariaDB. As you can see here :

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/macports/01-build-macports.sh?ref_type=heads#L351

The Qt Sql plugin used to be connected to a database can be customized to a version of MariaDB, but :

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/macports/config.sh?ref_type=heads#L114

It's the last MariaDB 10.11.13 is the last available in Macports:

https://ports.macports.org/port/mariadb-10.11/

For me I think the 10.11.13 will be retro compatible with the 10.11.15.

Maik, do you confirm this ?

Also, by experience, using the last version is always problematic to compile and at run time with the remote server (especially if this one is older and the plugin version)

Best regards

Gilles Caulier
Comment 24 Maik Qualmann 2025-12-31 15:43:38 UTC
The MariaDB 10.11.xx branch will be supported until February 2028. Version 10.11.13 (stable) is from May 2025, and version 10.11.15 (stable) is from November 2025 and includes bug fixes. We cannot use it until it is available in Macports.

Here on Linux, I am already using the 11.8.xx branch with new features. Furthermore, there is already a 12.3.xx branch of MariaDB.

Maik
Comment 25 caulier.gilles 2025-12-31 16:22:22 UTC
Filipe,

As the original problem is fixed, i close this file now. For a future MariaDB support under macOS, it will be better to open a new file in Bugzilla.

Note : I rebuild macOS bundle from scratch all 6 months We will see later next year.

Happy new year 2026.

Best regards

Gilles Caulier