Which compiler are you using?
Gcc-5.4 on x86_64, i686, and aarch64-le - as well as clang - are perfectly
happy to compile that idiom. I don’t see it as an error.
You might try combining the function declaration with the implementation, but
be advised that there are numerous instances of a related idiom which will
probably not compile, either:
void foo(void) __attribute__((weak)); void foo(void) { return 0;}
Thanks… Dave
From: Eric Chen [mailto:[email protected]]
Sent: Tuesday, August 22, 2017 8:16 AM
To: Dave Barach (dbarach) <[email protected]>; vpp-dev <[email protected]>
Cc: [email protected]
Subject: RE: 回复:compiling error when build fd.io_odp4vpp with cross_compiler
for aarch64 target
Yes, Dave,
But issue #1, first declare the func, (marked as yellow)
then define it, my cross_compler report an error,
how to fix it?
#define VLIB_REGISTER_NODE(x,...) \
__VA_ARGS__ vlib_node_registration_t x; \
static void __vlib_add_node_registration_##x (void) \
__attribute__((__constructor__)) ; \
static void __vlib_add_node_registration_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
x.next_registration = vm->node_main.node_registrations; \
vm->node_main.node_registrations = &x; \
} \
__VA_ARGS__ vlib_node_registration_t x
From: Dave Barach (dbarach) [mailto:[email protected]]
Sent: 2017年8月22日 20:10
To: Eric Chen <[email protected]<mailto:[email protected]>>; vpp-dev
<[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: [EXT] RE: 回复:compiling error when build fd.io_odp4vpp with
cross_compiler for aarch64 target
External Email
________________________________
The multiply-defined constructor function takes its name from the
VLIB_REGISTER_NODE macro argument...
From: Eric Chen [mailto:[email protected]]
Sent: Tuesday, August 22, 2017 8:05 AM
To: Dave Barach (dbarach) <[email protected]<mailto:[email protected]>>;
vpp-dev <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: RE: 回复:compiling error when build fd.io_odp4vpp with cross_compiler
for aarch64 target
Dave,
Yes, sure,
For issue#2, either -DIPSEC=0, goes to different branch, or changes to
different node name, it can remove the error, but if it’s the case, should
anyone meet such failure before.
How about the issue #1? Any compiling flags help?
Thanks
Eric
From: Dave Barach (dbarach) [mailto:[email protected]]
Sent: 2017年8月22日 19:51
To: Eric Chen <[email protected]<mailto:[email protected]>>; vpp-dev
<[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: [EXT] RE: 回复:compiling error when build fd.io_odp4vpp with
cross_compiler for aarch64 target
External Email
________________________________
Did you try changing the data structure names so they don’t conflict?
VLIB_REGISTER_NODE (ipsec_output4_node) + VLIB_REGISTER_NODE
(ipsec_output6_node).
Feel free to submit a patch. (😉)...
Thanks… Dave
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Eric Chen
Sent: Tuesday, August 22, 2017 6:19 AM
To: vpp-dev <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: [vpp-dev] 回复:compiling error when build fd.io_odp4vpp with
cross_compiler for aarch64 target
HI
I try to build odp4vpp on a x86 host with the cross-compiler for machine of
aarch64.
But encounter below errors, could you help me out?
1)
vpp/build-root/install-armada-a8k_debug-aarch64/vlib/include/vlib/node.h:147:13:
error: redefinition of '__vlib_add_node_registration_ipsec_output_node'
static void __vlib_add_node_registration_##x (void)
node.h:147
#define VLIB_REGISTER_NODE(x,...) \
__VA_ARGS__ vlib_node_registration_t x; \
static void __vlib_add_node_registration_##x (void) \
__attribute__((__constructor__)) ; \
static void __vlib_add_node_registration_##x (void) \
{ \
vlib_main_t * vm = vlib_get_main(); \
x.next_registration = vm->node_main.node_registrations; \
vm->node_main.node_registrations = &x; \
} \
__VA_ARGS__ vlib_node_registration_t x
2)
In ./vpp/vnet/vnet/ipsec/ipsec_output.c
If -DIPSEC=0, (--without-ipsec) then below will cause redefinition error as
well,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ipsec_output_node) = {
.vector_size = sizeof (u32),
.function = ipsec_output_node_fn,
.name = "ipsec-output-ip4",
};
VLIB_REGISTER_NODE (ipsec_output_node) = {
.vector_size = sizeof (u32),
.function = ipsec_output_node_fn,
.name = "ipsec-output-ip6",
};
_______________________________________________
vpp-dev mailing list
[email protected]
https://lists.fd.io/mailman/listinfo/vpp-dev