[ovs-discuss] cross-compiling OVS with aarch64-linux-gnu GCC-5.3.1

Yehuda Yitschak yehuday at marvell.com
Thu Sep 14 18:47:43 UTC 2017


One small update

I switched to OVS 2.8.0 but I still see the same issue


From: Yehuda Yitschak
Sent: Thursday, September 14, 2017 21:33
To: Shadi Ammouri; 'ovs-discuss at openvswitch.org'
Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com> (thomas.petazzoni at free-electrons.com)
Subject: cross-compiling OVS with aarch64-linux-gnu GCC-5.3.1



Hi all



i am trying to build OVS 2.5.3 with shared libraries for aarch64 with a Linaro toolchain based on GCC 5.3.1



“gcc –v”  gives

gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)



my configure line shows this  (from config.log). note that it was generated by buildroot so some options are meaningless for OVS



/configure --target=aarch64-buildroot-linux-gnu --host=aarch64-buildroot-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix= --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-static --enable-shared





i come across 2 issues during link time. The first issue is linking the ovs-ofctl utility. during link time ld complains that i can't find the libsflow which ofproto needs. Here is the link line and related error.


 link: /home/yehuday/projects/ucpe/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -o utilities/.libs/ovs-ofctl utilities/ovs-ofctl.o  -L/home/yehuday/projects/ucpe/buildroot/output/host/usr/aarch64-buildroot-linux-gnu/sysroot/usr//lib ofproto/.libs/libofproto.so lib/.libs/libopenvswitch.so -latomic -lpthread -lrt -lm
/home/yehuday/compilers/armv8/gcc-linaro-5.3.1-2016.05-i686_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/5.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libsflow.so.1, needed by ofproto/.libs/libofproto.so, not found (try using -rpath or -rpath-link)
ofproto/.libs/libofproto.so: undefined reference to `sfl_poller_set_bridgePort at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_removePoller at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_receiver_set_sFlowRcvrTimeout at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_addPoller at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_sampler_get_sFlowFsPacketSamplingRate at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_receiver_set_sFlowRcvrOwner at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_sampler_set_sFlowFsPacketSamplingRate at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_tick at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_poller_set_sFlowCpInterval at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_sampler_set_sFlowFsReceiver at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_removeSampler at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_init at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_sampler_set_sFlowFsMaximumHeaderSize at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_release at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_poller_writeCountersSample at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_addReceiver at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_sampler_writeFlowSample at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_agent_addSampler at libsflow_1'
ofproto/.libs/libofproto.so: undefined reference to `sfl_poller_set_sFlowCpReceiver at libsflow_1'
collect2: error: ld returned 1 exit status
make[2]: *** [utilities/ovs-ofctl] Error 1



libsflow.so is not mentioned anywhere in the build command, i assume ld extracts it from ofproto. However libsflow's path, "./lib/.libs", is not specified so i'm not sure how ld can find it

i managed to resolve this issue by  adding "-Wl,-rpath-link,lib/.libs" but I think that’s not so clean.



What is even stranger is that the problem disappears when i use the custom ubuntu aarch64 compiler (GCC 4.8.4) or when i compile for x86. maybe the builtin compilers know that they need to search under project folders ?



another issue i come accross is related to Buildroot panic checks. buildroot makes sure that when cross-compiling the linker never uses the host libraries. when relinking ofproto a "-L/usr/lib" causes a failure of that check. thechnically there is no reason to include /usr/lib in the search path but i can't find how to disable that



here is the link line and error


libtool: relink: /home/yehuday/projects/ucpe/buildroot/output/host/usr/bin/aarch64-linux-gnu-gcc -shared  -fPIC -DPIC  ofproto
/.libs/ofproto_libofproto_la-bond.o ofproto/.libs/ofproto_libofproto_la-collectors.o ofproto/.libs/ofproto_libofproto_la-connm
gr.o ofproto/.libs/ofproto_libofproto_la-fail-open.o ofproto/.libs/ofproto_libofproto_la-in-band.o ofproto/.libs/ofproto_libof
proto_la-names.o ofproto/.libs/ofproto_libofproto_la-netflow.o ofproto/.libs/ofproto_libofproto_la-ofproto.o ofproto/.libs/ofp
roto_libofproto_la-ofproto-dpif.o ofproto/.libs/ofproto_libofproto_la-ofproto-dpif-ipfix.o ofproto/.libs/ofproto_libofproto_la
-ofproto-dpif-mirror.o ofproto/.libs/ofproto_libofproto_la-ofproto-dpif-monitor.o ofproto/.libs/ofproto_libofproto_la-ofproto-
dpif-rid.o ofproto/.libs/ofproto_libofproto_la-ofproto-dpif-sflow.o ofproto/.libs/ofproto_libofproto_la-ofproto-dpif-upcall.o
ofproto/.libs/ofproto_libofproto_la-ofproto-dpif-xlate.o ofproto/.libs/ofproto_libofproto_la-pktbuf.o ofproto/.libs/ofproto_li
bofproto_la-pinsched.o ofproto/.libs/ofproto_libofproto_la-tunnel.o ofproto/.libs/ofproto_libofproto_la-bundles.o   -L/home/ye
huday/projects/ucpe/buildroot/output/host/usr/aarch64-buildroot-linux-gnu/sysroot/usr//lib -L/home/yehuday/projects/ucpe/build
root/output/host/usr/aarch64-buildroot-linux-gnu/sysroot/usr/lib -L/usr/lib -lsflow -latomic -lpthread -lrt -lm  -Os -Wl,--ver
sion-script=./ofproto/libofproto.sym   -Wl,-soname -Wl,libofproto.so.1 -o ofproto/.libs/libofproto.so.1.0.0
aarch64-linux-gnu-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L/usr/lib'
libtool: install: error: relink `ofproto/libofproto.la' with the above command before installing it
make[5]: *** [install-libLTLIBRARIES] Error 1

​any help is greatly appreciated

Thanks

Yehuda














-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20170914/ae4edfaa/attachment-0001.html>


More information about the discuss mailing list