You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issues with RSTUDIO_USE_SYSTEM_DEPENDENCIES #15996
Build with -DRSTUDIO_USE_SYSTEM_YAML_CPP=Yes, as I do for Fedora.
Describe the problem in detail
This happened before in #14629. This time, the code that detected the system library has been removed from src/cpp/CMakeLists.txt in #15796 for some reason, and I see now:
CMake Error at src/cpp/core/CMakeLists.txt:329 (target_link_libraries):
Target "rstudio-core" links to:
yaml-cpp::yaml-cpp
but the target was not found.
Describe the behavior you expected
It would be nice to restore this capability.
QA Notes
Once you have opened a PR, add additional information for QA on how to validate the change, paying special attention to the level of risk, adjacent areas that could be affected by the change, and any important contextual information not present in the original description.
What version of yaml-cpp is being used in the Fedora repositories? I wonder if it's using an older version that defines the yaml-cpp target but not yaml-cpp::yaml-cpp.
Version 0.8.0 in Fedora. Not a cmake expert, but isn't the find_package necessary? Anyway, I don't mind building with a few bundled libs now that I'm not tied to the official repos. Don't worry.
We are calling find_package(), but it looks like we're doing it wrong. I took a closer look, and I think this comes down to the fact that find_package() invocations don't put imported targets into the "global" scope by default -- we need to use find_package(GLOBAL) to make sure the discovered target is visible elsewhere as well.
Added in version 3.24: Specifying the GLOBAL keyword will promote all imported targets to a global scope in the importing project. Alternatively, this functionality can be enabled by setting the CMAKE_FIND_PACKAGE_TARGETS_GLOBAL variable.
I see that there have been some tweaks between the latest release (the one I'm building) and the current master branch for this file. Let me try to patch it with the latest changes and report back.
expected should be tl-expected. This is fixed in master.
rapidjson should be RapidJSON, otherwise it's not found.
I get this Target "rstudio-core" links to: [library] but the target was not found for:
tl::expected
gsl::gsl-lite-v1
fmt::fmt
yaml-cpp::yaml-cpp
Hunspell has no cmake config, so it cannot be found via find_package. Either a FindHUNSPELL.cmake file needs to be provided, or cmake's pkgconfig module should be used instead (pkg_check_modules?).
Also, if hunspell is found via pkg_check_modules, then I see the following error: No SOURCES given to target: rstudio-hunspell. So this target should not be compiled if hunspell is available as a system dependency.
Changing rapidjson with RapidJSON fixes system discovery, but breaks git fetching. Anyway, this library has added a lot of stuff without making a new release, so I cannot use the system version anyway, it's too old.
Using pkg_check_modules fixes system hunspell discovery, but then I keep getting undefined symbol errors, and didn't manage to fix them, so I fetch this one too. It's statically linked currently, and it would be nice to support dynamic linking with the system-provided shared library.
I confirm that adding GLOBAL to find_package makes the targets discoverable, so all the others work just fine.
Activity
Enchufa2 commentedon May 6, 2025
Ok, now that I'm not building in the official repos anymore, maybe it's better just to use the bundled version. Don't mind this.
kevinushey commentedon May 6, 2025
What version of yaml-cpp is being used in the Fedora repositories? I wonder if it's using an older version that defines the
yaml-cpptarget but notyaml-cpp::yaml-cpp.kevinushey commentedon May 6, 2025
As I understand it, the target definition should be coming from here:
https://github.com/jbeder/yaml-cpp/blob/2f86d13775d119edbb69af52e5f566fd65c6953b/CMakeLists.txt#L85
Of course, it's possible we're still doing something wrong.
Enchufa2 commentedon May 6, 2025
Version 0.8.0 in Fedora. Not a cmake expert, but isn't the
find_packagenecessary? Anyway, I don't mind building with a few bundled libs now that I'm not tied to the official repos. Don't worry.kevinushey commentedon May 7, 2025
We are calling
find_package(), but it looks like we're doing it wrong. I took a closer look, and I think this comes down to the fact thatfind_package()invocations don't put imported targets into the "global" scope by default -- we need to usefind_package(GLOBAL)to make sure the discovered target is visible elsewhere as well.https://cmake.org/cmake/help/latest/command/find_package.html has:
So we'll need to change the invocation here:
rstudio/src/cpp/ext/CMakeLists.txt
Line 185 in d568f6c
Kind of awkward that this only affects imported targets / libraries.
Enchufa2 commentedon May 7, 2025
Ah, didn't see that one. Yeap, it should be easy to fix, right? Reopening then to track this.
Enchufa2 commentedon May 7, 2025
I see that there have been some tweaks between the latest release (the one I'm building) and the current master branch for this file. Let me try to patch it with the latest changes and report back.
[-]Cannot build with system yaml-cpp anymore[/-][+]Issues with RSTUDIO_USE_SYSTEM_DEPENDENCIES[/+]Enchufa2 commentedon May 7, 2025
Ok, issues I've found:
expectedshould betl-expected. This is fixed in master.rapidjsonshould beRapidJSON, otherwise it's not found.Target "rstudio-core" links to: [library] but the target was not foundfor:tl::expectedgsl::gsl-lite-v1fmt::fmtyaml-cpp::yaml-cppfind_package. Either aFindHUNSPELL.cmakefile needs to be provided, or cmake's pkgconfig module should be used instead (pkg_check_modules?).Enchufa2 commentedon May 7, 2025
Also, if hunspell is found via
pkg_check_modules, then I see the following error:No SOURCES given to target: rstudio-hunspell. So this target should not be compiled if hunspell is available as a system dependency.Enchufa2 commentedon May 8, 2025
Summary:
rapidjsonwithRapidJSONfixes system discovery, but breaks git fetching. Anyway, this library has added a lot of stuff without making a new release, so I cannot use the system version anyway, it's too old.pkg_check_modulesfixes system hunspell discovery, but then I keep getting undefined symbol errors, and didn't manage to fix them, so I fetch this one too. It's statically linked currently, and it would be nice to support dynamic linking with the system-provided shared library.GLOBALtofind_packagemakes the targets discoverable, so all the others work just fine.