um: Add back support for extra userspace libraries
diff mbox series

Message ID 20191016141312.15684-1-anton.ivanov@cambridgegreys.com
State New
Headers show
Series
  • um: Add back support for extra userspace libraries
Related show

Commit Message

Anton Ivanov Oct. 16, 2019, 2:13 p.m. UTC
PCAP and VDE network transports require linking with userspace
libraries. The current build system has no means of passing these
as arguments.

This patch adds a script to expand the library list for linking
for these transports as well as any future driver that needs to
rely on additional libraries on the userspace side.

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 arch/um/scripts/extra-libs.sh | 10 ++++++++++
 scripts/link-vmlinux.sh       |  4 +++-
 2 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 arch/um/scripts/extra-libs.sh

Comments

Ritesh Raj Sarraf Oct. 17, 2019, 11:32 a.m. UTC | #1
Hello Anton,

Thank you so much for working on this fix. I tested this patch and it
works. Some comments below though.

On Wed, 2019-10-16 at 15:13 +0100, Anton Ivanov wrote:
> PCAP and VDE network transports require linking with userspace
> libraries. The current build system has no means of passing these
> as arguments.
> 
> This patch adds a script to expand the library list for linking
> for these transports as well as any future driver that needs to
> rely on additional libraries on the userspace side.
> 
> Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
> ---
>  arch/um/scripts/extra-libs.sh | 10 ++++++++++
>  scripts/link-vmlinux.sh       |  4 +++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
>  create mode 100644 arch/um/scripts/extra-libs.sh
> 
> diff --git a/arch/um/scripts/extra-libs.sh b/arch/um/scripts/extra-
> libs.sh
> new file mode 100644
> index 000000000000..0592485e0675
> --- /dev/null
> +++ b/arch/um/scripts/extra-libs.sh
> @@ -0,0 +1,10 @@
> +#!/bin/sh
> +
> +# This file should be included from link-vmlinux, not executed!!!
> +
> +if [ "${CONFIG_UML_NET_VDE}" = "y" ] ; then
> +	UML_EXTRA_LIBS="$UML_EXTRA_LIBS -lvde -lvdeplug"
> +fi
> +if [ "${CONFIG_UML_NET_PCAP}" = "y" ] ; then
> +	UML_EXTRA_LIBS="$UML_EXTRA_LIBS -lpcap"
> +fi

-lvde is not understood. I added the build dependency to libvde-dev on
Debian but that still did not help. 

So instead I dropped it to get the build going. And my tests about
networking look fine.

The revised patch that I'm using is attached with this email.


> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 06495379fcd8..15f9e5096da0 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -90,11 +90,13 @@ vmlinux_link()
>  			-Wl,--end-group				\
>  			${@}"
>  
> +		. arch/um/scripts/extra-libs.sh
> +
>  		${CC} ${CFLAGS_vmlinux}				\
>  			-o ${output}				\
>  			-Wl,-T,${lds}				\
>  			${objects}				\
> -			-lutil -lrt -lpthread
> +			-lutil -lrt -lpthread ${UML_EXTRA_LIBS}
>  		rm -f linux
>  	fi
>  }

Patch
diff mbox series

diff --git a/arch/um/scripts/extra-libs.sh b/arch/um/scripts/extra-libs.sh
new file mode 100644
index 000000000000..0592485e0675
--- /dev/null
+++ b/arch/um/scripts/extra-libs.sh
@@ -0,0 +1,10 @@ 
+#!/bin/sh
+
+# This file should be included from link-vmlinux, not executed!!!
+
+if [ "${CONFIG_UML_NET_VDE}" = "y" ] ; then
+	UML_EXTRA_LIBS="$UML_EXTRA_LIBS -lvde -lvdeplug"
+fi
+if [ "${CONFIG_UML_NET_PCAP}" = "y" ] ; then
+	UML_EXTRA_LIBS="$UML_EXTRA_LIBS -lpcap"
+fi
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 06495379fcd8..15f9e5096da0 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -90,11 +90,13 @@  vmlinux_link()
 			-Wl,--end-group				\
 			${@}"
 
+		. arch/um/scripts/extra-libs.sh
+
 		${CC} ${CFLAGS_vmlinux}				\
 			-o ${output}				\
 			-Wl,-T,${lds}				\
 			${objects}				\
-			-lutil -lrt -lpthread
+			-lutil -lrt -lpthread ${UML_EXTRA_LIBS}
 		rm -f linux
 	fi
 }