[ovs-dev,v1] travis: Add dpdk shared library build.

Message ID 1541772157-20926-1-git-send-email-ian.stokes@intel.com
State Accepted
Delegated to: Ian Stokes
Headers show
Series
  • [ovs-dev,v1] travis: Add dpdk shared library build.
Related show

Commit Message

Ian Stokes Nov. 9, 2018, 2:02 p.m.
Add travis builds for DPDK as a shared library.

Currently the DPDK builds in travis only compile DPDK as a static library.
With static builds in DPDK there is a risk that if a function is not
exported then it will not be supported when DPDK is used as a shared library.
This commit adds the option to build DPDK as a shared library. Also two
build jobs are added to the travis.yml whereby a shared DPDK is built
with both static and shared OVS libraries.

Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 .travis.yml            |  2 ++
 .travis/linux-build.sh | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

Lam, Tiago Jan. 16, 2019, 11:23 a.m. | #1
On 09/11/2018 14:02, Ian Stokes wrote:
> Add travis builds for DPDK as a shared library.
> 
> Currently the DPDK builds in travis only compile DPDK as a static library.
> With static builds in DPDK there is a risk that if a function is not
> exported then it will not be supported when DPDK is used as a shared library.
> This commit adds the option to build DPDK as a shared library. Also two
> build jobs are added to the travis.yml whereby a shared DPDK is built
> with both static and shared OVS libraries.
> 
> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> ---

Thanks, this is a useful addition. I've looked at the patch and it looks
good to me.

I haven't triggered a Travis build for this, I can see from the build
history this builds successfully.

Acked-by: Tiago Lam <tiago.lam@intel.com>


Tiago.
Aaron Conole Jan. 16, 2019, 2:19 p.m. | #2
"Lam, Tiago" <tiago.lam@intel.com> writes:

> On 09/11/2018 14:02, Ian Stokes wrote:
>> Add travis builds for DPDK as a shared library.
>> 
>> Currently the DPDK builds in travis only compile DPDK as a static library.
>> With static builds in DPDK there is a risk that if a function is not
>> exported then it will not be supported when DPDK is used as a shared library.
>> This commit adds the option to build DPDK as a shared library. Also two
>> build jobs are added to the travis.yml whereby a shared DPDK is built
>> with both static and shared OVS libraries.
>> 
>> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
>> ---
>
> Thanks, this is a useful addition. I've looked at the patch and it looks
> good to me.
>
> I haven't triggered a Travis build for this, I can see from the build
> history this builds successfully.

In this vein, I've re-run the robot build for this.

https://travis-ci.org/ovsrobot/ovs/builds/480403514

Happy hacking!

> Acked-by: Tiago Lam <tiago.lam@intel.com>
>
>
> Tiago.
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Kevin Traynor Jan. 16, 2019, 3:07 p.m. | #3
On 11/09/2018 02:02 PM, Ian Stokes wrote:
> Add travis builds for DPDK as a shared library.
> 
> Currently the DPDK builds in travis only compile DPDK as a static library.
> With static builds in DPDK there is a risk that if a function is not
> exported then it will not be supported when DPDK is used as a shared library.
> This commit adds the option to build DPDK as a shared library. Also two
> build jobs are added to the travis.yml whereby a shared DPDK is built
> with both static and shared OVS libraries.
> 
> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> ---

Acked-by: Kevin Traynor <ktraynor@redhat.com>

