[Vm-dev] Unexpected external library dependencies on linux

Tobias Pape Das.Linux at gmx.de
Thu Apr 23 00:34:01 UTC 2020


> On 22.04.2020, at 22:42, Levente Uzonyi <leves at caesar.elte.hu> wrote:
> Hi Nicolas
> On Wed, 22 Apr 2020, Nicolas Cellier wrote:
>> Hi Levente,
>> Tthat's unfortunate...
>> Stupid guess: could it be related to the fact that we want to export all symbols?
>> Anyway, that means that those .so appeared on the command line when they shouldn't.
>> We might be able to fix the makefiles... Hmm thru configure, that ain't gonna be easy (not my cup of tea).
> I just checked what libraries are passed to the build command when building the VM binary. It's independent of the CC flag, so it's the same with both gcc and clang:
> -ldl -lutil -lpulse-simple -lasound -ldl -lm.
> I suspect that gcc is able to detect unused dependencies but clang is not.
> Here's what ldd says when clang is used:
> $ ldd -u squeak
> Unused direct dependencies:
> 	/lib/x86_64-linux-gnu/libutil.so.1
> 	/usr/lib/x86_64-linux-gnu/libpulse-simple.so.0
> 	/usr/lib/x86_64-linux-gnu/libasound.so.2
> $ ldd -u SHA2Plugin/.libs/SHA2Plugin.so
> Unused direct dependencies:
> 	/lib/x86_64-linux-gnu/libpthread.so.0
> However, both outputs are empty with gcc.
> I couldn't find any clang flags to fix this, so I'm afraid the only solution is to make autoconf generate proper dependencies because that seems to be the actual bug here but it was hidden by gcc.

I think I found the culprit:

1. AC_SEARCH_LIBS(function, libraries-list, action-if-found, action-if-not-found, extra-libraries)
2. "In this instance, each will be called at most once, and the default action-if-found code, adding the library to the LIBS variables, is always executed, even if a parameter is passed." (https://autotools.io/autoconf/finding.html)

3. platform/unix/config/acinclude.m4
    AC_MSG_RESULT([******** disabling ${plugin} due to missing libraries])
    disabled_plugins="${disabled_plugins} ${plugin}")])


	AC_PLUGIN_SEARCH_LIBS([pa_simple_new],[pulse-simple pulse])

5. % git blame vm-sound-ALSA/acinclude.m4
ba0f02c8f6 (Eliot Miranda 2010-06-26 05:12:25 +0000 1) # -*- sh -*-
ba0f02c8f6 (Eliot Miranda 2010-06-26 05:12:25 +0000 2)
696b4ebd01 (Tobias Pape   2018-03-05 16:41:11 +0100 3)
ba0f02c8f6 (Eliot Miranda 2010-06-26 05:12:25 +0000 4) AC_MSG_CHECKING([for Advanced Linux Sound Architecture])
696b4ebd01 (Tobias Pape   2018-03-05 16:41:11 +0100 5) AC_CHECK_HEADERS(alsa/asoundlib.h,,AC_PLUGIN_DISABLE)
696b4ebd01 (Tobias Pape   2018-03-05 16:41:11 +0100 6) AC_PLUGIN_SEARCH_LIBS([snd_pcm_open],[asound]


Fixed in https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/491

Best regards

More information about the Vm-dev mailing list