Don't link with non-existant utf8cpp library#345
Conversation
|
Thanks. I'll remove it & prepare a new release later today.
You've removed this comment since, and I guess it's because we don't require that version — we require a version that's compatible with it (I think; I'm really not a CMake guy). My guess is that @robUx4 has chosen that version as that was the one we hand bundled up until @robUx4 replaced it by CMake using the system version. Steve? |
I removed my question because I have seen a configure error saying |
|
As you can see, this patch is breaking the build. It is an integral part of 97f5a03. If the library is missing we are missing proper UTF-8 support. Before that patch the code was hardcoded, now we download it, in case it's found in the system we don't have to download it. IIRC the 3.2.0 version matches the version we had before. Maybe newer versions can be built as well. What is missing in #344 is that the CMake configuration should fail if your system don't have it as a library and it failed to be downloaded for some reason. |
|
I think there's a misconception/miscommunication here: Yes, we require the utf8cpp library. However, the utf8cpp library is a header-only library that doesn't produce a static ( |
Indeed, I missed that. However it fails to build without that line. Maybe replacing it with this would work: target_include_directories(ebml PRIVATE $<BUILD_INTERFACE:utf8cpp>) |
|
I still wonder why it worked in all the CI so far but not in #344. Because we should have a way to find this issue in the CI. |
|
The problem the tests fail over is finding the include files, though. On Ubuntu 26.04 the package in question is We try to include |
|
We do have a CI job that uses the Debian package. |
|
A job using the downloaded version: A job using the Debian package: |
|
Yeah, on Ubuntu 26.04: |
utf8cpp in Debian in patched to search cmake files in /usr/share/cmake/ |
|
Isn't it possible that the issue is more about the utf8cpp version than the OS? ≥ 4 fails, < 4 works? (guesswork, haven't had time to investigate further yet) |
I'm able to build 1.4.6 with utf8cpp 4.1.1 in Debian unstable and for these arches amd64, arm64, armhf, i386, powerpc, riscv64 |
|
Can you try your failing configuration with this line instead ? target_include_directories(ebml PRIVATE $<BUILD_INTERFACE:utf8cpp>) |
|
On Ubuntu 26.04 I can remove the version constraint & then a) cmake finds & uses the library and b) building with Meaning the only change I need on Ubuntu 26.04 is changing to I leave I don't seem to be able to specify something as the version requirement that says something like "at least 3.2.0, but any 4.x.y is OK, too". I've tried
I don't know what that is meant to explain. If a distribution packaged version of a library installs a cmake file, then it's up to the distribution package's manager (the person writing the In my view there are possibly a number of things that are happening here at various points:
The first point is something we need to investigate independently of a new release; it's an infrastructure question. The second point is something we must change; to what I'm not certain yet due to what I've written above. At the moment I tend to favor simply removing the version constraint. The third point is something I must still investigate. Can you tell me on which distribution (I assume Debian) & version it happens? |
|
We got this working on AerynOS using a system utf8cpp with the following patch in case it's helpful: |
The problem is that if there's a v5 that is incompatible with our code, the library may fail to build in the future. If we know that v4 works we could do something like: find_package(utf8cpp 3.2.0)
if(NOT utf8cpp_FOUND)
find_package(utf8cpp 4.0.0)
endif()That also prevents building with v1 or v2 that may not work. |
|
I've done some more testing & prepared an alternative PR in #346. Please give that one a try, too, and see its commit message for the rationale for my changes. |
`find_package` with version constraint `3.2.0` does not consider 4.x.y to be compatible. Therefore also look for 4.x.y in a secondary `find_package` call. The fallback for cloning from git if neither version is found via `cmake` remains in place. Furthermore, linking against a distro-packaged 4.x.y doesn't seem to work with the existing `target_link_libraries(ebml PRIVATE $<BUILD_INTERFACE:utf8cpp>)` & requires `PRIVATE utf8cpp::utf8cpp`. However, that doesn't work with a git-cloned copy nor with distro-packaged 3.2.x as those still requires `PRIVATE $<BUILD_INTERFACE:utf8cpp>`. Therefore make the argument depend on the package detection, too. fixes #344 ; see #345
`find_package` with version constraint `3.2.0` does not consider 4.x.y to be compatible. Therefore also look for 4.x.y in a secondary `find_package` call. The fallback for cloning from git if neither version is found via `cmake` remains in place. Furthermore, linking against a distro-packaged 4.x.y doesn't seem to work with the existing `target_link_libraries(ebml PRIVATE $<BUILD_INTERFACE:utf8cpp>)` & requires `PRIVATE utf8cpp::utf8cpp`. However, that doesn't work with a git-cloned copy nor with distro-packaged 3.2.x as those still requires `PRIVATE $<BUILD_INTERFACE:utf8cpp>`. Therefore make the argument depend on availability of the `utf8cpp::utf8cpp` target: it is available only for distro-packaged 4.x.y. For the other two cases (distro-packaged < 4.x.y & cloned from git) we stay with `$<BUILD_INTERFACE:utf8cpp>`. fixes #344 ; see #345
`find_package` with version constraint `3.2.0` does not consider 4.x.y to be compatible. Therefore also look for 4.x.y in a secondary `find_package` call. The fallback for cloning from git if neither version is found via `cmake` remains in place. Furthermore, linking against a distro-packaged 4.x.y doesn't seem to work with the existing `target_link_libraries(ebml PRIVATE $<BUILD_INTERFACE:utf8cpp>)` & requires `PRIVATE utf8cpp::utf8cpp`. However, that doesn't work with a git-cloned copy nor with distro-packaged 3.2.x as those still requires `PRIVATE $<BUILD_INTERFACE:utf8cpp>`. Therefore make the argument depend on availability of the `utf8cpp::utf8cpp` target: it is available only for distro-packaged 4.x.y. For the other two cases (distro-packaged < 4.x.y & cloned from git) we stay with `$<BUILD_INTERFACE:utf8cpp>`. fixes #344 ; see #345
|
fixed via #346 instead |
Fix issue #344