KPhotoAlbum on Windows?
Teemu
sikanauta at pumpuli.net
Sun Dec 15 17:32:12 GMT 2024
On 2024-12-09 00:57, Johannes Zarl-Zierl wrote:
> Speaking for KPhotoAlbum as the maintainer: the more effort you are
> willing to
> put into this, the more official we can make a Windows platform port:
> If you're willing to stick around and fix the occasional Windows
> platform
> specific bug (which I can't troubleshoot because I don't have a
> development
> environment for Windows), then we can enable support for Craft on
> Windows.
> But even if this is "just" a one-time contribution, we can at least
> enable the
> Craft Appimage CI job, which is Linux based.
>
> Cheers,
> Johannes
Ok,
getting some progress TRYING to build the codebase on Windows & Visual
Studio.
Some findings here, maybe relevant if someone wants to increase the
cross-platform compatibility sometime in the future.
Please note that these are compile/build time observations only, so
these solutions/workarounds have not been put into actual test - just
trying to assess, what it takes to get the build to finish :)
1) DB/FastDir.cpp
Include <dirent.h> not available on Windows.
Managed to compile this by adding a replacement include from here:
https://github.com/tronkko/dirent
2) DB/ImageScout.cpp
Include <unistd.h> not available on Windows.
Commented out the include, compiled without errors. Not used?
3) DB/OptimizedFileList.cpp
includes <unistd.h>,<dirent.h> again.
Commented out <uninstd.h>, used aforementioned dirent.h code.
4) HTMLGenerator/Generator.cpp
Include <sys/wait.h> not available on Windows.
Commented out, compiled fine, wasn't really used?
5) Utilities/FastJpeg.cpp
include <unistd.h> not available on Windows.
Changed this to <io.h>, compiles. Maybe <stdio.h> would work as well?
6) Viewer/ViewerWidget.cpp
Couldn't get the <QDBusConnection> and <QDBusMessage> working, it
wouldn't find includes.
But, after I checked what QDBus was used for in inhibitScreenSaver(), I
commented that code out and removed those includes.
I'm not sure if there is a DBus compatible implementation, and
"org.freedesktop.ScreenSaver" probably isn't listening on Windows in any
case...
7) lib/kpabase/FileUtil.cpp
<uninstd.h> not available.
Also linking Works a bit differently in Windows - maybe utilize Qt's
built-in linking function? Didn't investigate further, how these are
used in export.cpp
For now, commented out include and the hardlink/symlink functions
contents to get it to compile.
8) CMakeLists.txt
There was an issue with the linking process, as .lib files were not
created at all. Solved by adding "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
ON)" to CMakeLists.txt.
Not sure if this is the best way to handle this issue, but at least
Digikam uses this as well.
9) Kphotoalbum blueprint at
https://github.com/KDE/craft-blueprints-kde/tree/master/extragear/kphotoalbum
Needs some finetuning - need to remove kipi-plugins, adding the
mandatory dependencies from Qt-side and exiv2
10) lib/kpathumbnails/CMakelists.txt
Commented the testcase adding out, as the linking failed due to
unresolved external symbol. (See error below related to ThumbnailCache)
11) After all that trial and error, I'm at the last step, linking
executable bin\kphotoalbum.exe
With, this, I have these linking errors still, trying to solve but not
having much success:
ViewerWidget.cpp.obj : error LNK2019: unresolved external symbol
"public: static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B) referenced
in function "int `public: __cdecl
Viewer::ViewerWidget::ViewerWidget(enum
ViewerWidget::dtor$5::UsageType)'::`1'::dtor$5"
(?dtor$5@?0???0ViewerWidget at Viewer@@QEAA at W4UsageType@01@@Z at 4HA)
Window.cpp.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
ImageDB.cpp.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
ListSelect.cpp.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
DateBarWidget.cpp.obj : error LNK2001: unresolved external symbol
"public: static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
ThumbnailsPage.cpp.obj : error LNK2001: unresolved external symbol
"public: static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
ThumbnailWidget.cpp.obj : error LNK2001: unresolved external symbol
"public: static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
GridResizeSlider.cpp.obj : error LNK2001: unresolved external symbol
"public: static struct QMetaObject const
Settings::SettingsData::staticMetaObject"
(?staticMetaObject at SettingsData@Settings@@2UQMetaObject@@B)
VideoPlayerSelectorDialog.cpp.obj : error LNK2001: unresolved external
symbol "struct QMetaObject const Settings::staticMetaObject"
(?staticMetaObject at Settings@@3UQMetaObject@@B)
ViewerWidget.cpp.obj : error LNK2001: unresolved external symbol "struct
QMetaObject const Settings::staticMetaObject"
(?staticMetaObject at Settings@@3UQMetaObject@@B)
ThumbnailModel.cpp.obj : error LNK2001: unresolved external symbol
"public: static struct QMetaObject const
ImageManager::ThumbnailCache::staticMetaObject"
(?staticMetaObject at ThumbnailCache@ImageManager@@2UQMetaObject@@B)
Window.cpp.obj : error LNK2001: unresolved external symbol "public:
static struct QMetaObject const
ImageManager::ThumbnailCache::staticMetaObject"
(?staticMetaObject at ThumbnailCache@ImageManager@@2UQMetaObject@@B)
bin\kphotoalbum.exe : fatal error LNK1120: 3 unresolved externals
ninja: build stopped: subcommand failed.
I have narrowed down that SettingsData-related error.
It only appears when the connect-function is used to with those values
declared in Q_SIGNALS in SettingsData.h.
E.g. in GridResizeSlider.cpp, having these rows causes the error:
connect(settings, &Settings::SettingsData::actualThumbnailSizeChanged,
this, &GridResizeSlider::setValue);
connect(settings, &Settings::SettingsData::thumbnailSizeChanged, this,
&GridResizeSlider::setMaximum);
And if I comment those out, then the error disappears. I haven't found
any solution for this.
Any pointers?
As a summary - after looking at Digikam's CMakeLists.txt, I see that
there are a lot of directives related to Win/Linux differences.
As I have very little experience in development on Windows, I doubt that
I would be able to support an official release, even if I would get "my
copy" working. But an interesting exercise this has been, nonetheless.
Teemu
More information about the KPhotoAlbum
mailing list