Hello,
I have packaged libbson via the 
mongo-c-driver(https://github.com/mongodb/mongo-c-driver) but am having a 
curious issue with the pkg-config files generated as part of its CMake build 
system. It has two outputs, shared and static, but both pkg-config files 
include static glibc in their "Libs:" which are accessed via `pkg-config --libs 
...`. Thus, when attempting to use the package in compiling a dynamic 
executable, the static glibc is linked in, causing immediate segfaults upon 
execution.

I am wondering if anyone more familiar with cmake-build-system or CMake as a 
whole has any ideas about why the static glibc is ending up as the associated 
lib instead of the shared version. I am on commit `bb73faea` of Guix.

The guix package:
```
(use-modules
((guix licenses) #:prefix licenses:)
(guix build-system cmake)
(guix git-download)
(guix packages))
 
(define-public libbson
  (package
    (name "libbson")
    (version "1.27.2")
    (home-page "https://github.com/mongodb/mongo-c-driver";)
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "176qksl6zd8ffryics2pgaxji3fnqqmy4842dmyr1ycqxrx9jy4p"))))
    (build-system cmake-build-system)
    (arguments
     '(#:configure-flags
       `("-DENABLE_MONGOC=OFF"
         "-DENABLE_EXTRA_ALIGNMENT=OFF"
         "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF"
         ,(string-append "-DBUILD_VERSION=" "1.27.2"))))
    (synopsis #f)
    (description #f)
    (license licenses:asl2.0)))
```

The pkg-config file for the shared output of libbson:
```
# pkg-config .pc file generated by CMake 3.24.2 for libbson-1.27.2. DO NOT EDIT!
prefix=/gnu/store/2bryf1infbhskkab3czymhbyqhhng8ns-libbson-1.27.2
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
 
Name: libbson
Description: The libbson BSON serialization library
Version: 1.27.2
 
Libs: -L${libdir} -lbson-1.0 
-L/gnu/store/i2g0is6wjq3ccs6m1l6w9mhf44k4042h-glibc-2.35-static/lib -lrt
Cflags:  -I${prefix}/include/libbson-1.0
```

Thank you,
Michael

Reply via email to