[CDRIVER-3565] Incomplete installation using yum on RHEL8 Created: 12/Mar/20  Updated: 27/Oct/23  Resolved: 30/Mar/20

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.16.2
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: SIDONG WEI Assignee: Roberto Sanchez
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL8.0 on s390x (IBM Z) architecture



 Description   

As I try to install mongo-c-drive through EPEL repo, it seems that libmongoc-1.0 is not correctly installed. I install the package using {yum install mongo-c-driver}, then I try to compile a test file, and get the error message:

{bash-4.4# gcc -o test test.c $(pkg-config --libs --cflags libmongoc-static-1.0) Package libmongoc-static-1.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libmongoc-static-1.0.pc' to the PKG_CONFIG_PATH environment variable Package 'libmongoc-static-1.0', required by 'virtual:world', not found test.c:1:10: fatal error: bson.h: No such file or directory #include <bson.h> ^~~~~~~~ compilation terminated.}

 

And if I install mongo-c-driver from the source file, the compilation and the test file work fine on the same environment with the same command.



 Comments   
Comment by SIDONG WEI [ 30/Mar/20 ]

Thank you Roberto, installing "mongo-c-driver-devel" instead of "mongo-c-driver" solves the problem.

Comment by Roberto Sanchez [ 30/Mar/20 ]

sidong.wei@uwaterloo.ca, I have investigated this issue and found that everything works as expected. In particular, there does not appear to be a libmongoc-static-1.0.pc pkg-config script that is shipped as part of the Fedora or EPEL packages of the C driver. In order to link with the EPEL-provided C driver packages, you will need to use libmongoc-1.0 instead.

I spawned a new RHEL 8 host in AWS and performed the following:

[ec2-user@ip-10-122-50-14 ~]$ sudo yum -y install mongo-c-driver-devel
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Extra Packages for Enterprise Linux 8 - x86_64                                                 18 kB/s |  20 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64                                                4.3 MB/s | 6.2 MB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs)                             11 MB/s |  15 MB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS from RHUI (RPMs)                                40 MB/s |  14 MB     00:00    
Last metadata expiration check: 0:00:02 ago on Mon Mar 30 22:49:46 2020.
Dependencies resolved.
==============================================================================================================================
 Package                                Arch                     Version                         Repository              Size
==============================================================================================================================
Installing:
 mongo-c-driver-devel                   x86_64                   1.16.2-2.el8                    epel                   831 k
Installing dependencies:
 libbson                                x86_64                   1.16.2-2.el8                    epel                    95 k
 libbson-devel                          x86_64                   1.16.2-2.el8                    epel                   297 k
 libmongocrypt                          x86_64                   1.0.3-1.el8                     epel                    75 k
 libmongocrypt-devel                    x86_64                   1.0.3-1.el8                     epel                   134 k
 libzstd                                x86_64                   1.4.4-1.el8                     epel                   266 k
 libzstd-devel                          x86_64                   1.4.4-1.el8                     epel                    43 k
 mongo-c-driver                         x86_64                   1.16.2-2.el8                    epel                    21 k
 mongo-c-driver-libs                    x86_64                   1.16.2-2.el8                    epel                   250 k
 
Transaction Summary
==============================================================================================================================
Install  9 Packages
 
Total download size: 2.0 M
Installed size: 4.5 M
Downloading Packages:
(1/9): libbson-1.16.2-2.el8.x86_64.rpm                                                        3.0 MB/s |  95 kB     00:00    
(2/9): libmongocrypt-1.0.3-1.el8.x86_64.rpm                                                   2.2 MB/s |  75 kB     00:00    
(3/9): libbson-devel-1.16.2-2.el8.x86_64.rpm                                                  7.6 MB/s | 297 kB     00:00    
(4/9): libzstd-1.4.4-1.el8.x86_64.rpm                                                          14 MB/s | 266 kB     00:00    
(5/9): libzstd-devel-1.4.4-1.el8.x86_64.rpm                                                   3.1 MB/s |  43 kB     00:00    
(6/9): mongo-c-driver-1.16.2-2.el8.x86_64.rpm                                                 4.3 MB/s |  21 kB     00:00    
(7/9): mongo-c-driver-libs-1.16.2-2.el8.x86_64.rpm                                             16 MB/s | 250 kB     00:00    
(8/9): libmongocrypt-devel-1.0.3-1.el8.x86_64.rpm                                             3.0 MB/s | 134 kB     00:00    
(9/9): mongo-c-driver-devel-1.16.2-2.el8.x86_64.rpm                                            23 MB/s | 831 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         4.9 MB/s | 2.0 MB     00:00     
warning: /var/cache/dnf/epel-fafd94c310c51e1e/packages/libbson-1.16.2-2.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
Extra Packages for Enterprise Linux 8 - x86_64                                                1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x2F86D6A1:
 Userid     : "Fedora EPEL (8) <epel@fedoraproject.org>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                      1/1 
  Installing       : libbson-1.16.2-2.el8.x86_64                                                                          1/9 
  Installing       : libmongocrypt-1.0.3-1.el8.x86_64                                                                     2/9 
  Installing       : libzstd-1.4.4-1.el8.x86_64                                                                           3/9 
  Installing       : mongo-c-driver-libs-1.16.2-2.el8.x86_64                                                              4/9 
  Installing       : libbson-devel-1.16.2-2.el8.x86_64                                                                    5/9 
  Installing       : libmongocrypt-devel-1.0.3-1.el8.x86_64                                                               6/9 
  Installing       : mongo-c-driver-1.16.2-2.el8.x86_64                                                                   7/9 
  Installing       : libzstd-devel-1.4.4-1.el8.x86_64                                                                     8/9 
  Installing       : mongo-c-driver-devel-1.16.2-2.el8.x86_64                                                             9/9 
  Running scriptlet: mongo-c-driver-devel-1.16.2-2.el8.x86_64                                                             9/9 
  Verifying        : libbson-1.16.2-2.el8.x86_64                                                                          1/9 
  Verifying        : libbson-devel-1.16.2-2.el8.x86_64                                                                    2/9 
  Verifying        : libmongocrypt-1.0.3-1.el8.x86_64                                                                     3/9 
  Verifying        : libmongocrypt-devel-1.0.3-1.el8.x86_64                                                               4/9 
  Verifying        : libzstd-1.4.4-1.el8.x86_64                                                                           5/9 
  Verifying        : libzstd-devel-1.4.4-1.el8.x86_64                                                                     6/9 
  Verifying        : mongo-c-driver-1.16.2-2.el8.x86_64                                                                   7/9 
  Verifying        : mongo-c-driver-devel-1.16.2-2.el8.x86_64                                                             8/9 
  Verifying        : mongo-c-driver-libs-1.16.2-2.el8.x86_64                                                              9/9 
