Skip to content

Inclusion of libssh2 via pkg-config causes harmless build warning #11538

Closed

Description

@TurtleWilly

I did this

When building --with-libssh2 a minor warning is triggered during the configure process where the "-L" specification erroneously gets added to LIBS. Also "-lssh2" appears twice (some other libraries like ssl+crypto, zstd, z, and brotlidec also appear multiple times for some reason, but that doesn't trigger warnings at least.)

$ ./configure \
	--prefix=/usr/local/mystuff/curl/8.2.1 \
	--with-openssl \
	--with-libssh2 \
	--with-brotli \
	…

->

…
configure: using LIBS: -lcares -lnghttp2 -lidn2 -lrtmp -lz -lssl -lcrypto -lssh2 -L/usr/local/mystuff/libssh2/latest/lib -lssh2 -lssl -lcrypto -lssl -lcrypto -lzstd -lzstd -lbrotlidec -lbrotlidec -lz -lpsl -lgsasl
configure: LIBS note: LIBS should only be used to specify libraries (-lname).
configure: WARNING: Continuing even with errors mentioned immediately above this line.
…

The specifications only can get generated via the pkg-config system (I only hotlink the .pc files in /usr/local/lib/pkgconfig, and nothing else directly in the standard paths). So I'm guessing the configure script itself causes the problem. Maybe it is not using the correct --libs-only-l?

$ pkg-config --libs libssh2
-L/usr/local/mystuff/libssh2/latest/lib -lssh2

$ pkg-config --libs-only-l libssh2
-lssh2

$ pkg-config --libs-only-L libssh2
-L/usr/local/mystuff/libssh2/latest/lib

This pretty matches what other libs, like nghttp2, etc., are providing there too. And those don't trigger this faux pas.

I expected the following

…
configure: using LIBS: -lcares -lnghttp2 -lidn2 -lrtmp -lssl -lcrypto -lssh2 -lzstd -lbrotlidec -lz -lpsl -lgsasl
…

curl/libcurl version

curl 8.2.1

operating system

Mac OS X 10.10.5 (Yosemite)

Activity

  1. bagder commented on Jul 28, 2023

    @bagder
    Member

    I'm guessing the configure script itself causes the problem. Maybe it is not using the correct --libs-only-l?

    Scarily accurate guess 😨 !

    curl/configure.ac

    Line 2245 in 40c6329

    LIB_SSH2=`$PKGCONFIG --libs libssh2`

    Do you want to make the PR?

  2. TurtleWilly commented on Jul 28, 2023

    @TurtleWilly
    Author

    @bagder I think it will go much quicker for you to do it. Basically I'm just a user here and I'm not familiar with the git and github stuff at all (I still use Subversion for my own stuff), and before I would figure this out curl probably would have reached version 9 already. 😃

  3. added a commit that references this issue on Jul 28, 2023
    7d9df60
  4. added a commit that references this issue on Sep 25, 2023
    19be6a3
  5. added a commit that references this issue on Mar 25, 2024
    756c6a0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions