From Ubuntu Launchpad:
CMake Error at src/libromdata/CMakeLists.txt:488 (ADD_LIBRARY):
Target "romdata" links to target "pugixml::pugixml" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
(cherry picked from commit 5481b385f5)
If the internal libfmt is used, it might not be a valid target.
This fixes a regression from commit 06f2f46655.
([cmake] CheckLibfmt.cmake: Remove FMT_SHARED from INTERFACE_COMPILE_DEFINITIONS.)
This causes parts of `class format_error` to be exported from
libromdata.so, which could result in multiple definitions:
V typeinfo for fmt::v11::format_error
V typeinfo name for fmt::v11::format_error
V vtable for fmt::v11::format_error
NOTE: Not needed for Win32.
- libfmt-6.2.0: Introduced the 'L' format specifier.
- Previously, 'n' was available.
- The 'L' specifier matches C++20 std::format().
- libfmt-7.0.x: Has fixes for the 'L' format specifier; removed 'n'.
- 'n' can be re-enabled with FMT_DEPRECATED_N_SPECIFIER.
- libfmt-7.1.0: Has more fixes for the 'L' format specifier.
- libfmt-8.0.0: Removes the 'n' format specifier entirely.
Since we use the 'L' specifier, we will set a minimum of libfmt-7.1.0.
Ubuntu 20.04 has libfmt-6.1.2; Ubuntu 22.04 has libfmt-8.1.1.
Also, Ubuntu 20.04's libfmt is a static library. It was changed
to a shared library sometime between 20.04 and 22.04.
rp-libfmt.h: Removed macros for compatibility with versions of libfmt
older than 7.1.0.
This significantly reduces the total size. fmt-11.dll's Release build
size is 128 KiB, and it cuts between 16-64 KiB from binaries that use it.
Total size of EXEs and DLLs, with amiiboc.exe and libgnuintl-8.dll,
but without test executables or PDBs:
[MSVC 2022 v17.6.5, Release build]
- Total size of EXEs and DLLs with header-only: 4,332,032
- Total size of EXEs and DLLs with fmt-11.dll: 4,161,536
- Difference: -170,496
With test executables:
- Total size of EXEs and DLLs with header-only: 9,716,224
- Total size of EXEs and DLLs with fmt-11.dll: 7,907,840
- Difference: -1,808,384
TODO: Add Delay-Load checks for fmt-11.dll to e.g. rpcli and the
Win32 UI frontend. (amiiboc and unit tests don't need it.)
Currently used as a header-only build. Will eventually be changed to
build a DLL for Windows and Mac OS X.
Other changes needed to get the Windows version to build with libfmt:
Add #include <fmt/xchar.h> to some files for full wchar_t support
in libfmt. Otherwise, errors like this appear:
src\amiibo-data\amiiboc.cpp(175,8): error C2665: 'fmt::v11::print': no overloaded function could convert all the argument types
extlib\libfmt\include\fmt\base.h(2925,17): message : could be 'void fmt::v11::print<TCHAR*&>(FILE *,fmt::v11::fstring<TCHAR *&>,TCHAR *&)'
src\amiibo-data\amiiboc.cpp(175,8): message : 'void fmt::v11::print<TCHAR*&>(FILE *,fmt::v11::fstring<TCHAR *&>,TCHAR *&)': cannot convert argument 2 from 'wmain::<lambda_1>::()::FMT_COMPILE_STRING' to 'fmt::v11::fstring<TCHAR *&>'
src\amiibo-data\amiiboc.cpp(175,22): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
extlib\libfmt\include\fmt\base.h(2908,17): message : or 'void fmt::v11::print<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR*&>(fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>,wmain::<lambda_1>::()::FMT_COMPILE_STRING &&,TCHAR *&)'
src\amiibo-data\amiiboc.cpp(175,8): message : 'void fmt::v11::print<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR*&>(fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>,wmain::<lambda_1>::()::FMT_COMPILE_STRING &&,TCHAR *&)': cannot convert argument 1 from 'FILE *' to 'fmt::v11::fstring<wmain::<lambda_1>::()::FMT_COMPILE_STRING,TCHAR *&>'
src\amiibo-data\amiiboc.cpp(175,14): message : No constructor could take the source type, or constructor overload resolution was ambiguous
src\amiibo-data\amiiboc.cpp(175,8): message : while trying to match the argument list '(FILE *, wmain::<lambda_1>::()::FMT_COMPILE_STRING, TCHAR *)' [build.vc17_64\src\amiibo-data\amiiboc.vcxproj]
Files modified for xchar.h:
- amiibo-data/amiiboc.cpp
- libromdata/stdafx.h (needed by WiiUPackage)
- libromdata/tests/RomHeaderTest.cpp
NOTE: Only included on Windows. xchar.h was added in libfmt-8.0.0,
which was first added (in Ubuntu LTS releases) in Ubuntu 20.04.
It's not needed on Linux, anyway.
New option USE_INTERNAL_FMT to force the use of the internal copy of
libfmt on Linux, for testing purposes. (...and also for Ubuntu 16.04)
- TODO: Maybe use it on 18.04, etc. for improved performance?
This will replace printf()-style functions in most cases, and will
replace all uses of rp_sprintf() and related.
NOTE: We need to use FMT_STRING() [which we're abbreviating FSTR] if
compiling without C++20 support; otherwise, string format checking won't
be done. We're not targetting C++20 at the moment.
Also, string format checking can't be done when using gettext. This also
applied to printf(), so it's not a big deal per se.
NOTE: Support for C++-style format strings (std::print) was added in
gettext-0.22, so gettext-0.22 will be required in order to update the
.pot and .po files.
FIXME: libfmt has its own "PACKED" definition, which conflicts with our
own. We should rename our "PACKED" to "RP_PACKED".
TODO: Add an internal copy of libfmt for Windows.
- Enable the "new" automoc policy for KDE4.
Otherwise, CMake complains because the old policy doesn't run
automoc on generated sources, e.g. from uic or rcc.
NOTE: Only on Qt4; CMake doesn't show this for Qt5/Qt6.
- Unset KDE4 variables that are marked "deprecatd" in KF5/KF6.
Otherwise, if building for both KDE4 and KF5, a lot of deprecated
variable warnings appear.
- Copy SERVICES_INSTALL_DIR to KDE4_SERVICES_INSTALL_DIR, since it's
used by the KDE4 UI frontend.
EXEC_PROGRAM() is deprecated as of CMake 3.0.
KDEInstallDirs.cmake isn't actually needed and prints warnings due to
some KDE-specific variables not being consistent.
Also remove the "-fpic -fPIC" CFLAGS/CXXFLAGS addition, since we're
handling this using the POSITION_INDEPENDENT_CODE property now.
Warnings from the KF5 version:
CMake Warning (dev) at cmake/libs/RP_FindQt5andKF5.cmake:65 (EXEC_PROGRAM):
Policy CMP0153 is not set: The exec_program command should not be called.
Run "cmake --help-policy CMP0153" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Use execute_process() instead.
Call Stack (most recent call first):
src/kde/kf5/CMakeLists.txt:6 (FIND_QT5_AND_KF5)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning at /usr/share/ECM/kde-modules/KDEInstallDirsCommon.cmake:385 (message):
KDE_INSTALL_BINDIR, KDE_INSTALL_LIBDIR and KDE_INSTALL_INCLUDEDIR should
either all be absolute paths or all be relative paths.
Call Stack (most recent call first):
/usr/share/ECM/kde-modules/KDEInstallDirs5.cmake:230 (include)
/usr/share/ECM/kde-modules/KDEInstallDirs.cmake:15 (include)
cmake/libs/RP_FindQt5andKF5.cmake:26 (INCLUDE)
src/kde/kf5/CMakeLists.txt:6 (FIND_QT5_AND_KF5)
KDE4's CMake files overwrite these variables with its own flags, which
breaks the debug build due to the use of GLIBCXX debug iterators:
[ 52%] Linking CXX shared module ../../../lib/rom-properties-kde4.so
CMakeFiles/rom-properties-kde4.dir/__/rp_create_thumbnail.cpp.o: In function `rp_create_thumbnail2':
src/kde/rp_create_thumbnail.cpp:194: undefined reference to `LibRpBase::RpPngWriter::write_tEXt(std::vector<std::pair<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
CMakeFiles/rom-properties-kde4.dir/__/RomDataView.cpp.o: In function `RomDataViewPrivate::updateMulti(unsigned int)':
src/kde/RomDataView.cpp:793: undefined reference to `LibRpBase::RomFields::getFromStringMulti(std::map<unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const*, unsigned int, unsigned int)'
CMakeFiles/rom-properties-kde4.dir/__/RomDataView.cpp.o: In function `RomDataViewPrivate::initAgeRatings(QLabel*, LibRpBase::RomFields::Field const&)':
src/kde/RomDataView.cpp:719: undefined reference to `LibRpBase::RomFields::ageRatingsDecode[abi:cxx11](std::array<unsigned short, 16u> const*, bool)'
CMakeFiles/rom-properties-kde4.dir/__/config/CacheCleaner.cpp.o: In function `CacheCleaner::run()':
src/kde/config/CacheCleaner.cpp:98: undefined reference to `LibRpFile::recursiveScan(char const*, std::forward_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char> > >&)'
collect2: error: ld returned 1 exit status
src/kde/kde4/CMakeFiles/rom-properties-kde4.dir/build.make:1357: recipe for target 'lib/rom-properties-kde4.so' failed
The debug build now uses std::debug:: variants of the containers, so we
need to preserve the GLIBCXX defines properly.
- Set QT_NO_CREATE_VERSIONLESS_TARGETS to disable Qt::Core. Otherwise,
CMake ends up trying to create Qt::Core twice, even when building for
KF6 only and not KF5+KF6:
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake:42 (message):
Some (but not all) targets in this export set were already defined.
Targets Defined: Qt::Core
Targets not yet defined: Qt::CorePrivate
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreConfig.cmake:68 (include)
/usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:174 (find_package)
cmake/libs/RP_FindQt6andKF6.cmake:34 (FIND_PACKAGE)
src/kde/kf6/CMakeLists.txt:6 (FIND_QT6_AND_KF6)
- Don't specify the minimum KF6 version, because that's breaking for
some reason.
-- Could NOT find KF65.248.0 (missing: KF65.248.0_DIR)
-- Could NOT find KF65.248.0: found neither KF65.248.0Config.cmake nor kf65.248.0-config.cmake
CMake Error at /usr/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find KF6 (missing: 5.248.0) (found version "6.6.0")
Call Stack (most recent call first):
/usr/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
/usr/share/ECM/find-modules/FindKF6.cmake:93 (find_package_handle_standard_args)
cmake/libs/RP_FindQt6andKF6.cmake:78 (FIND_PACKAGE)
src/kde/kf6/CMakeLists.txt:6 (FIND_QT6_AND_KF6)
(cherry picked from commit cb507652cb)
Conflicts:
debian/changelog
TODO: Setting up KCrash would be useful, but DrKonqi shows a button to
report bugs to bugs.kde.org, which doesn't help us.
FIXME: Fix up the KLocalizedString versions for KDE4. (Or remove KDE4...)
[cmake/libs] RP_FindQt?andKF?.cmake: Find KCrash.
Nemo uses a GObject interface for this, whereas Caja uses a file.
FIXME: Caja shows the same description for both the property page and the
menu extensions. Either figure out a way to disambiguate them, or combine
the two plugins into a single plugin with multiple interfaces.
NETTLE_FOUND may be used to determine if libnettle should be
linked to other libraries and/or executables.
This fixes a regression from commit 22189ea4db.
([cmake] CheckNettle2or3.cmake: Convert the macro to a function.)
Otherwise, encryption will be disabled, even if Nettle is available.
This fixes a regression from commit 22189ea4db.
([cmake] CheckNettle2or3.cmake: Convert the macro to a function.)
Besides the filename and path changes, these changes were needed:
- Tracker 3.3.0-alpha added a function tracker_file_get_content_identifier(),
which is used for the content identifier. I'm only calling this function
if we're using API version 3. (TODO: Only for 3.3.0 or later, maybe.)
- tracker_file_get_content_identifier() is part of libtracker-miners-common,
which is statically linked into every extractor. As such, we can't simply
dlsym() the function from libtracker_extract. (We *could* get it from one
of the existing extractors, since they're exporting all of the symbols,
but that's an implementation detail that could change later.)
- tracker-file-utils.c implements tracker_file_get_content_identifier().
This file requires libblkid and (optionally) BTRFS_IOC_INO_LOOKUP.
CMakeLists.txt now checks for those and links in libblkid.
- Add libblkid to other relevant files, plus FindBlkid.cmake.
- Rename the .rule files to 14- so they take precedence over tracker-3's
own 15-executable.rule and 15-games.rule.
On my system, which has Thunar GTK3 but not GTK2, this was causing
libunixcommon's default GTK2 plugin search to look at:
/usr//usr/lib/thunarx-2/rom-properties-xfce.so
The correct path on here is:
/usr/lib64/thunarx-2/rom-properties-xfce.so
For some reason, something in KF5 and/or KF6's CMake modules (or maybe
part of ECM?) is setting CMAKE_INSTALL_LIBDIR=/usr/lib, which results
in the full path being /usr//usr/lib. That's obviously wrong.
Preserve CMAKE_INSTALL_LIBDIR before and after to ensure that it isn't
messed up by the KF5/KF6 CMake modules.
TODO: Convert RP_FindQt?andKF?.cmake into functions?
gcc.cmake sets `-Werror=return-type`, which breaks FindIconv.cmake's
test code. Strangely, this is only causing problems when testing with
my Debian 8 PowerPC VM...
Performing C SOURCE FILE Test Iconv_IS_BUILT_IN failed with the following output:
Change Dir: build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/ninja" "cmTC_3ad47"
[1/2] Building C object CMakeFiles/cmTC_3ad47.dir/src.c.o
FAILED: /usr/bin/cc -Wall -Wextra -Wno-multichar -Werror=return-type
-Werror=format -fstrict-aliasing -Werror=strict-aliasing -fno-common
-fno-math-errno -Werror=implicit-function-declaration -fstack-protector-strong
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
-include build/src/config.libc.h -include src/compiler-compat.h
-DIconv_IS_BUILT_IN -o CMakeFiles/cmTC_3ad47.dir/src.c.o -c src.c
src.c: In function ‘main’:
src.c:11:7: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
Source file was:
. #include <stddef.h>
. #include <iconv.h>
int main() {
char *a, *b;
size_t i, j;
iconv_t ic;
ic = iconv_open("to", "from");
iconv(ic, &a, &i, &b, &j);
iconv_close(ic);
}
The path was changed to a common KIO directory in 5.85.
rom-properties-kf5.install: Add the ${SERVICES_INSTALL_DIR} entry, and
also remove the KIO install entry, since that was split out into the
rom-properties-kio-servicemenus package.
TODO: Don't install rom-properties-kio-servicemenus if KF5 is earlier
than 5.85, or install it anyway for forward compatibility?
[kf5] On Ubuntu 16.04, ${SERVICES_INSTALL_DIR} is incorrectly set to
the KDE4 directory. Not usre if it's because kdelibs5 for KDE4 is also
installed... As a workaround, if ${SERVICES_INSTALL_DIR} contains kde4,
change it to "share/kservices5".
This resulted in the KF6 libraries being installed in bin/ instead
of lib/. I'm not sure why, or what commit introduced this...
(Possibly a KF6 6.0 RC1 to RC2 change?)
Add a workaround by saving CMAKE_LIBRARY_OUTPUT_DIRECTORY before checking
for Qt6/KF6 and restoring it afterwards.
TODO: Change these macros to functions?
rp-config has been tested and appears to work correctly.
Not able to test other parts yet. I was able to install the KF6 packages,
but my installed copy of Dolphin is still using KF5.
RP_FindQt6andKF6.cmake: Set QT_DEFAULT_MAJOR_VERSION to 6.
Otherwise, Qt6QmlMacros.cmake throws an error: (Qt 6.6.1)
CMake Error at /usr/lib64/cmake/Qt6Qml/Qt6QmlMacros.cmake:2415 (message):
qt_generate_foreign_qml_types() is only available in Qt 6.
Call Stack (most recent call first):
/usr/lib64/cmake/Qt6Qml/Qt6QmlConfig.cmake:132 (include)
/usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
/usr/lib64/cmake/KF6Config/KF6ConfigConfig.cmake:53 (find_dependency)
/usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
/usr/lib64/cmake/KF6KIO/KF6KIOConfig.cmake:41 (find_dependency)
/usr/share/ECM/find-modules/FindKF6.cmake:52 (find_package)
cmake/libs/RP_FindQt6andKF6.cmake:69 (FIND_PACKAGE)
src/kde/kf6/CMakeLists.txt:12 (FIND_QT6_AND_KF6)
Added the same in the Qt4 and Qt5 versions for consistency.
RomPropertiesDialogPlugin, XAttrViewPropertiesDialogPlugin:
- KPropertiesDialogPlugin is now declared in kpropertiesdialogplugin.h.
ProxyForUrl.cpp:
- KProtocolManager::proxyForUrl() was removed in favor of QNetworkProxyFactory.
- FIXME: Not sure if this is correct, especially if the proxy uses https.
- TODO: Verify this!
Link to Qt6::Network for QNetworkProxyFactory.
This is now used for the KDE UI frontends, libunixcommon, and the
initial KDE test suite.
This will make it easier to support KDE test suites for all supported
versions of KDE.
FindIntl.cmake sets the singular Intl_LIBRARY variable,
not the plural Intl_LIBRARIES variable.
This didn't cause a problem on Linux, since glibc has libintl built in
and hence doesn't have a separate libintl, but it broke on FreeBSD,
which does *not* have libintl built in.
Windows wasn't affected because CheckGettext.cmake set Intl_LIBRARIES
for the included Windows DLLs. Oopsies.
The previous commit broke this.
Also, always use i386 executables regardless of target architecture.
Current Windows builds for non-x86 systems have i386 emulation.
Older non-x86 Windows builds, e.g. PowerPC and Alpha, will probably
not be supported anytime soon due to lack of other essential Windows
functionality.
Need to explicitly check for v4. Otherwise, the v3 check will fail,
and it'll just use defaults.
[cmake] FindLibNautilusExtension4.cmake: Add a v4 check file.
This sometimes causes -D-pthread to be added, resulting in build failures.
librpthreads depends on pthreads on Linux, so removing -pthread from
FindGTKx.cmake shouldn't cause any problems.
No `gdk` target since libgdk was merged into libgtk.
Added libgraphene-1.0, a dependency of libgtk-4.
Removed FindPango.cmake since it's no longer needed.
[gtk4] CMakeLists.txt: Use the new GTK4 targets and get rid of the
now-unnecessary FIND_PACKAGE() calls.