All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] libmpathpersist: Getting undefined symbol during compilation
@ 2022-03-19 15:27 boli sudha
  2022-03-23 22:24 ` Benjamin Marzinski
  0 siblings, 1 reply; 3+ messages in thread
From: boli sudha @ 2022-03-19 15:27 UTC (permalink / raw)
  To: christophe.varoqui, dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 876 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 1013 bytes --]

[-- Attachment #2: Type: text/plain, Size: 98 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-devel] libmpathpersist: Getting undefined symbol during compilation
  2022-03-19 15:27 [dm-devel] libmpathpersist: Getting undefined symbol during compilation boli sudha
@ 2022-03-23 22:24 ` Benjamin Marzinski
  2022-03-24  5:01   ` boli sudha
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Marzinski @ 2022-03-23 22:24 UTC (permalink / raw)
  To: boli sudha; +Cc: dm-devel

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@redhat.com
> https://listman.redhat.com/mailman/listinfo/dm-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-devel] libmpathpersist: Getting undefined symbol during compilation
  2022-03-23 22:24 ` Benjamin Marzinski
@ 2022-03-24  5:01   ` boli sudha
  0 siblings, 0 replies; 3+ messages in thread
From: boli sudha @ 2022-03-24  5:01 UTC (permalink / raw)
  To: Benjamin Marzinski; +Cc: dm-devel


[-- Attachment #1.1: Type: text/plain, Size: 3024 bytes --]

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@redhat.com>
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@redhat.com
> > https://listman.redhat.com/mailman/listinfo/dm-devel
>
>

[-- Attachment #1.2: Type: text/html, Size: 3922 bytes --]

[-- Attachment #2: Type: text/plain, Size: 98 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-24 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 15:27 [dm-devel] libmpathpersist: Getting undefined symbol during compilation boli sudha
2022-03-23 22:24 ` Benjamin Marzinski
2022-03-24  5:01   ` boli sudha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.