Skip to content

Two copies of zlib are linked when using local build of zlib  #5079

Description

@dbrnz

Reproduction steps

git clone https://github.com/libgit2/libgit2.git
cd libgit2
mkdir build
cd build
cmake   -DBUILD_CLAR=OFF -DUSE_HTTPS=OpenSSL -DUSE_SSH=OFF -DWINHTTP=OFF \
        -DOPENSSL_ROOT_DIR=/Users/dave/build/OpenCOR/src/plugins/thirdParty/OpenSSL/ext \
        -DOPENSSL_SSL_LIBRARY=/Users/dave/build/OpenCOR/src/plugins/thirdParty/OpenSSL/ext/lib/libssl.1.0.0.dylib \
        -DOPENSSL_CRYPTO_LIBRARY=/Users/dave/build/OpenCOR/src/plugins/thirdParty/OpenSSL/ext/lib/libcrypto.1.0.0.dylib \
        -DZLIB_INCLUDE_DIR=/Users/dave/build/OpenCOR/src/plugins/thirdParty/zlib/ext/include \
        -DZLIB_LIBRARY=/Users/dave/build/OpenCOR/src/plugins/thirdParty/zlib/ext/lib/libz.1.dylib \
        -G Ninja ..
ninja
$ otool -L libgit2.dylib

Expected behavior

libgit2.dylib:
	@rpath/libgit2.28.dylib (compatibility version 28.0.0, current version 0.28.0)
	@rpath/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

Actual behavior

libgit2.dylib:
	@rpath/libgit2.28.dylib (compatibility version 28.0.0, current version 0.28.0)
	@rpath/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)

Note the two references to libz.

Version of libgit2 (release number or SHA1)

master

Operating system(s) tested

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions