All of lore.kernel.org
 help / color / mirror / Atom feed
* [SPDK] Linker errors after adding new library
@ 2018-02-22 14:52 Avinash M N
  0 siblings, 0 replies; 4+ messages in thread
From: Avinash M N @ 2018-02-22 14:52 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

Hello everyone,

              I'm trying to add a new library in spdk/lib which will provide some statistical information. The functions from this library can be called from other libraries. One of the functions from my library is called from env_dpdk/env.c. During compilation, I'm getting the following linker errors only in vhost and iscsi_tgt apps.

/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats'
collect2: error: ld returned 1 exit status
make[2]: *** [iscsi_tgt] Error 1
make[1]: *** [iscsi_tgt] Error 2
make[1]: *** Waiting for unfinished jobs....
/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats'
collect2: error: ld returned 1 exit status
make[2]: *** [vhost] Error 1
make[1]: *** [vhost] Error 2
make: *** [app] Error 2

The nvmf_tgt application compiled successfully. I'm not able to figure out what is going wrong since I have made the same changes in Makefiles of nvmf_tgt and vhost/iscsi_tgt. I tried re-ordering the library in the Makefile but it did not solve the issue. Can anyone suggest what might be going wrong?

Thanks,
Avinash

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 3760 bytes --]

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

* Re: [SPDK] Linker errors after adding new library
@ 2018-02-23 12:09 Avinash M N
  0 siblings, 0 replies; 4+ messages in thread
From: Avinash M N @ 2018-02-23 12:09 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 3000 bytes --]

Thanks James and Daniel.

I think it was indeed a circular dependency issue. I was able to work around the issue with a different structure.

Regards
Avinash

From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Verkamp, Daniel
Sent: Thursday, February 22, 2018 10:26 PM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: Re: [SPDK] Linker errors after adding new library

In general, the env layer implementation is expected to be a leaf in the dependency graph (e.g. it should not depend on any other SPDK libraries).  This is why env_dpdk reimplements _sprintf_alloc() rather than using spdk_sprintf_alloc() from util. Otherwise, we would end up with circular dependencies in the library link order.

From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Harris, James R
Sent: Thursday, February 22, 2018 7:57 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>>
Subject: Re: [SPDK] Linker errors after adding new library

Hi Avinash,

Can you post your patch to GerritHub?  That is the best way for others to help.

If you put [RFC] in the title of your patch, it will not be added to the patch queue for the CI test pool.

Regards,

-Jim


From: SPDK <spdk-bounces(a)lists.01.org<mailto:spdk-bounces(a)lists.01.org>> on behalf of Avinash M N <Avinash.M.N(a)wdc.com<mailto:Avinash.M.N(a)wdc.com>>
Reply-To: Storage Performance Development Kit <spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>>
Date: Thursday, February 22, 2018 at 7:52 AM
To: "spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>" <spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>>
Subject: [SPDK] Linker errors after adding new library

Hello everyone,

              I’m trying to add a new library in spdk/lib which will provide some statistical information. The functions from this library can be called from other libraries. One of the functions from my library is called from env_dpdk/env.c. During compilation, I’m getting the following linker errors only in vhost and iscsi_tgt apps.

/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats’
collect2: error: ld returned 1 exit status
make[2]: *** [iscsi_tgt] Error 1
make[1]: *** [iscsi_tgt] Error 2
make[1]: *** Waiting for unfinished jobs....
/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats'
collect2: error: ld returned 1 exit status
make[2]: *** [vhost] Error 1
make[1]: *** [vhost] Error 2
make: *** [app] Error 2

The nvmf_tgt application compiled successfully. I’m not able to figure out what is going wrong since I have made the same changes in Makefiles of nvmf_tgt and vhost/iscsi_tgt. I tried re-ordering the library in the Makefile but it did not solve the issue. Can anyone suggest what might be going wrong?

Thanks,
Avinash

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 8898 bytes --]

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

* Re: [SPDK] Linker errors after adding new library
@ 2018-02-22 16:55 Verkamp, Daniel
  0 siblings, 0 replies; 4+ messages in thread
From: Verkamp, Daniel @ 2018-02-22 16:55 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 2559 bytes --]

In general, the env layer implementation is expected to be a leaf in the dependency graph (e.g. it should not depend on any other SPDK libraries).  This is why env_dpdk reimplements _sprintf_alloc() rather than using spdk_sprintf_alloc() from util. Otherwise, we would end up with circular dependencies in the library link order.

