David, As you suggested, “try combining the function declaration with the implementation”
Below can pass the compiling, Thanks a lot. #define VLIB_REGISTER_NODE(x,...) \ __VA_ARGS__ vlib_node_registration_t x; \ __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: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On Behalf Of Eric Chen Sent: 2017年8月22日 20:49 To: Dave Barach (dbarach) <dbar...@cisco.com>; vpp-dev <vpp-dev@lists.fd.io> Cc: odp4vpp-...@lists.fd.io Subject: [EXT] Re: [vpp-dev] 回复:compiling error when build fd.io_odp4vpp with cross_compiler for aarch64 target External Email ________________________________ Hi David, It’s marvell cross-compiler. ~/work/git_work/fd.io_odp4vpp/vpp$ /home/ericxh/work/toolchain/marvell-gcc-5.2.1-16.02.0-armv8/armv8/le/aarch64v8-marvell-linux-gnu-5.2.1_i686_20151110/bin/aarch64-marvell-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/home/ericxh/work/toolchain/marvell-gcc-5.2.1-16.02.0-armv8/armv8/le/aarch64v8-marvell-linux-gnu-5.2.1_i686_20151110/bin/aarch64-marvell-linux-gnu-gcc COLLECT_LTO_WRAPPER=/mnt/disk1/ericxh/work/toolchain/marvell-gcc-5.2.1-16.02.0-armv8/armv8/le/aarch64v8-marvell-linux-gnu-5.2.1_i686_20151110/bin/../libexec/gcc/aarch64-linux-gnu/5.2.1/lto-wrapper Target: aarch64-linux-gnu Configured with: /home/gccbuilder-i386/release/mgcc5.0/src/gcc-src/configure --host=i686-linux-gnu --build=i686-linux-gnu --target=aarch64-linux-gnu --prefix=/home/gccbuilder-i386/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_i686 --enable-libssp --enable-shared --enable-threads --enable-lto --enable-libgomp --enable-gnu-indirect-function --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-pkgversion='Marvell GCC release 20151110-a53c013d' --with-bugurl=mailto:mrvlgcc...@gmail.com --with-sysroot=/home/gccbuilder-i386/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_i686/aarch64-linux-gnu/libc --with-build-sysroot=/home/gccbuilder-i386/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_i686/aarch64-linux-gnu/libc --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-build-time-tools=/home/gccbuilder-i386/release/mgcc5.0/Release/install/aarch64v8-marvell-linux-gnu-5.2.1_i686/aarch64-linux-gnu/bin --enable-poison-system-directories --enable-symvers=gnu --enable-__cxa_atexit --enable-multiarch --enable-linker-build-id --disable-nls --disable-libstdcxx-pch --disable-libcc1 --with-specs='%{funwind-tables|fno-unwind-tables|ffreestanding|nostdlib:;:-funwind-tables}' --disable-multilib Thread model: posix gcc version 5.2.1 20151103 (Marvell GCC release 20151110-a53c013d) if via weak attribution, it reported below since the func is static, /mnt/disk1/ericxh/work/git_work/fd.io_odp4vpp/vpp/build-data/../vlib/vlib/node.h:145:13: error: weak declaration of '__vlib_add_node_registration_misc_drop_buffers_node' must be public static void __vlib_add_node_registration_##x (void) if removing the declaration, it can pass the compiling, but any side affect if lost __attribute__((__constructor__)) ? From: Dave Barach (dbarach) [mailto:dbar...@cisco.com] Sent: 2017年8月22日 20:23 To: Eric Chen <eri...@marvell.com<mailto:eri...@marvell.com>>; vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Cc: odp4vpp-...@lists.fd.io<mailto:odp4vpp-...@lists.fd.io> Subject: [EXT] RE: 回复:compiling error when build fd.io_odp4vpp with cross_compiler for aarch64 target External Email ________________________________ 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:eri...@marvell.com] Sent: Tuesday, August 22, 2017 8:16 AM To: Dave Barach (dbarach) <dbar...@cisco.com<mailto:dbar...@cisco.com>>; vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Cc: odp4vpp-...@lists.fd.io<mailto:odp4vpp-...@lists.fd.io> 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:dbar...@cisco.com] Sent: 2017年8月22日 20:10 To: Eric Chen <eri...@marvell.com<mailto:eri...@marvell.com>>; vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Cc: odp4vpp-...@lists.fd.io<mailto:odp4vpp-...@lists.fd.io> 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:eri...@marvell.com] Sent: Tuesday, August 22, 2017 8:05 AM To: Dave Barach (dbarach) <dbar...@cisco.com<mailto:dbar...@cisco.com>>; vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Cc: odp4vpp-...@lists.fd.io<mailto:odp4vpp-...@lists.fd.io> 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:dbar...@cisco.com] Sent: 2017年8月22日 19:51 To: Eric Chen <eri...@marvell.com<mailto:eri...@marvell.com>>; vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Cc: odp4vpp-...@lists.fd.io<mailto:odp4vpp-...@lists.fd.io> 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: vpp-dev-boun...@lists.fd.io<mailto:vpp-dev-boun...@lists.fd.io> [mailto:vpp-dev-boun...@lists.fd.io] On Behalf Of Eric Chen Sent: Tuesday, August 22, 2017 6:19 AM To: vpp-dev <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Cc: odp4vpp-...@lists.fd.io<mailto:odp4vpp-...@lists.fd.io> 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 vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev