Skip to content

Conversation

kevinAlbs
Copy link
Collaborator

Summary

  • Document install of libmongoc-dev and libbson-dev packages.
  • Document install of mongo-c-driver-devel and libbson-devel packages.

Background & Motivation

The Install libmongoc with a Package Manager instructions show install of the libmongoc-1.0-0 package.

The libmongoc-1.0-0 package does not include headers:

# dpkg -L libmongoc-1.0-0
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so.0.0.0
/usr/share
/usr/share/doc
/usr/share/doc/libmongoc-1.0-0
/usr/share/doc/libmongoc-1.0-0/NEWS.gz
/usr/share/doc/libmongoc-1.0-0/README.rst
/usr/share/doc/libmongoc-1.0-0/THIRD_PARTY_NOTICES.gz
/usr/share/doc/libmongoc-1.0-0/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libmongoc-1.0-0
/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so.0
/usr/share/doc/libmongoc-1.0-0/changelog.Debian.gz

As a result, users attempting to build an application after installing libmongoc-1.0-0 may receive an error attempting to locate the cmake or pkg-config file. CDRIVER-3717 links to a Stack Overflow post referencing this issue: https://stackoverflow.com/questions/62289167/compiling-c-program-with-libmongoc-1-0/

The libmongoc-dev package includes headers:

# dpkg -L libmongoc-dev
/.
/usr
/usr/include
/usr/include/libmongoc-1.0
/usr/include/libmongoc-1.0/mongoc
/usr/include/libmongoc-1.0/mongoc/mongoc-apm.h
/usr/include/libmongoc-1.0/mongoc/mongoc-bulk-operation.h
/usr/include/libmongoc-1.0/mongoc/mongoc-change-stream.h
/usr/include/libmongoc-1.0/mongoc/mongoc-client-pool.h
/usr/include/libmongoc-1.0/mongoc/mongoc-client-session.h
/usr/include/libmongoc-1.0/mongoc/mongoc-client-side-encryption.h
/usr/include/libmongoc-1.0/mongoc/mongoc-client.h
/usr/include/libmongoc-1.0/mongoc/mongoc-collection.h
/usr/include/libmongoc-1.0/mongoc/mongoc-config.h
/usr/include/libmongoc-1.0/mongoc/mongoc-cursor.h
/usr/include/libmongoc-1.0/mongoc/mongoc-database.h
/usr/include/libmongoc-1.0/mongoc/mongoc-error.h
/usr/include/libmongoc-1.0/mongoc/mongoc-find-and-modify.h
/usr/include/libmongoc-1.0/mongoc/mongoc-flags.h
/usr/include/libmongoc-1.0/mongoc/mongoc-gridfs-bucket.h
/usr/include/libmongoc-1.0/mongoc/mongoc-gridfs-file-list.h
/usr/include/libmongoc-1.0/mongoc/mongoc-gridfs-file-page.h
/usr/include/libmongoc-1.0/mongoc/mongoc-gridfs-file.h
/usr/include/libmongoc-1.0/mongoc/mongoc-gridfs.h
/usr/include/libmongoc-1.0/mongoc/mongoc-handshake.h
/usr/include/libmongoc-1.0/mongoc/mongoc-host-list.h
/usr/include/libmongoc-1.0/mongoc/mongoc-index.h
/usr/include/libmongoc-1.0/mongoc/mongoc-init.h
/usr/include/libmongoc-1.0/mongoc/mongoc-iovec.h
/usr/include/libmongoc-1.0/mongoc/mongoc-log.h
/usr/include/libmongoc-1.0/mongoc/mongoc-macros.h
/usr/include/libmongoc-1.0/mongoc/mongoc-matcher.h
/usr/include/libmongoc-1.0/mongoc/mongoc-opcode.h
/usr/include/libmongoc-1.0/mongoc/mongoc-optional.h
/usr/include/libmongoc-1.0/mongoc/mongoc-prelude.h
/usr/include/libmongoc-1.0/mongoc/mongoc-rand.h
/usr/include/libmongoc-1.0/mongoc/mongoc-read-concern.h
/usr/include/libmongoc-1.0/mongoc/mongoc-read-prefs.h
/usr/include/libmongoc-1.0/mongoc/mongoc-server-api.h
/usr/include/libmongoc-1.0/mongoc/mongoc-server-description.h
/usr/include/libmongoc-1.0/mongoc/mongoc-socket.h
/usr/include/libmongoc-1.0/mongoc/mongoc-ssl.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-buffered.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-file.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-gridfs.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-socket.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-tls-libressl.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-tls-openssl.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream-tls.h
/usr/include/libmongoc-1.0/mongoc/mongoc-stream.h
/usr/include/libmongoc-1.0/mongoc/mongoc-topology-description.h
/usr/include/libmongoc-1.0/mongoc/mongoc-uri.h
/usr/include/libmongoc-1.0/mongoc/mongoc-version-functions.h
/usr/include/libmongoc-1.0/mongoc/mongoc-version.h
/usr/include/libmongoc-1.0/mongoc/mongoc-write-concern.h
/usr/include/libmongoc-1.0/mongoc/mongoc.h
/usr/include/libmongoc-1.0/mongoc.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/cmake
/usr/lib/x86_64-linux-gnu/cmake/libmongoc-1.0
/usr/lib/x86_64-linux-gnu/cmake/libmongoc-1.0/libmongoc-1.0-config-version.cmake
/usr/lib/x86_64-linux-gnu/cmake/libmongoc-1.0/libmongoc-1.0-config.cmake
/usr/lib/x86_64-linux-gnu/cmake/libmongoc-static-1.0
/usr/lib/x86_64-linux-gnu/cmake/libmongoc-static-1.0/libmongoc-static-1.0-config-version.cmake
/usr/lib/x86_64-linux-gnu/cmake/libmongoc-static-1.0/libmongoc-static-1.0-config.cmake
/usr/lib/x86_64-linux-gnu/cmake/mongoc-1.0
/usr/lib/x86_64-linux-gnu/cmake/mongoc-1.0/mongoc-1.0-config-version.cmake
/usr/lib/x86_64-linux-gnu/cmake/mongoc-1.0/mongoc-1.0-config.cmake
/usr/lib/x86_64-linux-gnu/cmake/mongoc-1.0/mongoc-targets-none.cmake
/usr/lib/x86_64-linux-gnu/cmake/mongoc-1.0/mongoc-targets.cmake
/usr/lib/x86_64-linux-gnu/libmongoc-static-1.0.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libmongoc-1.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libmongoc-ssl-1.0.pc
/usr/share
/usr/share/doc
/usr/share/doc/libmongoc-dev
/usr/share/doc/libmongoc-dev/copyright
/usr/lib/x86_64-linux-gnu/libmongoc-1.0.so
/usr/share/doc/libmongoc-dev/NEWS.gz
/usr/share/doc/libmongoc-dev/README.rst
/usr/share/doc/libmongoc-dev/changelog.Debian.gz

