libksane, KSaneCore and QT_NO_KEYWORDS

Alexander Stippich a.stippich at gmx.net
Fri Sep 30 13:19:52 BST 2022


Hello Tobias,

I would like to add some explanations as it was me doing this :) 
Sorry for causing the extra work!

On Thursday, 29 September 2022 13:19:37 CEST Tobias Leupold wrote:
> Am Donnerstag, 29. September 2022, 12:09:10 CEST schrieb Christophe 
> Giboudeaux:
> > libksane is still needed by a couple applications:
> > https://lxr.kde.org/search?%21v=kf5-qt5&_filestring=&_string=KF5%3A%3ASane
> 
> Yeah, sure, Scandoc was one of those -- but the problem is that on can't build 
> the code anymore against newer versions of libksane. The code before the port 
> (last commit was ea5fe5b890147d0f70235ae9dcdeb022fe7df8a3) compiles without a 
> problem against libksane 22.04.3, but with version 22.08.1, I get:
> 
>     In file included from /home/tobias/tmp/git/scandoc/build/scandoc_autogen/
>     UVLADIE3JM/moc_ScannerSettingsWidget.cpp:10,
>                      from /home/tobias/tmp/git/scandoc/build/scandoc_autogen/
>     mocs_compilation.cpp:9:
>     /home/tobias/tmp/git/scandoc/build/scandoc_autogen/UVLADIE3JM/../../../
>     src/ScannerSettingsWidget.h:9:10: fatal error: KSaneCore: No such file or
>     directory
>         9 | #include <KSaneCore>
>           |          ^~~~~~~~~~~
> 
> because libksane doesn't include or at least install the respective header(s) 
> anymore ...
> 
> On my Gentoo machine with 22.04.3, the following headers are installed:
> 
>     /usr/include/KF5/KSane/ksane_export.h
>     /usr/include/KF5/KSane/KSaneWidget
>     /usr/include/KF5/KSane/KSaneCore
>     /usr/include/KF5/KSane/KSaneOption
>     /usr/include/KF5/KSane/ksanewidget.h
>     /usr/include/KF5/KSane/ksanecore.h
>     /usr/include/KF5/KSane/ksaneoption.h
>     /usr/include/KF5/ksane_version.h
> 
> On the Artix machine with 22.08.1 (and also if I upgrade the lib on Gentoo), 
> only 
> 
>     /usr/include/KF5/KSane/KSaneWidget
>     /usr/include/KF5/KSane/ksane_export.h
>     /usr/include/KF5/KSane/ksanewidget.h
>     /usr/include/KF5/ksane_version.h
> 
> remain. So ... nothing besides KSaneWidget ... and if some code uses 
> libksane's KSaneCore and KSaneOption headers, it can't be built against 
> 22.08.1 anymore ... also, one can't use the new KSaneCore lib as a drop-in 
> replacement, as the namespaces as well as some signal signatures have been 
> changed.
> 
> Don't get me wrong, It's of course the right thing to do to retire libksane in 
> favor of KSaneCore. But I would have expected to see some emphasized "Don't 
> use me anymore, port your stuff to KSaneCore, libksane will be discontinued 
> soon" warning for at least some time, before an upgrade leaves non-ported code 
> uncompilable ...

The API of libksane has been only the KSaneWidget for most of the time.
It was just internally split when I started working on Skanpage not too long ago.
libksane will not be retired in the future as it's still providing a scanning interface for various applications.
It is now just back to its original state before the split happened.
libksane will probably be renamed to KSaneWidget (or similar) to reflect that better in the future,
but this has to wait until the Qt6/KF6 transition.

Since the KSaneCore interface inside libksane was never publicly announced,
Kåre and I decided that it is okay to remove it from the libksane repo.
I wasn't really aware that any other application besides Skanpage and KSaneWidget actually used it directly.

> > > The KSaneCore API docs say that one should use
> > > "target_link_libraries(yourapp KF5::SaneCore)" in CMakeLists.txt to link
> > > against it. That actually didn't work, I had to use
> > > "target_link_libraries(scandoc ... KSane::Core)" to make it work. Am I
> > > missing something, or should either the documentation be changed and/or
> > > the
> > > "KF5::SaneCore" target be added/defined?
> > 
> > The change is intentional: https://invent.kde.org/libraries/ksanecore/-/
> > commit/40c3d3687aee
> > 
> > The metainfo.yaml also needs an update
> 
> Thanks for the clarification!
> 
Sorry about that. I forgot to change it when it was decided to change the namespace.

Best regards,
Alex





More information about the kde-devel mailing list