Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ: document additional tools required for C/C++ development #2374

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

traversaro
Copy link
Contributor

PR Checklist:

  • note any issues closed by this PR with closing keywords
  • if you are adding a new page under docs/ or community/, you have added it to the sidebar in the corresponding _sidebar.json file
  • put any other relevant information below

Whenever I suggest users to use conda-forge for C/C++ development, I almost always suggest them to install the packages:

compilers cmake pkg-config make ninja meson

while this list is quite an arbitrary choice (for example, most Windows users do not actually need make, and typically only one of cmake or meson is used) I found it useful to have a simple list of packages that users need to install, without having to think too much about it, so I thought it would be useful to have it in the main conda-forge docs.

I think this is particularly useful as sometimes the reason of why you need all this packages are really far from intuitive or obvious. Some examples:

  • compilers instead of cxx-compiler: A user wants to develop a C++ library with CMake, so intuitively it just installs cxx-compiler and cmake packages. If it does that, CMake may fail complaining that a C compiler is not found, as CMake always look for a C compiler unless LANGUAGES CXX is not explicitly passed to the project command invocation. And even if a user sets LANGUAGES CXX in its root CMakeLists.txt, C language support could still be used in a Find<pkg> script or in a dependency included (even transitively) via FetchContent, so it is difficult to anticipate when c-compiler is also require, and when not.
  • cmake pkg-config instead of cmake: many Find<pkg>.cmake scripts, either provided by CMake or in third party projects, rely on pkg-config being available for finding projects that install .pc files. Not having pkg-config may result in enigmatic find_package(...) failures, especially for not experienced users.

I sometimes wonder if it could make sense to a build-essential meta-package similar to the similar package available in Debian, but I guess that would be a longer discussion, as a first step just adding some details in the docs seemed the easiest thing to do.

I opened this PR just encountered users on Twitter confused by how to do C/C++ dev with conda-forge (see https://x.com/sitraversaro/status/1858085950078746697), and I realized it could be convenient to have this info in conda-forge docs.

@traversaro traversaro requested a review from a team as a code owner November 17, 2024 10:21
Copy link

netlify bot commented Nov 17, 2024

Deploy Preview for conda-forge-previews ready!

Name Link
🔨 Latest commit 758a88e
🔍 Latest deploy log https://app.netlify.com/sites/conda-forge-previews/deploys/6746db55f6b4670008844d7b
😎 Deploy Preview https://deploy-preview-2374--conda-forge-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@traversaro
Copy link
Contributor Author

pre-commit.ci autofix

Copy link
Member

@matthewfeickert matthewfeickert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the PR idea overall 👍. Just my views here.

docs/user/faq.md Outdated
Depending on the specific tools that you use for building C/C++ code, you may need some additional tools, for example:

```
compilers cmake pkg-config make ninja meson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
compilers cmake pkg-config make ninja meson
c-compiler cxx-compiler pkg-config cmake make ninja

While I appreciate that using compilers is a one-stop way to ensure both c-compiler and cxx-compiler get added, it feels a bit strange to also suggest that people just install fortran-compiler even if they may have no need for it. Similarly it seems strange to suggest installing meson as well.

My views here are all conditioned on a research field that is a bit more conservative about pulling in additional dependencies that are not strictly required, and that I like people to generally understand why they have most of (not going to say all) of the dependencies installed that they do. At the same time, I'm being slightly inconsistent by not complaining about ninja, but ninja is awesome and when it can get automatically used that's even better.

So my suggestion here is more along the lines of sticking to the

C/C++ code

part of your additions.

Alternatively/Additionally, I'd suggest mentioning what each of these dependencies brings / why you'd want to install them.

Copy link
Contributor Author

@traversaro traversaro Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on not installing a fortran compiler, applied your suggestions on 85dbd59 . As a personal opinion, I think that instead is fruitful to have meson here, as there are huge communities in C/C++ world that consistently use meson (gnome, mesa, c/c++ bits of numpy&scipy), but let's what is the consensus around this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to you and other reviewers here. I come from a field where in terms of build systems CMake is considered the "new" way of doing things and we're slowly clawing our way out of autotools + custom stuff. I only learned that meson even existed when SciPy started their transition to it as their build system.

@jaimergp jaimergp added the Docs label Nov 26, 2024
docs/user/faq.md Outdated Show resolved Hide resolved
Co-authored-by: Matthew Feickert <[email protected]>
@@ -94,6 +94,12 @@ x86_64-apple-darwin13.4.0-clang: No such file or directory

are a telltale sign that you are lacking compilers.

Depending on the specific tools that you use for building C/C++ code, you may need some additional tools, for example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Depending on the specific tools that you use for building C/C++ code, you may need some additional tools, for example:
The actual orchestration of the various compilation and linking steps is almost always done
by some build orchestrator (e.g. `CMake`, `meson`, ...), which will generally require a
build system (e.g. `ninja`, `make`), or possibly other supporting tools like `pkg-config`.
We package several tools that can be used for building C/C++ code; a selection that covers
the most common scenarios would be:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants