Re: libmpathpersist: Getting undefined symbol during compilation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Benjamin,

Thanks for your reply. After I posted this question, I went through the source code and figured out that these functions are defined as weak. So they are not getting added to the library and binaries which are using them are re-defining these definitions.

I will try the suggestions as per below. But as a work around, we tried to use the RedHat 7 version of RPM to see if it works and it worked.

Anyhow, I will definitely try the suggestion and get back to you.

Thanks once again,
Sudhakar. 

On Thu, Mar 24, 2022 at 3:54 AM Benjamin Marzinski <bmarzins@xxxxxxxxxx> wrote:
On Sat, Mar 19, 2022 at 08:57:08PM +0530, boli sudha wrote:
> Hi,
>
> I found this mail Id on the Git page, I never used libmpathpersist or
> libmulitpath.
> One of our applications is using these libraries. Compilation was working
> fine on RedHat 7. I am trying to port our application to Redhat 8. During
> linking I am getting the following error. Can you please help me?
>
> /usr/lib64/libmpathpersist.so: undefined reference to `put_multipath_config'
> /usr/lib64/libmpathpersist.so: undefined reference to `get_multipath_config'
> /usr/lib64/libmultipath.so: undefined reference to `udev'
> collect2: error: ld returned 1 exit status
>
> These symbols were not present in the RedHat 7 version of libraries.
>
> On RedHat 8, these symbols were undefined, I downloaded the git code,
> compiled, and observed that these symbols are defined in binaries, not
> libraries.
>
> I also tried to remove these libraries from linker command, but so many
> symbols are missing.

Using libmpathpersist is kind of tricky. Later version of
device-mapper-multipath clean this up. But for the version in RHEL-8,
your binary needs to specify some things to work with libmpathpersist.

If your program is single threaded, then you should add something like
(pulled from mpathpersist/main.c):

======================
int logsink = 0;                /* or -1 */
struct config *multipath_conf;

struct config *get_multipath_config(void)
{
        return multipath_conf;
}

void put_multipath_config(__attribute__((unused)) void * arg)
{
        /* Noop for now */
}

void rcu_register_thread_memb(void) {}

void rcu_unregister_thread_memb(void) {}

struct udev *udev;
=====================

If you don't call all the mpathpersist commands with verbose = -1,
the library can log errors. Setting logsink to 0 will log them with a
timestamp. setting it to -1 will not add the timestamp.

Your main funciton also needs to set up these variables. It should
include something like (again pulled from mpathpersist/main.c):

====================
udev = udev_new();
multipath_conf = mpath_lib_init();     
====================

Both of these functions can return NULL on error.

Let me know if that helps.

-Ben

> --
> dm-devel mailing list
> dm-devel@xxxxxxxxxx
> https://listman.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux