cmake find_package incorrect path resolve

Bug #1790771 reported by Kokan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmongoc (Ubuntu)
New
Undecided
Unassigned

Bug Description

I experience this issue on Ubuntu 18.04

I wanted to use libmongoc-1.0 with cmake building a software. But the find_package is not successful due to a not existing path (probably wrong path is calculated)

Reproduction:
* install libmongoc-dev and cmake
* create the following dummy cmake project:
<pre>
project(foo C)

find_package(libmongoc-1.0 REQUIRED)
</pre>
* execute cmake .
* the result:

<pre>-- The C compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/libbson-1.0/libbson-1.0-config.cmake:28 (message):
  File or directory /usr/lib/include/libbson-1.0 referenced by variable
  BSON_INCLUDE_DIRS does not exist !
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/libbson-1.0/libbson-1.0-config.cmake:32 (set_and_check)
  /usr/lib/x86_64-linux-gnu/cmake/libmongoc-1.0/libmongoc-1.0-config.cmake:20 (find_package)
  CMakeLists.txt:3 (find_package)

CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present. A line of code such as

    cmake_minimum_required(VERSION 3.10)

  should be added at the top of the file. The version specified may be lower
  if you wish to support older CMake versions for this project. For more
  information run &quot;cmake --help-policy CMP0000&quot;.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also &quot;/tmp/libmongo/CMakeFiles/CMakeOutput.log&quot;</pre>

The libmongoc provided cmake file tries to create a PATH for BSON which it does like this:
<pre>get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)</pre>

But the result is clearly not good: /usr/lib/include/libbson-1.0 ( lib/include ?! )

Revision history for this message
Kokan (kokaipeter) wrote :

I am sorry I forget to tell that I use ubuntu 18.04,

description: updated
Kokan (kokaipeter)
no longer affects: syslog-ng (Ubuntu)
Revision history for this message
A. Jesse Jiryu Davis (jdsse) wrote :

This bug was fixed upstream in libmongoc 1.10.0. See the discussion here:

https://jira.mongodb.org/browse/CDRIVER-2818

When the Ubuntu package upgrades to 1.11 (currently in the queue) it will receive the fix.

Revision history for this message
Kokan (kokaipeter) wrote :

Thanks for the update.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.