From: SPDK [mailto:spdk-bounces(a)lists.01.org] On Behalf Of Harris, James R
Sent: Thursday, February 22, 2018 7:57 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: Re: [SPDK] Linker errors after adding new library

Hi Avinash,

Can you post your patch to GerritHub?  That is the best way for others to help.

If you put [RFC] in the title of your patch, it will not be added to the patch queue for the CI test pool.

Regards,

-Jim


From: SPDK <spdk-bounces(a)lists.01.org<mailto:spdk-bounces(a)lists.01.org>> on behalf of Avinash M N <Avinash.M.N(a)wdc.com<mailto:Avinash.M.N(a)wdc.com>>
Reply-To: Storage Performance Development Kit <spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>>
Date: Thursday, February 22, 2018 at 7:52 AM
To: "spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>" <spdk(a)lists.01.org<mailto:spdk(a)lists.01.org>>
Subject: [SPDK] Linker errors after adding new library

Hello everyone,

              I’m trying to add a new library in spdk/lib which will provide some statistical information. The functions from this library can be called from other libraries. One of the functions from my library is called from env_dpdk/env.c. During compilation, I’m getting the following linker errors only in vhost and iscsi_tgt apps.

/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats’
collect2: error: ld returned 1 exit status
make[2]: *** [iscsi_tgt] Error 1
make[1]: *** [iscsi_tgt] Error 2
make[1]: *** Waiting for unfinished jobs....
/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats'
collect2: error: ld returned 1 exit status
make[2]: *** [vhost] Error 1
make[1]: *** [vhost] Error 2
make: *** [app] Error 2

The nvmf_tgt application compiled successfully. I’m not able to figure out what is going wrong since I have made the same changes in Makefiles of nvmf_tgt and vhost/iscsi_tgt. I tried re-ordering the library in the Makefile but it did not solve the issue. Can anyone suggest what might be going wrong?

Thanks,
Avinash

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 7250 bytes --]

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

* Re: [SPDK] Linker errors after adding new library
@ 2018-02-22 14:57 Harris, James R
  0 siblings, 0 replies; 4+ messages in thread
From: Harris, James R @ 2018-02-22 14:57 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 1830 bytes --]

Hi Avinash,

Can you post your patch to GerritHub?  That is the best way for others to help.

If you put [RFC] in the title of your patch, it will not be added to the patch queue for the CI test pool.

Regards,

-Jim


From: SPDK <spdk-bounces(a)lists.01.org> on behalf of Avinash M N <Avinash.M.N(a)wdc.com>
Reply-To: Storage Performance Development Kit <spdk(a)lists.01.org>
Date: Thursday, February 22, 2018 at 7:52 AM
To: "spdk(a)lists.01.org" <spdk(a)lists.01.org>
Subject: [SPDK] Linker errors after adding new library

Hello everyone,

              I’m trying to add a new library in spdk/lib which will provide some statistical information. The functions from this library can be called from other libraries. One of the functions from my library is called from env_dpdk/env.c. During compilation, I’m getting the following linker errors only in vhost and iscsi_tgt apps.

/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats’
collect2: error: ld returned 1 exit status
make[2]: *** [iscsi_tgt] Error 1
make[1]: *** [iscsi_tgt] Error 2
make[1]: *** Waiting for unfinished jobs....
/root/spdk/build/lib/libspdk_env_dpdk.a(env.o): In function `spdk_dma_zmalloc':
/root/spdk/lib/env_dpdk/env.c:87: undefined reference to `malloc_stats'
collect2: error: ld returned 1 exit status
make[2]: *** [vhost] Error 1
make[1]: *** [vhost] Error 2
make: *** [app] Error 2

The nvmf_tgt application compiled successfully. I’m not able to figure out what is going wrong since I have made the same changes in Makefiles of nvmf_tgt and vhost/iscsi_tgt. I tried re-ordering the library in the Makefile but it did not solve the issue. Can anyone suggest what might be going wrong?

Thanks,
Avinash

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 5794 bytes --]

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

end of thread, other threads:[~2018-02-23 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 14:52 [SPDK] Linker errors after adding new library Avinash M N
2018-02-22 14:57 Harris, James R
2018-02-22 16:55 Verkamp, Daniel
2018-02-23 12:09 Avinash M N

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.