Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autotools: generated libssh2.pc file broken #1113

Open
haampie opened this issue Jul 9, 2023 · 1 comment
Open

autotools: generated libssh2.pc file broken #1113

haampie opened this issue Jul 9, 2023 · 1 comment

Comments

@haampie
Copy link
Contributor

haampie commented Jul 9, 2023

Describe the bug
When using the autotools build system with libssh 1.11, and OpenSSL 3

the generated pc file looks like this:

###########################################################################
# libssh2 installation details
###########################################################################

prefix=/home/harmen/spack/opt/spack/linux-ubuntu22.10-zen2/gcc-12.2.0/libssh2-1.11.0-zg3jzgpwy3ectyavqw6yrtfujchcyl6x
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libssh2
URL: https://www.libssh2.org/
Description: Library for SSH-based communication
Version: 1.11.0
Requires.private: libssl libcrypto zlib
Libs: -L${libdir} -lssh2  -lssl -lcrypto
Libs.private:  -lssl -lcrypto
Cflags: -I${includedir}

It includes -lssl and -lcrypto, which is wrong in two ways:

  1. The -L flag is missing if OpenSSL is in an non-default directory;
  2. The libraries shouldn't be there at all? Given that they're part of OpenSSL, not libssh2. [Fixed in Don't put @LIBS@ in pc file #1114]

Compare this to the CMake generated pc file:

###########################################################################
# libssh2 installation details
###########################################################################

prefix=/home/harmen/spack/opt/spack/linux-ubuntu22.10-zen2/gcc-12.2.0/libssh2-1.11.0-nfwxj7fefm65hmotelkban26t5bf3qcm
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libssh2
URL: https://www.libssh2.org/
Description: Library for SSH-based communication
Version: 1.11.0
Requires.private: libssl,libcrypto,zlib
Libs: -L${libdir} -lssh2 
Libs.private: 
Cflags: -I${includedir}

Expected behavior
I would expect the Autotools-generated pc file to be the same as the CMake one.

Additionally, it seems that the pc file contents depend on whether you install openssl with --libdir=lib64 vs --libdir=lib.

  • Using --libdir=lib64 (default in OpenSSL 3?) there are no -L flags added to the pc file when using autotools
  • Using --libdir=lib the are -L flags added to the pc file when using autotools.
@vszakats
Copy link
Member

vszakats commented Jul 21, 2023

Checked curl; there is an elaborate custom script there to detect OpenSSL: https://github.com/curl/curl/blob/3b3c41f9337779723d0236c74c3fba14776dc702/m4/curl-openssl.m4#L28
(most likely overkill for libssh2 as-is)

Also for libssh2 we only need -lcrypto, never -lssl. [some of this fixed in #1128]

@vszakats vszakats changed the title Generated pc (package config) file is broken with autotools Generated libssh2.pc file broken with autotools Apr 3, 2024
@vszakats vszakats changed the title Generated libssh2.pc file broken with autotools autotools: generated libssh2.pc file broken Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants