• Missing shared library =?utf-8?Q?symbols?= =?utf-8?B?4oCm?= that don't

    From Andy Smith@21:1/5 to All on Tue Apr 29 02:50:01 2025
    Hi,

    What am I doing wrong here? It's been a couple of years and perhaps this
    part of my brain has dissolved.

    $ cat foo.c
    #include <errno.h>
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <xenstat.h>

    int main(int argc, char **argv)
    {
    xenstat_handle *xhandle = NULL;

    xhandle = xenstat_init();

    if (xhandle == NULL) {
    fprintf(stderr, "%s: Failed to initialize xenstat library\n", argv[0]);
    exit(EXIT_FAILURE);
    }

    return 0;
    }
    $ cc -Wall -lxenstat -o foo foo.c
    foo.c:(.text+0x18): undefined reference to `xenstat_init'
    collect2: error: ld returned 1 exit status
    $ nm -D /usr/lib/x86_64-linux-gnu/libxenstat.so | grep xenstat_init 0000000000003980 T xenstat_init@@VERS_4.20.0

    I have checkjed with strace and the ld that cc spawns is opening that
    shared library, and that shared library does have that symbol, so…
    what's going on?

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)