Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3599

Library path may not be added when zstd is detected

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: cmake
    • None

      As was observed with building libmongoc during a C++ driver release with roberto.sanchez, it appears that libzstd may be detected and linked to with -lzstd, without the full path to the library being added.

      I observed this on macOS with cmake 1.16.2 when installing via the C++ driver's script:

      cd mongo-cxx-driver
      ./.evergreen/install_c_driver master
      ...
      

      cmake runs with:

      /Applications/Cmake.app/Contents/bin/cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DENABLE_SHM_COUNTERS=OFF -DENABLE_BSON=ON -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -DENABLE_STATIC=ON -DENABLE_EXTRA_ALIGNMENT=OFF -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_PREFIX=/Users/kevinalbertson/code/mongo-cxx-driver/../mongoc/ -DENABLE_CLIENT_SIDE_ENCRYPTION=OFF .
      

      And is able to find zstd:

      ...
      -- Searching for compression library zstd
      -- Checking for module 'libzstd'
      --   Found libzstd, version 1.4.0
      --   Found zstd version 1.4.0 in /usr/local/include
      ...
      

      But linking fails:

      ld: library not found for -lzstd
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: