You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
./configure --prefix=/usr --disable-static && make && make check
It produces:
/usr/bin/ld: test_auth_keyboard_info_request.o: in function `main':
test_auth_keyboard_info_request.c:(.text.startup+0xec): undefined reference to `userauth_keyboard_interactive_decode_info_request'
/usr/bin/ld: test_auth_keyboard_info_request.c:(.text.startup+0x201): undefined reference to `userauth_keyboard_interactive_decode_info_request'
collect2: error: ld returned 1 exit status
Expected behavior
Test succeeds.
Version:
OS and version: Linux (Linux From Scratch)
libssh2 version: 1.11.0
crypto backend and version: OpenSSL
Additional context
It looks like the reason is userauth_keyboard_interactive_decode_info_request not exported in the shared library because we are linking libssh2.so with -export-symbols-regex '^libssh2_.*'.
One (obvious) workaround is to not build the tests (also with --disable-tests, new in 1.11.0) if omitting the static lib, or build the static lib when needing the tests.
Or try CMake (or Makefile.mk), which will exclude these specific tests when not building the static lib. Probably the same could be implemented for autotools.
Disabling install is another option (though my autotools skills are too short to implement it). The current solution has the advantage that it works the same way for all build systems. Also with CMake, building static libs doesn't come free (it's a separate build pass) and in some envs an install phase might not be used at all, so disabling it completely can have some advantages.
I think once we have a more substantial amount of tests relying on internal functions, we might switch to always building the static lib to avoid skipping tests.
Activity
willco007 commentedon May 30, 2023
This function shouldn't be exported, but also should be available for use in unit tests. Hum.
vszakats commentedon May 30, 2023
One (obvious) workaround is to not build the tests (also with
--disable-tests, new in 1.11.0) if omitting the static lib, or build the static lib when needing the tests.Or try CMake (or
Makefile.mk), which will exclude these specific tests when not building the static lib. Probably the same could be implemented for autotools.vszakats commentedon May 30, 2023
Ref: 83853f8 #663
kloczek commentedon May 31, 2023
I have more missing symbols with --disable-static with LTO
vszakats commentedon May 31, 2023
These are the tests that require the static lib, to access internal functions:
libssh2/tests/Makefile.inc
Lines 37 to 42 in bc69ac2
xry111 commentedon May 31, 2023
It just does not work, no matter if LTO is used.
tests: Do not run tests accessing internal functions if --disable-static
tests: Do not run tests accessing internal functions if --disable-static
kloczek commentedon May 31, 2023
So why not form static library used only on linking test units executables? 🤔
vszakats commentedon May 31, 2023
Is that not the same as building the static lib itself?
autotools: skip tests requiring static lib if `--disable-static` (#1072)
BrianInglis commentedon Jun 3, 2023
Perhaps --disable-static should disable the static lib install, and/or build a static lib with only those modules?
vszakats commentedon Jun 3, 2023
Disabling install is another option (though my autotools skills are too short to implement it). The current solution has the advantage that it works the same way for all build systems. Also with CMake, building static libs doesn't come free (it's a separate build pass) and in some envs an install phase might not be used at all, so disabling it completely can have some advantages.
I think once we have a more substantial amount of tests relying on internal functions, we might switch to always building the static lib to avoid skipping tests.
autotools: skip tests requiring static lib if `--disable-static` (lib…
Update to 1.11.0 (rhbz#2211200)
autotools: skip tests requiring static lib if `--disable-static` (lib…