>  .travis.yml            |  2 ++
>  .travis/linux-build.sh | 11 ++++++++---
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index a2ef8bde5..b74ba2bfd 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -35,6 +35,8 @@ env:
>    - BUILD_ENV="-m32" OPTS="--disable-ssl"
>    - KERNEL=3.16.54 DPDK=1
>    - KERNEL=3.16.54 DPDK=1 OPTS="--enable-shared"
> +  - KERNEL=3.16.54 DPDK_SHARED=1
> +  - KERNEL=3.16.54 DPDK_SHARED=1 OPTS="--enable-shared"
>    - KERNEL=4.17.14
>    - KERNEL=4.16.18
>    - KERNEL=4.15.18
> diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
> index 1fe5bbfa9..e9bfb72ff 100755
> --- a/.travis/linux-build.sh
> +++ b/.travis/linux-build.sh
> @@ -6,6 +6,7 @@ KERNELSRC=""
>  CFLAGS="-Werror"
>  SPARSE_FLAGS=""
>  EXTRA_OPTS=""
> +TARGET="x86_64-native-linuxapp-gcc"
>  
>  function install_kernel()
>  {
> @@ -66,7 +67,11 @@ function install_dpdk()
>      find ./ -type f | xargs sed -i 's/-Werror/-Werror -Wno-error=inline/'
>      echo 'CONFIG_RTE_BUILD_FPIC=y' >>config/common_linuxapp
>      sed -ri '/EXECENV_CFLAGS  = -pthread -fPIC/{s/$/\nelse ifeq ($(CONFIG_RTE_BUILD_FPIC),y)/;s/$/\nEXECENV_CFLAGS  = -pthread -fPIC/}' mk/exec-env/linuxapp/rte.vars.mk
> -    make config CC=gcc T=x86_64-native-linuxapp-gcc
> +    if [ "$DPDK_SHARED" ]; then
> +        sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/' config/common_base
> +        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib
> +    fi
> +    make config CC=gcc T=$TARGET
>      make CC=gcc RTE_KERNELDIR=$KERNELSRC
>      echo "Installed DPDK source in $(pwd)"
>      cd ..
> @@ -77,11 +82,11 @@ function configure_ovs()
>      ./boot.sh && ./configure $*
>  }
>  
> -if [ "$KERNEL" ] || [ "$DPDK" ]; then
> +if [ "$KERNEL" ] || [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
>      install_kernel $KERNEL
>  fi
>  
> -if [ "$DPDK" ]; then
> +if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
>      if [ -z "$DPDK_VER" ]; then
>          DPDK_VER="17.11.4"
>      fi
>
Ian Stokes Jan. 16, 2019, 5:05 p.m. | #4
> On 11/09/2018 02:02 PM, Ian Stokes wrote:
> > Add travis builds for DPDK as a shared library.
> >
> > Currently the DPDK builds in travis only compile DPDK as a static
> library.
> > With static builds in DPDK there is a risk that if a function is not
> > exported then it will not be supported when DPDK is used as a shared
> library.
> > This commit adds the option to build DPDK as a shared library. Also
> > two build jobs are added to the travis.yml whereby a shared DPDK is
> > built with both static and shared OVS libraries.
> >
> > Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> > ---
> 
> Acked-by: Kevin Traynor <ktraynor@redhat.com>

Thanks for reviewing and ACKING.

As this is quite useful testcase I'm considering pushing to master for 2.11 and also backporting (to at least OVS 2.10 and 2.9 as they use a different DPDK where function mapping may differ and hence be missed without this test).

@Ben, although this is a v1, is this ok for me to rebase and push to master for 2.11?


Thanks
Ian
> 
> >  .travis.yml            |  2 ++
> >  .travis/linux-build.sh | 11 ++++++++---
> >  2 files changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/.travis.yml b/.travis.yml index a2ef8bde5..b74ba2bfd
> > 100644
> > --- a/.travis.yml
> > +++ b/.travis.yml
> > @@ -35,6 +35,8 @@ env:
> >    - BUILD_ENV="-m32" OPTS="--disable-ssl"
> >    - KERNEL=3.16.54 DPDK=1
> >    - KERNEL=3.16.54 DPDK=1 OPTS="--enable-shared"
> > +  - KERNEL=3.16.54 DPDK_SHARED=1
> > +  - KERNEL=3.16.54 DPDK_SHARED=1 OPTS="--enable-shared"
> >    - KERNEL=4.17.14
> >    - KERNEL=4.16.18
> >    - KERNEL=4.15.18
> > diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh index
> > 1fe5bbfa9..e9bfb72ff 100755
> > --- a/.travis/linux-build.sh
> > +++ b/.travis/linux-build.sh
> > @@ -6,6 +6,7 @@ KERNELSRC=""
> >  CFLAGS="-Werror"
> >  SPARSE_FLAGS=""
> >  EXTRA_OPTS=""
> > +TARGET="x86_64-native-linuxapp-gcc"
> >
> >  function install_kernel()
> >  {
> > @@ -66,7 +67,11 @@ function install_dpdk()
> >      find ./ -type f | xargs sed -i 's/-Werror/-Werror -Wno-
> error=inline/'
> >      echo 'CONFIG_RTE_BUILD_FPIC=y' >>config/common_linuxapp
> >      sed -ri '/EXECENV_CFLAGS  = -pthread -fPIC/{s/$/\nelse ifeq
> ($(CONFIG_RTE_BUILD_FPIC),y)/;s/$/\nEXECENV_CFLAGS  = -pthread -fPIC/}'
> mk/exec-env/linuxapp/rte.vars.mk
> > -    make config CC=gcc T=x86_64-native-linuxapp-gcc
> > +    if [ "$DPDK_SHARED" ]; then
> > +        sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/'
> config/common_base
> > +        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib
> > +    fi
> > +    make config CC=gcc T=$TARGET
> >      make CC=gcc RTE_KERNELDIR=$KERNELSRC
> >      echo "Installed DPDK source in $(pwd)"
> >      cd ..
> > @@ -77,11 +82,11 @@ function configure_ovs()
> >      ./boot.sh && ./configure $*
> >  }
> >
> > -if [ "$KERNEL" ] || [ "$DPDK" ]; then
> > +if [ "$KERNEL" ] || [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
> >      install_kernel $KERNEL
> >  fi
> >
> > -if [ "$DPDK" ]; then
> > +if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
> >      if [ -z "$DPDK_VER" ]; then
> >          DPDK_VER="17.11.4"
> >      fi
> >
Ben Pfaff Jan. 16, 2019, 5:19 p.m. | #5
On Wed, Jan 16, 2019 at 05:05:24PM +0000, Stokes, Ian wrote:
> > On 11/09/2018 02:02 PM, Ian Stokes wrote:
> > > Add travis builds for DPDK as a shared library.
> > >
> > > Currently the DPDK builds in travis only compile DPDK as a static
> > library.
> > > With static builds in DPDK there is a risk that if a function is not
> > > exported then it will not be supported when DPDK is used as a shared
> > library.
> > > This commit adds the option to build DPDK as a shared library. Also
> > > two build jobs are added to the travis.yml whereby a shared DPDK is
> > > built with both static and shared OVS libraries.
> > >
> > > Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> > > ---
> > 
> > Acked-by: Kevin Traynor <ktraynor@redhat.com>
> 
> Thanks for reviewing and ACKING.
> 
> As this is quite useful testcase I'm considering pushing to master for 2.11 and also backporting (to at least OVS 2.10 and 2.9 as they use a different DPDK where function mapping may differ and hence be missed without this test).
> 
> @Ben, although this is a v1, is this ok for me to rebase and push to master for 2.11?

Seems reasonable to me.
Ian Stokes Jan. 16, 2019, 5:48 p.m. | #6
> On Wed, Jan 16, 2019 at 05:05:24PM +0000, Stokes, Ian wrote:
> > > On 11/09/2018 02:02 PM, Ian Stokes wrote:
> > > > Add travis builds for DPDK as a shared library.
> > > >
> > > > Currently the DPDK builds in travis only compile DPDK as a static
> > > library.
> > > > With static builds in DPDK there is a risk that if a function is
> > > > not exported then it will not be supported when DPDK is used as a
> > > > shared
> > > library.
> > > > This commit adds the option to build DPDK as a shared library.
> > > > Also two build jobs are added to the travis.yml whereby a shared
> > > > DPDK is built with both static and shared OVS libraries.
> > > >
> > > > Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> > > > ---
> > >
> > > Acked-by: Kevin Traynor <ktraynor@redhat.com>
> >
> > Thanks for reviewing and ACKING.
> >
> > As this is quite useful testcase I'm considering pushing to master for
> 2.11 and also backporting (to at least OVS 2.10 and 2.9 as they use a
> different DPDK where function mapping may differ and hence be missed
> without this test).
> >
> > @Ben, although this is a v1, is this ok for me to rebase and push to
> master for 2.11?
> 
> Seems reasonable to me.

Thanks, I've pushed this to master.

Ian

Patch

diff --git a/.travis.yml b/.travis.yml
index a2ef8bde5..b74ba2bfd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,6 +35,8 @@  env:
   - BUILD_ENV="-m32" OPTS="--disable-ssl"
   - KERNEL=3.16.54 DPDK=1
   - KERNEL=3.16.54 DPDK=1 OPTS="--enable-shared"
+  - KERNEL=3.16.54 DPDK_SHARED=1
+  - KERNEL=3.16.54 DPDK_SHARED=1 OPTS="--enable-shared"
   - KERNEL=4.17.14
   - KERNEL=4.16.18
   - KERNEL=4.15.18
diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 1fe5bbfa9..e9bfb72ff 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -6,6 +6,7 @@  KERNELSRC=""
 CFLAGS="-Werror"
 SPARSE_FLAGS=""
 EXTRA_OPTS=""
+TARGET="x86_64-native-linuxapp-gcc"
 
 function install_kernel()
 {
@@ -66,7 +67,11 @@  function install_dpdk()
     find ./ -type f | xargs sed -i 's/-Werror/-Werror -Wno-error=inline/'
     echo 'CONFIG_RTE_BUILD_FPIC=y' >>config/common_linuxapp
     sed -ri '/EXECENV_CFLAGS  = -pthread -fPIC/{s/$/\nelse ifeq ($(CONFIG_RTE_BUILD_FPIC),y)/;s/$/\nEXECENV_CFLAGS  = -pthread -fPIC/}' mk/exec-env/linuxapp/rte.vars.mk
-    make config CC=gcc T=x86_64-native-linuxapp-gcc
+    if [ "$DPDK_SHARED" ]; then
+        sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/' config/common_base
+        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib
+    fi
+    make config CC=gcc T=$TARGET
     make CC=gcc RTE_KERNELDIR=$KERNELSRC
     echo "Installed DPDK source in $(pwd)"
     cd ..
@@ -77,11 +82,11 @@  function configure_ovs()
     ./boot.sh && ./configure $*
 }
 
-if [ "$KERNEL" ] || [ "$DPDK" ]; then
+if [ "$KERNEL" ] || [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
     install_kernel $KERNEL
 fi
 
-if [ "$DPDK" ]; then
+if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then
     if [ -z "$DPDK_VER" ]; then
         DPDK_VER="17.11.4"
     fi