Skip to contentSkip to conversation

net/virtio: fix build errors

PATCH Applied [email protected] 3 participants 3 messages Jul 30, 2019 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/virtio: fix build errors

From: Jerin Jacob <[email protected]>

Add extern to variable declaration to avoid some compiler treating it as variable definition.

build error log:

lib/librte_pmd_virtio.a(vhost_kernel.o):(.rodata+0x110):
multiple definition of `vhost_msg_strings' lib/librte_pmd_virtio.a(vhost_user.o):(.data.rel.ro.local+0x0):
first defined here lib/librte_pmd_virtio.a(virtio_user_dev.o):(.rodata+0xe8):
multiple definition of `vhost_msg_strings' lib/librte_pmd_virtio.a(vhost_user.o):(.data.rel.ro.local+0x0):
first defined here

Fixes 33d24d65fe2b ("net/virtio-user: abstract backend operations")
---
 drivers/net/virtio/virtio_user/vhost.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_user/vhost.h +1 -1
index 55f47036b..1e784e58e 100644
@@ -67,7 +67,7 @@ enum vhost_user_request {
 	VHOST_USER_MAX
 };
 
-const char * const vhost_msg_strings[VHOST_USER_MAX];
+extern const char * const vhost_msg_strings[VHOST_USER_MAX];
 
 struct vhost_memory_region {
 	uint64_t guest_phys_addr;
Signature · 1 line
2.22.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · On 7/30/19 1:04 PM, [email protected] wrote:

From: Jerin Jacob <[email protected]>

Add extern to variable declaration to avoid some compiler treating it as variable definition.

build error log:

lib/librte_pmd_virtio.a(vhost_kernel.o):(.rodata+0x110):
multiple definition of `vhost_msg_strings' lib/librte_pmd_virtio.a(vhost_user.o):(.data.rel.ro.local+0x0):
first defined here lib/librte_pmd_virtio.a(virtio_user_dev.o):(.rodata+0xe8):
multiple definition of `vhost_msg_strings' lib/librte_pmd_virtio.a(vhost_user.o):(.data.rel.ro.local+0x0):
first defined here

Fixes 33d24d65fe2b ("net/virtio-user: abstract backend operations")
---
 drivers/net/virtio/virtio_user/vhost.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_user/vhost.h +0 -0
index 55f47036b..1e784e58e 100644

drivers/net/virtio/virtio_user/vhost.h enum vhost_user_request { · line 73

Quoted 8 lines
drivers/net/virtio/virtio_user/vhost.h +1 -1
@@ -67,7 +67,7 @@ enum vhost_user_request {
 	VHOST_USER_MAX
 };
 
-const char * const vhost_msg_strings[VHOST_USER_MAX];
+extern const char * const vhost_msg_strings[VHOST_USER_MAX];
 
 struct vhost_memory_region {
 	uint64_t guest_phys_addr;

Thanks,
Maxime

#2 lore raw

30/07/2019 18:12, Maxime Coquelin:

Quoted 17 lines · On 7/30/19 1:04 PM, [email protected] wrote:
Quoted 16 lines

From: Jerin Jacob <[email protected]>

Add extern to variable declaration to avoid some compiler treating it as variable definition.

build error log:

lib/librte_pmd_virtio.a(vhost_kernel.o):(.rodata+0x110):
multiple definition of `vhost_msg_strings' lib/librte_pmd_virtio.a(vhost_user.o):(.data.rel.ro.local+0x0):
first defined here lib/librte_pmd_virtio.a(virtio_user_dev.o):(.rodata+0xe8):
multiple definition of `vhost_msg_strings' lib/librte_pmd_virtio.a(vhost_user.o):(.data.rel.ro.local+0x0):
first defined here

Quoted 8 lines
Quoted 6 lines
Fixes 33d24d65fe2b ("net/virtio-user: abstract backend operations")

Applied, thanks