Installed products updated.
 
Installed:
  mongo-c-driver-devel-1.16.2-2.el8.x86_64  libbson-1.16.2-2.el8.x86_64             libbson-devel-1.16.2-2.el8.x86_64       
  libmongocrypt-1.0.3-1.el8.x86_64          libmongocrypt-devel-1.0.3-1.el8.x86_64  libzstd-1.4.4-1.el8.x86_64              
  libzstd-devel-1.4.4-1.el8.x86_64          mongo-c-driver-1.16.2-2.el8.x86_64      mongo-c-driver-libs-1.16.2-2.el8.x86_64 
 
Complete!
[ec2-user@ip-10-122-50-14 ~]$ git clone https://github.com/mongodb/mongo-c-driver mongoc
Cloning into 'mongoc'...
remote: Enumerating objects: 92, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 130041 (delta 45), reused 44 (delta 25), pack-reused 129949
Receiving objects: 100% (130041/130041), 62.24 MiB | 30.91 MiB/s, done.
Resolving deltas: 100% (115497/115497), done.
[ec2-user@ip-10-122-50-14 ~]$ cd mongoc/
[ec2-user@ip-10-122-50-14 mongoc]$ gcc -o example-client ./src/libmongoc/examples/example-client.c $(pkg-config --libs --cflags libmongoc-1.0)
[ec2-user@ip-10-122-50-14 mongoc]$ ldd ./example-client 
	linux-vdso.so.1 (0x00007ffe797c6000)
	libmongoc-1.0.so.0 => /lib64/libmongoc-1.0.so.0 (0x00007f56119ff000)
	libbson-1.0.so.0 => /lib64/libbson-1.0.so.0 (0x00007f56117c3000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f56113ff000)
	libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007f56111e1000)
	libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f5610f4e000)
	libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f5610a76000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f561086d000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f5610656000)
	libsnappy.so.1 => /lib64/libsnappy.so.1 (0x00007f561044c000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f5610235000)
	libzstd.so.1 => /lib64/libzstd.so.1 (0x00007f560ff91000)
	libicuuc.so.60 => /lib64/libicuuc.so.60 (0x00007f560fbcf000)
	libmongocrypt.so.0 => /lib64/libmongocrypt.so.0 (0x00007f560f9ab000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f560f78b000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f560f409000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f5611ca7000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f560f205000)
	libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f560efdc000)
	libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f560ed8c000)
	libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f560ea9c000)
	libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f560e880000)
	libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f560e67c000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f560e2e7000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f560e0cf000)
	libicudata.so.60 => /lib64/libicudata.so.60 (0x00007f560c526000)
	libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f560c316000)
	libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f560c112000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f560bee8000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f560bc64000)
[ec2-user@ip-10-122-50-14 mongoc]$ ./example-client 
Cursor Failure: No suitable servers found (`serverSelectionTryOnce` set): [connection refused calling ismaster on '127.0.0.1:27017']

The example-client command obviously cannot find a server, but it does build and is able to run against the libraries installed from the EPEL packages.

I am closing this ticket with status "Works as Designed". If you can provide additional details and output of the particular failure you are encountering, including the source code for a minimal failing test program, then I can investigate furture.

Generated at Wed Feb 07 21:18:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.