I expect the more common use case for a user reading the installation documentation is to develop an application.

kevinAlbs added 2 commits May 15, 2023 10:08
Use `-dev` packages in default instructions. Users reading instructions may be more likely to want to build applications with the C driver.

Link to Debian package pages to reference version.

fix format on debian instructions
Use `-devel` packages in default instructions. Users reading instructions may be more likely to want to build applications with the C driver.
@kevinAlbs kevinAlbs marked this pull request as ready for review May 15, 2023 14:19
@kevinAlbs kevinAlbs requested a review from rcsanchez97 May 15, 2023 14:19
$ dnf install mongo-c-driver
$ dnf install mongo-c-driver-devel
The ``mongo-c-driver-devel`` package includes headers required to build applications using libmongoc. To check which version is available, see `https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver-devel/ <https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver-devel/>`_. To only install the libraries without headers, install the ``mongo-c-driver`` package.
Copy link
Contributor

Choose a reason for hiding this comment

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

rST recognizes inline URIs and transforms them into hyperlinks automatically, so you can omit the explicit link markup.

Suggested change
The ``mongo-c-driver-devel`` package includes headers required to build applications using libmongoc. To check which version is available, see `https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver-devel/ <https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver-devel/>`_. To only install the libraries without headers, install the ``mongo-c-driver`` package.
The ``mongo-c-driver-devel`` package includes headers required to build applications using libmongoc. To check which version is available, see https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver-devel/. To only install the libraries without headers, install the ``mongo-c-driver`` package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the tip! Suggestion was applied on this link and others.

$ apt-get install libmongoc-1.0-0
$ apt-get install libmongoc-dev
The ``libmongoc-dev`` package includes headers required to build applications using libmongoc. To check which version is available, see https://packages.debian.org/stable/libmongoc-dev. To only install the libraries without headers, install the ``libmongoc-1.0-0`` package.
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend making one of two changes here. Either use the package tracking system (PTS) status page for the mongo-c-driver package (https://tracker.debian.org/pkg/mongo-c-driver) and direct the user to look in the "versions" box on the left to see the version corresponding to the version of Debian that they are running.

Or, even better, direct them to execute apt-cache policy libmongoc-dev instead. Pointing them to a web page will work if they are using Debian but might be confusing for Ubuntu (or other derivative) users who are not aware that each distro maintains its own status page. The apt-cache policy command will produce the correct distro-specific output (including accounting for things like PPAs and other alternative apt sources) in any place where you can reasonably expect apt-get install to work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the suggestion. I updated to suggest using apt-cache policy libmongoc-dev. Here is the sample output of apt-cache policy libmongoc-dev run on Ubuntu 22.04:

# apt-cache policy libmongoc-dev
libmongoc-dev:
  Installed: (none)
  Candidate: 1.21.0-1build1
  Version table:
     1.21.0-1build1 500
        500 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages


On recent Red Hat systems, such as CentOS and RHEL 7, a mongo-c-driver package is available in the `EPEL <https://fedoraproject.org/wiki/EPEL>`_ repository. To check which version is available, see `https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver/ <https://packages.fedoraproject.org/pkgs/mongo-c-driver/mongo-c-driver/>`_. The package can be installed with:
On recent Red Hat systems, such as CentOS and RHEL 7, a mongo-c-driver-devel package is available in the `EPEL <https://fedoraproject.org/wiki/EPEL>`_ repository. The package can be installed with:

Copy link
Contributor

Choose a reason for hiding this comment

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

I am OK with directing Fedora/RHEL users to the websites, since there is not as much a proliferation of derivatives as with Debian and Ubuntu.

$ apt-get install libbson-dev
The ``libbson-dev`` package includes headers required to build applications using libbson. To check which version is available, see https://packages.debian.org/stable/libbson-dev. To only install the libraries without headers, install the ``libbson-1.0-0`` package.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as with the comment above about libmongoc-dev.

@kevinAlbs kevinAlbs requested a review from rcsanchez97 May 16, 2023 16:45
Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

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

LGTM!

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

Successfully merging this pull request may close these issues.

3 participants