Skip to content

Issues with RSTUDIO_USE_SYSTEM_DEPENDENCIES #15996

Open

Description

@Enchufa2

System details

Does not apply, this is about the build process.

Steps to reproduce the problem

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.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    new
    on May 6, 2025
  2. Enchufa2 commented on May 6, 2025

    @Enchufa2
    ContributorAuthor

    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.

  3. kevinushey commented on May 6, 2025

    @kevinushey
    Collaborator

    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.

  4. kevinushey commented on May 6, 2025

    @kevinushey
    Collaborator

    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.

  5. Enchufa2 commented on May 6, 2025

    @Enchufa2
    ContributorAuthor

    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.

  6. kevinushey commented on May 7, 2025

    @kevinushey
    Collaborator

    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.

    https://cmake.org/cmake/help/latest/command/find_package.html has:

    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.

    So we'll need to change the invocation here:

    find_package("${_NAME}" "${${_PREFIX}_VERSION}" REQUIRED)

    Kind of awkward that this only affects imported targets / libraries.

  7. Enchufa2 commented on May 7, 2025

    @Enchufa2
    ContributorAuthor

    Ah, didn't see that one. Yeap, it should be easy to fix, right? Reopening then to track this.

  8. Enchufa2 commented on May 7, 2025

    @Enchufa2
    ContributorAuthor

    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.

  9. changed the title [-]Cannot build with system yaml-cpp anymore[/-] [+]Issues with RSTUDIO_USE_SYSTEM_DEPENDENCIES[/+] on May 7, 2025
  10. Enchufa2 commented on May 7, 2025

    @Enchufa2
    ContributorAuthor

    Ok, issues I've found:

    • 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?).
  11. Enchufa2 commented on May 7, 2025

    @Enchufa2
    ContributorAuthor

    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.

  12. Enchufa2 commented on May 8, 2025

    @Enchufa2
    ContributorAuthor

    Summary:

    • 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.
  13. added
    fedora
    and removed
    new
    on May 9, 2025
  14. added theissue type on May 12, 2025
  15. added this to the Backlog milestone on May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfedora

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions