diff mbox series

Generate shared IPC library and link executables against it

Message ID 20201027153813.1741603-1-sava.jakovljev@teufel.de
State Changes Requested
Headers show
Series Generate shared IPC library and link executables against it | expand

Commit Message

Sava Jakovljev Oct. 27, 2020, 3:38 p.m. UTC
Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de>
---
 Makefile     | 53 +++++++++++++++++++++++++++++++++++++++-------------
 ipc/Makefile |  2 +-
 2 files changed, 41 insertions(+), 14 deletions(-)

Comments

Stefano Babic Oct. 28, 2020, 7:54 p.m. UTC | #1
Hi Sava,

On 27.10.20 16:38, Sava Jakovljev wrote:
> Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de>
> ---
>   Makefile     | 53 +++++++++++++++++++++++++++++++++++++++-------------
>   ipc/Makefile |  2 +-
>   2 files changed, 41 insertions(+), 14 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index a94c50d..a3ea9b3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -4,6 +4,8 @@ SUBLEVEL = 0
>   EXTRAVERSION =
>   NAME =
>   
> +IPCLIB_VERSION = 0.1
> +
>   # *DOCUMENTATION*
>   # To see a list of typical targets execute "make help"
>   # More info can be located in ./README
> @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
>   # Defaults to vmlinux, but the arch makefile usually adds further targets
>   
>   objs-y		:= core handlers
> -libs-y		:= corelib ipc mongoose parser suricatta bootloader
> +libs-y		:= corelib mongoose parser suricatta bootloader
>   shareds-y	:= bindings
>   tools-y		:= tools
>    > +ipc-y		:= ipc
> +ipc-lib 	:= $(patsubst %,%/built-in.o, $(ipc-y))
> +ipc-dirs 	:= $(ipc-y)
> +
> +swupdate-ipc-lib 	:= libswupdate_ipc.so.${IPCLIB_VERSION}
> +
>   swupdate-dirs	:= $(objs-y) $(libs-y)
>   swupdate-objs	:= $(patsubst %,%/built-in.o, $(objs-y))
>   swupdate-libs	:= $(patsubst %,%/lib.a, $(libs-y))
> @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD      $@
>         "$@" \
>         "$(CC)" \
>         "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> -      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> +      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>         "$(swupdate-objs)" \
>         "$(swupdate-libs)" \
> -      "$(LDLIBS)"
> +	  "$(LDLIBS) :${swupdate-ipc-lib}"
>   
> -swupdate_unstripped: $(swupdate-all) FORCE
> +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
>   	$(call if_changed,swupdate)
>   
>   quiet_cmd_addon = LD      $@
> @@ -413,10 +421,10 @@ quiet_cmd_addon = LD      $@
>         "$@" \
>         "$(CC)" \
>         "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> -      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> +      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>         "$(2)" \
>         "$(swupdate-libs)" \
> -      "$(LDLIBS)"
> +	  "$(LDLIBS) :${swupdate-ipc-lib}"
>   
>   quiet_cmd_shared = LD      $@
>         cmd_shared = $(srctree)/scripts/trylink \
> @@ -424,13 +432,28 @@ quiet_cmd_shared = LD      $@
>         "$(CC)" \
>         "-shared -Wl,-soname,$@" \
>         "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> +      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> +      "$(shared-libs)" \
> +	  "" \
> +	  "$(LDLIBS) :${swupdate-ipc-lib}"
> +
> +quiet_cmd_ipclib = LD      $@
> +      cmd_ipclib = $(srctree)/scripts/trylink \
> +      "$@" \
> +      "$(CC)" \
> +      "-shared -Wl,-soname,$@" \
> +      "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>         "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> -      "$(shared-libs) ipc/lib.a" \
> +      "$(ipc-lib)" \
> +	  "" \
>         "$(LDLIBS)"

This is quite a duplication of the same command.

It looks to me there is too much overhead. This patch drops the static 
library, why ? Static (as -dev package) and shared library should be 
both available. If this solves your problem having a shared library 
without Lua, it creates issues for all of users (the majority) that do 
not need the library. I have the feeling this breaks build on Yocto and 
maybe on Buildroot, too.

>   
> -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
> +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
>   	$(call if_changed,shared)
>   
> +${swupdate-ipc-lib}: $(ipc-lib) FORCE
> +	$(call if_changed,ipclib)
> +
>   ifeq ($(SKIP_STRIP),y)
>   quiet_cmd_strip = echo $@
>   cmd_strip = cp $@_unstripped $@
> @@ -443,7 +466,7 @@ endif
>   swupdate: cfg-sanity-check swupdate_unstripped
>   	$(call cmd,strip)
>   
> -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
> +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs} FORCE
>   	$(call if_changed,addon,$@.o)
>   	@mv $@ $@_unstripped
>   	$(call cmd,strip)
> @@ -459,7 +482,8 @@ install: all
>   	install -m 0644 $(srctree)/include/network_ipc.h ${DESTDIR}/${INCLUDEDIR}
>   	install -m 0644 $(srctree)/include/swupdate_status.h ${DESTDIR}/${INCLUDEDIR}
>   	install -m 0644 $(srctree)/include/progress_ipc.h ${DESTDIR}/${INCLUDEDIR}
> -	install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
> +	install -m 0755 $(srctree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
> +	ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
>   	if [ $(HAVE_LUA) = y ]; then \
>   		install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
>   		install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
> @@ -481,6 +505,7 @@ test:
>   $(sort $(swupdate-all)): $(swupdate-dirs) ;
>   $(sort $(tools-all)): $(tools-dirs) ;
>   $(sort $(shared-all)): $(shared-dirs) ;
> +$(sort $(ipc-lib)): $(ipc-dirs) ;
>   
>   # Handle descending into subdirectories listed in $(vmlinux-dirs)
>   # Preset locale variables to speed up the build process. Limit locale
> @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
>   # make menuconfig etc.
>   # Error messages still appears in the original language
>   
> -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
> +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
>   $(swupdate-dirs): scripts
>   	$(Q)$(MAKE) $(build)=$@
>   $(tools-dirs): scripts
>   	$(Q)$(MAKE) $(build)=$@
>   $(shared-dirs): scripts
>   	$(Q)$(MAKE) $(build)=$@
> +$(ipc-dirs): scripts
> +	$(Q)$(MAKE) $(build)=$@
>   
>   ###
>   # Cleaning is done on three levels.
> @@ -505,7 +532,7 @@ $(shared-dirs): scripts
>   
>   # Directories & files removed with 'make clean'
>   CLEAN_DIRS  +=
> -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* ${tools-bins} \
> +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* libswupdate_ipc* ${tools-bins} \
>   	$(patsubst %,%_unstripped,$(tools-bins)) \
>   	$(patsubst %,%.out,$(tools-bins)) \
>   	$(patsubst %,%.map,$(tools-bins)) \
> @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
>   #
>   clean: rm-dirs  := $(CLEAN_DIRS)
>   clean: rm-files := $(CLEAN_FILES)
> -clean-dirs      := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
> +clean-dirs      := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs) $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
>   
>   PHONY += $(clean-dirs) clean archclean
>   $(clean-dirs):
> diff --git a/ipc/Makefile b/ipc/Makefile
> index 5c12d3d..f634dce 100644
> --- a/ipc/Makefile
> +++ b/ipc/Makefile
> @@ -1,6 +1,6 @@
>   # Copyright (C) 2014-2018 Stefano Babic <sbabic@denx.de>
>   #
>   # SPDX-License-Identifier:     GPL-2.0-or-later
> -lib-y			+= network_ipc.o network_ipc-if.o progress_ipc.o
> +obj-y			+= network_ipc.o network_ipc-if.o progress_ipc.o
>   
>   EXTRA_CFLAGS += -fPIC
> 

Best regards,
Stefano Babic
Sava Jakovljev Oct. 29, 2020, 12:23 p.m. UTC | #2
Hello Stefano,


Why would we keep the static library? What is the benefit? Sure, the 
library is quite small, but nevertheless, in that way, there is code 
duplication in all of swupdate processes.
How would other users be affected by switching to a shared library? We use 
it with vanilla meta-swupdate layer and it works. It doesn't break anything.
There are also legal implications - having a static library licensed under 
LGPL is not a good option for external programs that want to use IPC. 
Of course, there is workaround for that - don't use the library and 
implement IPC manually - but I'm more biased towards having a library used, 
because it is tested and proven.

Of course, I would like few more people to test it, but I don't see how 
this could cause problems. Older binaries will still be working, since they 
linked the linked the library statically, newer will use the shared library.

Cheers,
Best regards,
Sava Jakovljev
Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43 UTC+1:

> Hi Sava,
>
> On 27.10.20 16:38, Sava Jakovljev wrote:
> > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
> > ---
> > Makefile | 53 +++++++++++++++++++++++++++++++++++++++-------------
> > ipc/Makefile | 2 +-
> > 2 files changed, 41 insertions(+), 14 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index a94c50d..a3ea9b3 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -4,6 +4,8 @@ SUBLEVEL = 0
> > EXTRAVERSION =
> > NAME =
> > 
> > +IPCLIB_VERSION = 0.1
> > +
> > # *DOCUMENTATION*
> > # To see a list of typical targets execute "make help"
> > # More info can be located in ./README
> > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
> > # Defaults to vmlinux, but the arch makefile usually adds further targets
> > 
> > objs-y := core handlers
> > -libs-y := corelib ipc mongoose parser suricatta bootloader
> > +libs-y := corelib mongoose parser suricatta bootloader
> > shareds-y := bindings
> > tools-y := tools
> > > +ipc-y := ipc
> > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
> > +ipc-dirs := $(ipc-y)
> > +
> > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
> > +
> > swupdate-dirs := $(objs-y) $(libs-y)
> > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
> > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
> > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
> > "$@" \
> > "$(CC)" \
> > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > "$(swupdate-objs)" \
> > "$(swupdate-libs)" \
> > - "$(LDLIBS)"
> > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > 
> > -swupdate_unstripped: $(swupdate-all) FORCE
> > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
> > $(call if_changed,swupdate)
> > 
> > quiet_cmd_addon = LD $@
> > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
> > "$@" \
> > "$(CC)" \
> > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > "$(2)" \
> > "$(swupdate-libs)" \
> > - "$(LDLIBS)"
> > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > 
> > quiet_cmd_shared = LD $@
> > cmd_shared = $(srctree)/scripts/trylink \
> > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
> > "$(CC)" \
> > "-shared -Wl,-soname,$@" \
> > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > + "$(shared-libs)" \
> > + "" \
> > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > +
> > +quiet_cmd_ipclib = LD $@
> > + cmd_ipclib = $(srctree)/scripts/trylink \
> > + "$@" \
> > + "$(CC)" \
> > + "-shared -Wl,-soname,$@" \
> > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > - "$(shared-libs) ipc/lib.a" \
> > + "$(ipc-lib)" \
> > + "" \
> > "$(LDLIBS)"
>
> This is quite a duplication of the same command.
>
> It looks to me there is too much overhead. This patch drops the static 
> library, why ? Static (as -dev package) and shared library should be 
> both available. If this solves your problem having a shared library 
> without Lua, it creates issues for all of users (the majority) that do 
> not need the library. I have the feeling this breaks build on Yocto and 
> maybe on Buildroot, too.
>
> > 
> > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
> > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
> > $(call if_changed,shared)
> > 
> > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
> > + $(call if_changed,ipclib)
> > +
> > ifeq ($(SKIP_STRIP),y)
> > quiet_cmd_strip = echo $@
> > cmd_strip = cp $@_unstripped $@
> > @@ -443,7 +466,7 @@ endif
> > swupdate: cfg-sanity-check swupdate_unstripped
> > $(call cmd,strip)
> > 
> > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
> > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs} FORCE
> > $(call if_changed,addon,$@.o)
> > @mv $@ $@_unstripped
> > $(call cmd,strip)
> > @@ -459,7 +482,8 @@ install: all
> > install -m 0644 $(srctree)/include/network_ipc.h ${DESTDIR}/${INCLUDEDIR}
> > install -m 0644 $(srctree)/include/swupdate_status.h 
> ${DESTDIR}/${INCLUDEDIR}
> > install -m 0644 $(srctree)/include/progress_ipc.h 
> ${DESTDIR}/${INCLUDEDIR}
> > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
> > + install -m 0755 $(srctree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
> > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib} 
> ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
> > if [ $(HAVE_LUA) = y ]; then \
> > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
> > install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
> > @@ -481,6 +505,7 @@ test:
> > $(sort $(swupdate-all)): $(swupdate-dirs) ;
> > $(sort $(tools-all)): $(tools-dirs) ;
> > $(sort $(shared-all)): $(shared-dirs) ;
> > +$(sort $(ipc-lib)): $(ipc-dirs) ;
> > 
> > # Handle descending into subdirectories listed in $(vmlinux-dirs)
> > # Preset locale variables to speed up the build process. Limit locale
> > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
> > # make menuconfig etc.
> > # Error messages still appears in the original language
> > 
> > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
> > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
> > $(swupdate-dirs): scripts
> > $(Q)$(MAKE) $(build)=$@
> > $(tools-dirs): scripts
> > $(Q)$(MAKE) $(build)=$@
> > $(shared-dirs): scripts
> > $(Q)$(MAKE) $(build)=$@
> > +$(ipc-dirs): scripts
> > + $(Q)$(MAKE) $(build)=$@
> > 
> > ###
> > # Cleaning is done on three levels.
> > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
> > 
> > # Directories & files removed with 'make clean'
> > CLEAN_DIRS +=
> > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* 
> ${tools-bins} \
> > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* 
> libswupdate_ipc* ${tools-bins} \
> > $(patsubst %,%_unstripped,$(tools-bins)) \
> > $(patsubst %,%.out,$(tools-bins)) \
> > $(patsubst %,%.map,$(tools-bins)) \
> > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags TAGS 
> cscope* GPATH GTAGS GRTAGS GSYMS
> > #
> > clean: rm-dirs := $(CLEAN_DIRS)
> > clean: rm-files := $(CLEAN_FILES)
> > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs) 
> $(shared-dirs) scripts/acceptance-tests)
> > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs) 
> $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
> > 
> > PHONY += $(clean-dirs) clean archclean
> > $(clean-dirs):
> > diff --git a/ipc/Makefile b/ipc/Makefile
> > index 5c12d3d..f634dce 100644
> > --- a/ipc/Makefile
> > +++ b/ipc/Makefile
> > @@ -1,6 +1,6 @@
> > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
> > #
> > # SPDX-License-Identifier: GPL-2.0-or-later
> > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > 
> > EXTRA_CFLAGS += -fPIC
> > 
>
> Best regards,
> Stefano Babic
>
> -- 
> =====================================================================
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 <+49%208142%206698953> Fax: +49-8142-66989-80 
> <+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
Stefano Babic Oct. 29, 2020, 4:11 p.m. UTC | #3
Hi Sava,

On 29.10.20 13:23, Sava Jakovljev wrote:
> Hello Stefano,
> 
> 
> Why would we keep the static library? What is the benefit?

Well, most packages provide both static and shared library. It is a
choice for the developer to decide.

The proble here is a sort of uncompatibility in case a new SWUpdate is
used with an old release - this is not officially supported, but let's
say, there are people (and more important, customers..) asking to switch
to new version of package without switching to newer OE. And the shared
library is not installed on older OE, it adds some more hassle.

> Sure, the
> library is quite small, but nevertheless, in that way, there is code
> duplication in all of swupdate processes.

I understand your topic, I want to have a solution with as less breakage
as possible. I will send briefly a patch as proposal to support the
shared library with less changes, we can discuss afterwards.

> How would other users be affected by switching to a shared library?

See above

> We
> use it with vanilla meta-swupdate layer and it works.

Exactly what I meant before, apoart of other use cases with weird
combinations.

> It doesn't break
> anything.
> There are also legal implications - having a static library licensed
> under LGPL is not a good option for external programs that want to use IPC.

This is new and I do not think you're right. License is set by the
author of software, independently if you link a static or dynamic library.

> Of course, there is workaround for that - don't use the library and
> implement IPC manually - but I'm more biased towards having a library
> used, because it is tested and proven.
> 
> Of course, I would like few more people to test it, but I don't see how
> this could cause problems. Older binaries will still be working, since
> they linked the linked the library statically, newer will use the shared
> library.

If the world could be so simple....

Best regards,
Stefano Babic

> 
> Cheers,
> Best regards,
> Sava Jakovljev
> Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43 UTC+1:
> 
>     Hi Sava,
> 
>     On 27.10.20 16:38, Sava Jakovljev wrote:
>     > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
>     > ---
>     > Makefile | 53 +++++++++++++++++++++++++++++++++++++++-------------
>     > ipc/Makefile | 2 +-
>     > 2 files changed, 41 insertions(+), 14 deletions(-)
>     >
>     > diff --git a/Makefile b/Makefile
>     > index a94c50d..a3ea9b3 100644
>     > --- a/Makefile
>     > +++ b/Makefile
>     > @@ -4,6 +4,8 @@ SUBLEVEL = 0
>     > EXTRAVERSION =
>     > NAME =
>     >
>     > +IPCLIB_VERSION = 0.1
>     > +
>     > # *DOCUMENTATION*
>     > # To see a list of typical targets execute "make help"
>     > # More info can be located in ./README
>     > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
>     > # Defaults to vmlinux, but the arch makefile usually adds further
>     targets
>     >
>     > objs-y := core handlers
>     > -libs-y := corelib ipc mongoose parser suricatta bootloader
>     > +libs-y := corelib mongoose parser suricatta bootloader
>     > shareds-y := bindings
>     > tools-y := tools
>     > > +ipc-y := ipc
>     > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
>     > +ipc-dirs := $(ipc-y)
>     > +
>     > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
>     > +
>     > swupdate-dirs := $(objs-y) $(libs-y)
>     > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
>     > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
>     > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
>     > "$@" \
>     > "$(CC)" \
>     > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>     > "$(swupdate-objs)" \
>     > "$(swupdate-libs)" \
>     > - "$(LDLIBS)"
>     > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     >
>     > -swupdate_unstripped: $(swupdate-all) FORCE
>     > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
>     > $(call if_changed,swupdate)
>     >
>     > quiet_cmd_addon = LD $@
>     > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
>     > "$@" \
>     > "$(CC)" \
>     > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>     > "$(2)" \
>     > "$(swupdate-libs)" \
>     > - "$(LDLIBS)"
>     > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     >
>     > quiet_cmd_shared = LD $@
>     > cmd_shared = $(srctree)/scripts/trylink \
>     > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
>     > "$(CC)" \
>     > "-shared -Wl,-soname,$@" \
>     > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>     > + "$(shared-libs)" \
>     > + "" \
>     > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > +
>     > +quiet_cmd_ipclib = LD $@
>     > + cmd_ipclib = $(srctree)/scripts/trylink \
>     > + "$@" \
>     > + "$(CC)" \
>     > + "-shared -Wl,-soname,$@" \
>     > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > - "$(shared-libs) ipc/lib.a" \
>     > + "$(ipc-lib)" \
>     > + "" \
>     > "$(LDLIBS)"
> 
>     This is quite a duplication of the same command.
> 
>     It looks to me there is too much overhead. This patch drops the static
>     library, why ? Static (as -dev package) and shared library should be
>     both available. If this solves your problem having a shared library
>     without Lua, it creates issues for all of users (the majority) that do
>     not need the library. I have the feeling this breaks build on Yocto and
>     maybe on Buildroot, too.
> 
>     >
>     > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
>     > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
>     > $(call if_changed,shared)
>     >
>     > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
>     > + $(call if_changed,ipclib)
>     > +
>     > ifeq ($(SKIP_STRIP),y)
>     > quiet_cmd_strip = echo $@
>     > cmd_strip = cp $@_unstripped $@
>     > @@ -443,7 +466,7 @@ endif
>     > swupdate: cfg-sanity-check swupdate_unstripped
>     > $(call cmd,strip)
>     >
>     > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
>     > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs}
>     FORCE
>     > $(call if_changed,addon,$@.o)
>     > @mv $@ $@_unstripped
>     > $(call cmd,strip)
>     > @@ -459,7 +482,8 @@ install: all
>     > install -m 0644 $(srctree)/include/network_ipc.h
>     ${DESTDIR}/${INCLUDEDIR}
>     > install -m 0644 $(srctree)/include/swupdate_status.h
>     ${DESTDIR}/${INCLUDEDIR}
>     > install -m 0644 $(srctree)/include/progress_ipc.h
>     ${DESTDIR}/${INCLUDEDIR}
>     > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
>     > + install -m 0755 $(srctree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
>     > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
>     ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
>     > if [ $(HAVE_LUA) = y ]; then \
>     > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
>     > install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
>     > @@ -481,6 +505,7 @@ test:
>     > $(sort $(swupdate-all)): $(swupdate-dirs) ;
>     > $(sort $(tools-all)): $(tools-dirs) ;
>     > $(sort $(shared-all)): $(shared-dirs) ;
>     > +$(sort $(ipc-lib)): $(ipc-dirs) ;
>     >
>     > # Handle descending into subdirectories listed in $(vmlinux-dirs)
>     > # Preset locale variables to speed up the build process. Limit locale
>     > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
>     > # make menuconfig etc.
>     > # Error messages still appears in the original language
>     >
>     > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
>     > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
>     > $(swupdate-dirs): scripts
>     > $(Q)$(MAKE) $(build)=$@
>     > $(tools-dirs): scripts
>     > $(Q)$(MAKE) $(build)=$@
>     > $(shared-dirs): scripts
>     > $(Q)$(MAKE) $(build)=$@
>     > +$(ipc-dirs): scripts
>     > + $(Q)$(MAKE) $(build)=$@
>     >
>     > ###
>     > # Cleaning is done on three levels.
>     > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
>     >
>     > # Directories & files removed with 'make clean'
>     > CLEAN_DIRS +=
>     > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>     ${tools-bins} \
>     > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>     libswupdate_ipc* ${tools-bins} \
>     > $(patsubst %,%_unstripped,$(tools-bins)) \
>     > $(patsubst %,%.out,$(tools-bins)) \
>     > $(patsubst %,%.map,$(tools-bins)) \
>     > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags
>     TAGS cscope* GPATH GTAGS GRTAGS GSYMS
>     > #
>     > clean: rm-dirs := $(CLEAN_DIRS)
>     > clean: rm-files := $(CLEAN_FILES)
>     > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs)
>     $(shared-dirs) scripts/acceptance-tests)
>     > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs)
>     $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
>     >
>     > PHONY += $(clean-dirs) clean archclean
>     > $(clean-dirs):
>     > diff --git a/ipc/Makefile b/ipc/Makefile
>     > index 5c12d3d..f634dce 100644
>     > --- a/ipc/Makefile
>     > +++ b/ipc/Makefile
>     > @@ -1,6 +1,6 @@
>     > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
>     > #
>     > # SPDX-License-Identifier: GPL-2.0-or-later
>     > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
>     > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
>     >
>     > EXTRA_CFLAGS += -fPIC
>     >
> 
>     Best regards,
>     Stefano Babic
> 
>     -- 
>     =====================================================================
>     DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>     Phone: +49-8142-66989-53 <tel:+49%208142%206698953> Fax:
>     +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>     =====================================================================
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Sava Jakovljev Oct. 29, 2020, 4:18 p.m. UTC | #4
HI Stefano,

No, the problems with linking your proprietary licensed programs statically 
against LGPL libraries is a real one: your proprietary software then also 
falls under LGPL, as far as I know. Although, there is always some doubt 
when legal rules are interpreted by software guys (or anyone else, in that 
manner).

I understand that we need to make sure that there are no regressions from 
this - but I also don't see anything that is not solvable in more or less 
easy manner.
That's why I suggest a staged transition with a period of testing and 
consultation - of course, this is your project and you know best how you 
want to handle this - my stand-point is that it would make it more 
appealing and easier to use.

Thank you.
Cheers,
Sava Jakovljev
Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:11:23 UTC+1:

> Hi Sava,
>
> On 29.10.20 13:23, Sava Jakovljev wrote:
> > Hello Stefano,
> > 
> > 
> > Why would we keep the static library? What is the benefit?
>
> Well, most packages provide both static and shared library. It is a
> choice for the developer to decide.
>
> The proble here is a sort of uncompatibility in case a new SWUpdate is
> used with an old release - this is not officially supported, but let's
> say, there are people (and more important, customers..) asking to switch
> to new version of package without switching to newer OE. And the shared
> library is not installed on older OE, it adds some more hassle.
>
> > Sure, the
> > library is quite small, but nevertheless, in that way, there is code
> > duplication in all of swupdate processes.
>
> I understand your topic, I want to have a solution with as less breakage
> as possible. I will send briefly a patch as proposal to support the
> shared library with less changes, we can discuss afterwards.
>
> > How would other users be affected by switching to a shared library?
>
> See above
>
> > We
> > use it with vanilla meta-swupdate layer and it works.
>
> Exactly what I meant before, apoart of other use cases with weird
> combinations.
>
> > It doesn't break
> > anything.
> > There are also legal implications - having a static library licensed
> > under LGPL is not a good option for external programs that want to use 
> IPC.
>
> This is new and I do not think you're right. License is set by the
> author of software, independently if you link a static or dynamic library.
>
> > Of course, there is workaround for that - don't use the library and
> > implement IPC manually - but I'm more biased towards having a library
> > used, because it is tested and proven.
> > 
> > Of course, I would like few more people to test it, but I don't see how
> > this could cause problems. Older binaries will still be working, since
> > they linked the linked the library statically, newer will use the shared
> > library.
>
> If the world could be so simple....
>
> Best regards,
> Stefano Babic
>
> > 
> > Cheers,
> > Best regards,
> > Sava Jakovljev
> > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43 UTC+1:
> > 
> > Hi Sava,
> > 
> > On 27.10.20 16:38, Sava Jakovljev wrote:
> > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
> > > ---
> > > Makefile | 53 +++++++++++++++++++++++++++++++++++++++-------------
> > > ipc/Makefile | 2 +-
> > > 2 files changed, 41 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index a94c50d..a3ea9b3 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -4,6 +4,8 @@ SUBLEVEL = 0
> > > EXTRAVERSION =
> > > NAME =
> > >
> > > +IPCLIB_VERSION = 0.1
> > > +
> > > # *DOCUMENTATION*
> > > # To see a list of typical targets execute "make help"
> > > # More info can be located in ./README
> > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
> > > # Defaults to vmlinux, but the arch makefile usually adds further
> > targets
> > >
> > > objs-y := core handlers
> > > -libs-y := corelib ipc mongoose parser suricatta bootloader
> > > +libs-y := corelib mongoose parser suricatta bootloader
> > > shareds-y := bindings
> > > tools-y := tools
> > > > +ipc-y := ipc
> > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
> > > +ipc-dirs := $(ipc-y)
> > > +
> > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
> > > +
> > > swupdate-dirs := $(objs-y) $(libs-y)
> > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
> > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
> > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
> > > "$@" \
> > > "$(CC)" \
> > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > > "$(swupdate-objs)" \
> > > "$(swupdate-libs)" \
> > > - "$(LDLIBS)"
> > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > >
> > > -swupdate_unstripped: $(swupdate-all) FORCE
> > > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
> > > $(call if_changed,swupdate)
> > >
> > > quiet_cmd_addon = LD $@
> > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
> > > "$@" \
> > > "$(CC)" \
> > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > > "$(2)" \
> > > "$(swupdate-libs)" \
> > > - "$(LDLIBS)"
> > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > >
> > > quiet_cmd_shared = LD $@
> > > cmd_shared = $(srctree)/scripts/trylink \
> > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
> > > "$(CC)" \
> > > "-shared -Wl,-soname,$@" \
> > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > > + "$(shared-libs)" \
> > > + "" \
> > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > +
> > > +quiet_cmd_ipclib = LD $@
> > > + cmd_ipclib = $(srctree)/scripts/trylink \
> > > + "$@" \
> > > + "$(CC)" \
> > > + "-shared -Wl,-soname,$@" \
> > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > - "$(shared-libs) ipc/lib.a" \
> > > + "$(ipc-lib)" \
> > > + "" \
> > > "$(LDLIBS)"
> > 
> > This is quite a duplication of the same command.
> > 
> > It looks to me there is too much overhead. This patch drops the static
> > library, why ? Static (as -dev package) and shared library should be
> > both available. If this solves your problem having a shared library
> > without Lua, it creates issues for all of users (the majority) that do
> > not need the library. I have the feeling this breaks build on Yocto and
> > maybe on Buildroot, too.
> > 
> > >
> > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
> > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
> > > $(call if_changed,shared)
> > >
> > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
> > > + $(call if_changed,ipclib)
> > > +
> > > ifeq ($(SKIP_STRIP),y)
> > > quiet_cmd_strip = echo $@
> > > cmd_strip = cp $@_unstripped $@
> > > @@ -443,7 +466,7 @@ endif
> > > swupdate: cfg-sanity-check swupdate_unstripped
> > > $(call cmd,strip)
> > >
> > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
> > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs}
> > FORCE
> > > $(call if_changed,addon,$@.o)
> > > @mv $@ $@_unstripped
> > > $(call cmd,strip)
> > > @@ -459,7 +482,8 @@ install: all
> > > install -m 0644 $(srctree)/include/network_ipc.h
> > ${DESTDIR}/${INCLUDEDIR}
> > > install -m 0644 $(srctree)/include/swupdate_status.h
> > ${DESTDIR}/${INCLUDEDIR}
> > > install -m 0644 $(srctree)/include/progress_ipc.h
> > ${DESTDIR}/${INCLUDEDIR}
> > > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
> > > + install -m 0755 $(srctree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
> > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
> > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
> > > if [ $(HAVE_LUA) = y ]; then \
> > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
> > > install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
> > > @@ -481,6 +505,7 @@ test:
> > > $(sort $(swupdate-all)): $(swupdate-dirs) ;
> > > $(sort $(tools-all)): $(tools-dirs) ;
> > > $(sort $(shared-all)): $(shared-dirs) ;
> > > +$(sort $(ipc-lib)): $(ipc-dirs) ;
> > >
> > > # Handle descending into subdirectories listed in $(vmlinux-dirs)
> > > # Preset locale variables to speed up the build process. Limit locale
> > > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
> > > # make menuconfig etc.
> > > # Error messages still appears in the original language
> > >
> > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
> > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
> > > $(swupdate-dirs): scripts
> > > $(Q)$(MAKE) $(build)=$@
> > > $(tools-dirs): scripts
> > > $(Q)$(MAKE) $(build)=$@
> > > $(shared-dirs): scripts
> > > $(Q)$(MAKE) $(build)=$@
> > > +$(ipc-dirs): scripts
> > > + $(Q)$(MAKE) $(build)=$@
> > >
> > > ###
> > > # Cleaning is done on three levels.
> > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
> > >
> > > # Directories & files removed with 'make clean'
> > > CLEAN_DIRS +=
> > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
> > ${tools-bins} \
> > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
> > libswupdate_ipc* ${tools-bins} \
> > > $(patsubst %,%_unstripped,$(tools-bins)) \
> > > $(patsubst %,%.out,$(tools-bins)) \
> > > $(patsubst %,%.map,$(tools-bins)) \
> > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags
> > TAGS cscope* GPATH GTAGS GRTAGS GSYMS
> > > #
> > > clean: rm-dirs := $(CLEAN_DIRS)
> > > clean: rm-files := $(CLEAN_FILES)
> > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs)
> > $(shared-dirs) scripts/acceptance-tests)
> > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs)
> > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
> > >
> > > PHONY += $(clean-dirs) clean archclean
> > > $(clean-dirs):
> > > diff --git a/ipc/Makefile b/ipc/Makefile
> > > index 5c12d3d..f634dce 100644
> > > --- a/ipc/Makefile
> > > +++ b/ipc/Makefile
> > > @@ -1,6 +1,6 @@
> > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
> > > #
> > > # SPDX-License-Identifier: GPL-2.0-or-later
> > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > >
> > > EXTRA_CFLAGS += -fPIC
> > >
> > 
> > Best regards,
> > Stefano Babic
> > 
> > -- 
> > =====================================================================
> > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: +49-8142-66989-53 <+49%208142%206698953> 
> <tel:+49%208142%206698953> Fax:
> > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980> 
> Email: sba...@denx.de
> > =====================================================================
> > 
> > -- 
> > You received this message because you are subscribed to the Google
> > Groups "swupdate" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to swupdate+u...@googlegroups.com
> > <mailto:swupdate+u...@googlegroups.com>.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> -- 
> =====================================================================
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 <+49%208142%206698953> Fax: +49-8142-66989-80 
> <+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
Stefano Babic Oct. 29, 2020, 4:52 p.m. UTC | #5
Hi Sava,

On 29.10.20 17:18, Sava Jakovljev wrote:
> HI Stefano,
> 
> No, the problems with linking your proprietary licensed programs
> statically against LGPL libraries is a real one: your proprietary
> software then also falls under LGPL, as far as I know.

Not that there is no issue with static linking, but reading from here :

https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic

Your application remains proprietary and not LGPL. Anyway, (1) adds some
issue that are easy removed with the shared library.

> Although, there
> is always some doubt when legal rules are interpreted by software guys
> (or anyone else, in that manner).
> 
> I understand that we need to make sure that there are no regressions
> from this - but I also don't see anything that is not solvable in more
> or less easy manner.

Check my patch and see if this works for you.

> That's why I suggest a staged transition with a period of testing and
> consultation
> - of course, this is your project and you know best how you
> want to handle this - my stand-point is that it would make it more
> appealing and easier to use.

Best regards,
Stefano Babic

> 
> Thank you.
> Cheers,
> Sava Jakovljev
> Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:11:23 UTC+1:
> 
>     Hi Sava,
> 
>     On 29.10.20 13:23, Sava Jakovljev wrote:
>     > Hello Stefano,
>     >
>     >
>     > Why would we keep the static library? What is the benefit?
> 
>     Well, most packages provide both static and shared library. It is a
>     choice for the developer to decide.
> 
>     The proble here is a sort of uncompatibility in case a new SWUpdate is
>     used with an old release - this is not officially supported, but let's
>     say, there are people (and more important, customers..) asking to
>     switch
>     to new version of package without switching to newer OE. And the shared
>     library is not installed on older OE, it adds some more hassle.
> 
>     > Sure, the
>     > library is quite small, but nevertheless, in that way, there is code
>     > duplication in all of swupdate processes.
> 
>     I understand your topic, I want to have a solution with as less
>     breakage
>     as possible. I will send briefly a patch as proposal to support the
>     shared library with less changes, we can discuss afterwards.
> 
>     > How would other users be affected by switching to a shared library?
> 
>     See above
> 
>     > We
>     > use it with vanilla meta-swupdate layer and it works.
> 
>     Exactly what I meant before, apoart of other use cases with weird
>     combinations.
> 
>     > It doesn't break
>     > anything.
>     > There are also legal implications - having a static library licensed
>     > under LGPL is not a good option for external programs that want to
>     use IPC.
> 
>     This is new and I do not think you're right. License is set by the
>     author of software, independently if you link a static or dynamic
>     library.
> 
>     > Of course, there is workaround for that - don't use the library and
>     > implement IPC manually - but I'm more biased towards having a library
>     > used, because it is tested and proven.
>     >
>     > Of course, I would like few more people to test it, but I don't
>     see how
>     > this could cause problems. Older binaries will still be working,
>     since
>     > they linked the linked the library statically, newer will use the
>     shared
>     > library.
> 
>     If the world could be so simple....
> 
>     Best regards,
>     Stefano Babic
> 
>     >
>     > Cheers,
>     > Best regards,
>     > Sava Jakovljev
>     > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43
>     UTC+1:
>     >
>     > Hi Sava,
>     >
>     > On 27.10.20 16:38, Sava Jakovljev wrote:
>     > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
>     > > ---
>     > > Makefile | 53 +++++++++++++++++++++++++++++++++++++++-------------
>     > > ipc/Makefile | 2 +-
>     > > 2 files changed, 41 insertions(+), 14 deletions(-)
>     > >
>     > > diff --git a/Makefile b/Makefile
>     > > index a94c50d..a3ea9b3 100644
>     > > --- a/Makefile
>     > > +++ b/Makefile
>     > > @@ -4,6 +4,8 @@ SUBLEVEL = 0
>     > > EXTRAVERSION =
>     > > NAME =
>     > >
>     > > +IPCLIB_VERSION = 0.1
>     > > +
>     > > # *DOCUMENTATION*
>     > > # To see a list of typical targets execute "make help"
>     > > # More info can be located in ./README
>     > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
>     > > # Defaults to vmlinux, but the arch makefile usually adds further
>     > targets
>     > >
>     > > objs-y := core handlers
>     > > -libs-y := corelib ipc mongoose parser suricatta bootloader
>     > > +libs-y := corelib mongoose parser suricatta bootloader
>     > > shareds-y := bindings
>     > > tools-y := tools
>     > > > +ipc-y := ipc
>     > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
>     > > +ipc-dirs := $(ipc-y)
>     > > +
>     > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
>     > > +
>     > > swupdate-dirs := $(objs-y) $(libs-y)
>     > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
>     > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
>     > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
>     > > "$@" \
>     > > "$(CC)" \
>     > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>     > > "$(swupdate-objs)" \
>     > > "$(swupdate-libs)" \
>     > > - "$(LDLIBS)"
>     > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > >
>     > > -swupdate_unstripped: $(swupdate-all) FORCE
>     > > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
>     > > $(call if_changed,swupdate)
>     > >
>     > > quiet_cmd_addon = LD $@
>     > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
>     > > "$@" \
>     > > "$(CC)" \
>     > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>     > > "$(2)" \
>     > > "$(swupdate-libs)" \
>     > > - "$(LDLIBS)"
>     > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > >
>     > > quiet_cmd_shared = LD $@
>     > > cmd_shared = $(srctree)/scripts/trylink \
>     > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
>     > > "$(CC)" \
>     > > "-shared -Wl,-soname,$@" \
>     > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
>     > > + "$(shared-libs)" \
>     > > + "" \
>     > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > > +
>     > > +quiet_cmd_ipclib = LD $@
>     > > + cmd_ipclib = $(srctree)/scripts/trylink \
>     > > + "$@" \
>     > > + "$(CC)" \
>     > > + "-shared -Wl,-soname,$@" \
>     > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > > - "$(shared-libs) ipc/lib.a" \
>     > > + "$(ipc-lib)" \
>     > > + "" \
>     > > "$(LDLIBS)"
>     >
>     > This is quite a duplication of the same command.
>     >
>     > It looks to me there is too much overhead. This patch drops the
>     static
>     > library, why ? Static (as -dev package) and shared library should be
>     > both available. If this solves your problem having a shared library
>     > without Lua, it creates issues for all of users (the majority)
>     that do
>     > not need the library. I have the feeling this breaks build on
>     Yocto and
>     > maybe on Buildroot, too.
>     >
>     > >
>     > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
>     > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
>     > > $(call if_changed,shared)
>     > >
>     > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
>     > > + $(call if_changed,ipclib)
>     > > +
>     > > ifeq ($(SKIP_STRIP),y)
>     > > quiet_cmd_strip = echo $@
>     > > cmd_strip = cp $@_unstripped $@
>     > > @@ -443,7 +466,7 @@ endif
>     > > swupdate: cfg-sanity-check swupdate_unstripped
>     > > $(call cmd,strip)
>     > >
>     > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
>     > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs}
>     > FORCE
>     > > $(call if_changed,addon,$@.o)
>     > > @mv $@ $@_unstripped
>     > > $(call cmd,strip)
>     > > @@ -459,7 +482,8 @@ install: all
>     > > install -m 0644 $(srctree)/include/network_ipc.h
>     > ${DESTDIR}/${INCLUDEDIR}
>     > > install -m 0644 $(srctree)/include/swupdate_status.h
>     > ${DESTDIR}/${INCLUDEDIR}
>     > > install -m 0644 $(srctree)/include/progress_ipc.h
>     > ${DESTDIR}/${INCLUDEDIR}
>     > > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
>     > > + install -m 0755 $(srctree)/${swupdate-ipc-lib}
>     ${DESTDIR}/${LIBDIR}
>     > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
>     > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
>     > > if [ $(HAVE_LUA) = y ]; then \
>     > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
>     > > install -m 0755 ${lua_swupdate}
>     $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
>     > > @@ -481,6 +505,7 @@ test:
>     > > $(sort $(swupdate-all)): $(swupdate-dirs) ;
>     > > $(sort $(tools-all)): $(tools-dirs) ;
>     > > $(sort $(shared-all)): $(shared-dirs) ;
>     > > +$(sort $(ipc-lib)): $(ipc-dirs) ;
>     > >
>     > > # Handle descending into subdirectories listed in $(vmlinux-dirs)
>     > > # Preset locale variables to speed up the build process. Limit
>     locale
>     > > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
>     > > # make menuconfig etc.
>     > > # Error messages still appears in the original language
>     > >
>     > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
>     > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
>     > > $(swupdate-dirs): scripts
>     > > $(Q)$(MAKE) $(build)=$@
>     > > $(tools-dirs): scripts
>     > > $(Q)$(MAKE) $(build)=$@
>     > > $(shared-dirs): scripts
>     > > $(Q)$(MAKE) $(build)=$@
>     > > +$(ipc-dirs): scripts
>     > > + $(Q)$(MAKE) $(build)=$@
>     > >
>     > > ###
>     > > # Cleaning is done on three levels.
>     > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
>     > >
>     > > # Directories & files removed with 'make clean'
>     > > CLEAN_DIRS +=
>     > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>     > ${tools-bins} \
>     > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>     > libswupdate_ipc* ${tools-bins} \
>     > > $(patsubst %,%_unstripped,$(tools-bins)) \
>     > > $(patsubst %,%.out,$(tools-bins)) \
>     > > $(patsubst %,%.map,$(tools-bins)) \
>     > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags
>     > TAGS cscope* GPATH GTAGS GRTAGS GSYMS
>     > > #
>     > > clean: rm-dirs := $(CLEAN_DIRS)
>     > > clean: rm-files := $(CLEAN_FILES)
>     > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs)
>     > $(shared-dirs) scripts/acceptance-tests)
>     > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs)
>     > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
>     > >
>     > > PHONY += $(clean-dirs) clean archclean
>     > > $(clean-dirs):
>     > > diff --git a/ipc/Makefile b/ipc/Makefile
>     > > index 5c12d3d..f634dce 100644
>     > > --- a/ipc/Makefile
>     > > +++ b/ipc/Makefile
>     > > @@ -1,6 +1,6 @@
>     > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
>     > > #
>     > > # SPDX-License-Identifier: GPL-2.0-or-later
>     > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
>     > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
>     > >
>     > > EXTRA_CFLAGS += -fPIC
>     > >
>     >
>     > Best regards,
>     > Stefano Babic
>     >
>     > --
>     > =====================================================================
>     > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>     > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>     > Phone: +49-8142-66989-53 <tel:+49%208142%206698953>
>     <tel:+49%208142%206698953> Fax:
>     > +49-8142-66989-80 <tel:+49%208142%206698980>
>     <tel:+49%208142%206698980> Email: sba...@denx.de
>     > =====================================================================
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "swupdate" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to swupdate+u...@googlegroups.com
>     > <mailto:swupdate+u...@googlegroups.com>.
>     > To view this discussion on the web visit
>     >
>     https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> 
>     >
>     <https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> 
>     -- 
>     =====================================================================
>     DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>     Phone: +49-8142-66989-53 <tel:+49%208142%206698953> Fax:
>     +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>     =====================================================================
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Sava Jakovljev Oct. 29, 2020, 5:25 p.m. UTC | #6
Hi Stefano,

Yes, (1) imposes some restrictions that are best to be avoided. 
I'll check your patch and let you know - thank you for your effort - I'll 
come back to you regarding this ASAP.

Cheers,
Sava Jakovljev

Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:52:48 UTC+1:

> Hi Sava,
>
> On 29.10.20 17:18, Sava Jakovljev wrote:
> > HI Stefano,
> > 
> > No, the problems with linking your proprietary licensed programs
> > statically against LGPL libraries is a real one: your proprietary
> > software then also falls under LGPL, as far as I know.
>
> Not that there is no issue with static linking, but reading from here :
>
> https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic
>
> Your application remains proprietary and not LGPL. Anyway, (1) adds some
> issue that are easy removed with the shared library.
>
> > Although, there
> > is always some doubt when legal rules are interpreted by software guys
> > (or anyone else, in that manner).
> > 
> > I understand that we need to make sure that there are no regressions
> > from this - but I also don't see anything that is not solvable in more
> > or less easy manner.
>
> Check my patch and see if this works for you.
>
> > That's why I suggest a staged transition with a period of testing and
> > consultation
> > - of course, this is your project and you know best how you
> > want to handle this - my stand-point is that it would make it more
> > appealing and easier to use.
>
> Best regards,
> Stefano Babic
>
> > 
> > Thank you.
> > Cheers,
> > Sava Jakovljev
> > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:11:23 UTC+1:
> > 
> > Hi Sava,
> > 
> > On 29.10.20 13:23, Sava Jakovljev wrote:
> > > Hello Stefano,
> > >
> > >
> > > Why would we keep the static library? What is the benefit?
> > 
> > Well, most packages provide both static and shared library. It is a
> > choice for the developer to decide.
> > 
> > The proble here is a sort of uncompatibility in case a new SWUpdate is
> > used with an old release - this is not officially supported, but let's
> > say, there are people (and more important, customers..) asking to
> > switch
> > to new version of package without switching to newer OE. And the shared
> > library is not installed on older OE, it adds some more hassle.
> > 
> > > Sure, the
> > > library is quite small, but nevertheless, in that way, there is code
> > > duplication in all of swupdate processes.
> > 
> > I understand your topic, I want to have a solution with as less
> > breakage
> > as possible. I will send briefly a patch as proposal to support the
> > shared library with less changes, we can discuss afterwards.
> > 
> > > How would other users be affected by switching to a shared library?
> > 
> > See above
> > 
> > > We
> > > use it with vanilla meta-swupdate layer and it works.
> > 
> > Exactly what I meant before, apoart of other use cases with weird
> > combinations.
> > 
> > > It doesn't break
> > > anything.
> > > There are also legal implications - having a static library licensed
> > > under LGPL is not a good option for external programs that want to
> > use IPC.
> > 
> > This is new and I do not think you're right. License is set by the
> > author of software, independently if you link a static or dynamic
> > library.
> > 
> > > Of course, there is workaround for that - don't use the library and
> > > implement IPC manually - but I'm more biased towards having a library
> > > used, because it is tested and proven.
> > >
> > > Of course, I would like few more people to test it, but I don't
> > see how
> > > this could cause problems. Older binaries will still be working,
> > since
> > > they linked the linked the library statically, newer will use the
> > shared
> > > library.
> > 
> > If the world could be so simple....
> > 
> > Best regards,
> > Stefano Babic
> > 
> > >
> > > Cheers,
> > > Best regards,
> > > Sava Jakovljev
> > > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43
> > UTC+1:
> > >
> > > Hi Sava,
> > >
> > > On 27.10.20 16:38, Sava Jakovljev wrote:
> > > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
> > > > ---
> > > > Makefile | 53 +++++++++++++++++++++++++++++++++++++++-------------
> > > > ipc/Makefile | 2 +-
> > > > 2 files changed, 41 insertions(+), 14 deletions(-)
> > > >
> > > > diff --git a/Makefile b/Makefile
> > > > index a94c50d..a3ea9b3 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -4,6 +4,8 @@ SUBLEVEL = 0
> > > > EXTRAVERSION =
> > > > NAME =
> > > >
> > > > +IPCLIB_VERSION = 0.1
> > > > +
> > > > # *DOCUMENTATION*
> > > > # To see a list of typical targets execute "make help"
> > > > # More info can be located in ./README
> > > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
> > > > # Defaults to vmlinux, but the arch makefile usually adds further
> > > targets
> > > >
> > > > objs-y := core handlers
> > > > -libs-y := corelib ipc mongoose parser suricatta bootloader
> > > > +libs-y := corelib mongoose parser suricatta bootloader
> > > > shareds-y := bindings
> > > > tools-y := tools
> > > > > +ipc-y := ipc
> > > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
> > > > +ipc-dirs := $(ipc-y)
> > > > +
> > > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
> > > > +
> > > > swupdate-dirs := $(objs-y) $(libs-y)
> > > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
> > > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
> > > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
> > > > "$@" \
> > > > "$(CC)" \
> > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > > > "$(swupdate-objs)" \
> > > > "$(swupdate-libs)" \
> > > > - "$(LDLIBS)"
> > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > >
> > > > -swupdate_unstripped: $(swupdate-all) FORCE
> > > > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
> > > > $(call if_changed,swupdate)
> > > >
> > > > quiet_cmd_addon = LD $@
> > > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
> > > > "$@" \
> > > > "$(CC)" \
> > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > > > "$(2)" \
> > > > "$(swupdate-libs)" \
> > > > - "$(LDLIBS)"
> > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > >
> > > > quiet_cmd_shared = LD $@
> > > > cmd_shared = $(srctree)/scripts/trylink \
> > > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
> > > > "$(CC)" \
> > > > "-shared -Wl,-soname,$@" \
> > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
> > > > + "$(shared-libs)" \
> > > > + "" \
> > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > > +
> > > > +quiet_cmd_ipclib = LD $@
> > > > + cmd_ipclib = $(srctree)/scripts/trylink \
> > > > + "$@" \
> > > > + "$(CC)" \
> > > > + "-shared -Wl,-soname,$@" \
> > > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > > - "$(shared-libs) ipc/lib.a" \
> > > > + "$(ipc-lib)" \
> > > > + "" \
> > > > "$(LDLIBS)"
> > >
> > > This is quite a duplication of the same command.
> > >
> > > It looks to me there is too much overhead. This patch drops the
> > static
> > > library, why ? Static (as -dev package) and shared library should be
> > > both available. If this solves your problem having a shared library
> > > without Lua, it creates issues for all of users (the majority)
> > that do
> > > not need the library. I have the feeling this breaks build on
> > Yocto and
> > > maybe on Buildroot, too.
> > >
> > > >
> > > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
> > > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
> > > > $(call if_changed,shared)
> > > >
> > > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
> > > > + $(call if_changed,ipclib)
> > > > +
> > > > ifeq ($(SKIP_STRIP),y)
> > > > quiet_cmd_strip = echo $@
> > > > cmd_strip = cp $@_unstripped $@
> > > > @@ -443,7 +466,7 @@ endif
> > > > swupdate: cfg-sanity-check swupdate_unstripped
> > > > $(call cmd,strip)
> > > >
> > > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
> > > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs}
> > > FORCE
> > > > $(call if_changed,addon,$@.o)
> > > > @mv $@ $@_unstripped
> > > > $(call cmd,strip)
> > > > @@ -459,7 +482,8 @@ install: all
> > > > install -m 0644 $(srctree)/include/network_ipc.h
> > > ${DESTDIR}/${INCLUDEDIR}
> > > > install -m 0644 $(srctree)/include/swupdate_status.h
> > > ${DESTDIR}/${INCLUDEDIR}
> > > > install -m 0644 $(srctree)/include/progress_ipc.h
> > > ${DESTDIR}/${INCLUDEDIR}
> > > > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
> > > > + install -m 0755 $(srctree)/${swupdate-ipc-lib}
> > ${DESTDIR}/${LIBDIR}
> > > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
> > > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
> > > > if [ $(HAVE_LUA) = y ]; then \
> > > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
> > > > install -m 0755 ${lua_swupdate}
> > $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
> > > > @@ -481,6 +505,7 @@ test:
> > > > $(sort $(swupdate-all)): $(swupdate-dirs) ;
> > > > $(sort $(tools-all)): $(tools-dirs) ;
> > > > $(sort $(shared-all)): $(shared-dirs) ;
> > > > +$(sort $(ipc-lib)): $(ipc-dirs) ;
> > > >
> > > > # Handle descending into subdirectories listed in $(vmlinux-dirs)
> > > > # Preset locale variables to speed up the build process. Limit
> > locale
> > > > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
> > > > # make menuconfig etc.
> > > > # Error messages still appears in the original language
> > > >
> > > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
> > > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
> > > > $(swupdate-dirs): scripts
> > > > $(Q)$(MAKE) $(build)=$@
> > > > $(tools-dirs): scripts
> > > > $(Q)$(MAKE) $(build)=$@
> > > > $(shared-dirs): scripts
> > > > $(Q)$(MAKE) $(build)=$@
> > > > +$(ipc-dirs): scripts
> > > > + $(Q)$(MAKE) $(build)=$@
> > > >
> > > > ###
> > > > # Cleaning is done on three levels.
> > > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
> > > >
> > > > # Directories & files removed with 'make clean'
> > > > CLEAN_DIRS +=
> > > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
> > > ${tools-bins} \
> > > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
> > > libswupdate_ipc* ${tools-bins} \
> > > > $(patsubst %,%_unstripped,$(tools-bins)) \
> > > > $(patsubst %,%.out,$(tools-bins)) \
> > > > $(patsubst %,%.map,$(tools-bins)) \
> > > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags
> > > TAGS cscope* GPATH GTAGS GRTAGS GSYMS
> > > > #
> > > > clean: rm-dirs := $(CLEAN_DIRS)
> > > > clean: rm-files := $(CLEAN_FILES)
> > > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs)
> > > $(shared-dirs) scripts/acceptance-tests)
> > > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs)
> > > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
> > > >
> > > > PHONY += $(clean-dirs) clean archclean
> > > > $(clean-dirs):
> > > > diff --git a/ipc/Makefile b/ipc/Makefile
> > > > index 5c12d3d..f634dce 100644
> > > > --- a/ipc/Makefile
> > > > +++ b/ipc/Makefile
> > > > @@ -1,6 +1,6 @@
> > > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
> > > > #
> > > > # SPDX-License-Identifier: GPL-2.0-or-later
> > > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > > >
> > > > EXTRA_CFLAGS += -fPIC
> > > >
> > >
> > > Best regards,
> > > Stefano Babic
> > >
> > > --
> > > =====================================================================
> > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > > Phone: +49-8142-66989-53 <+49%208142%206698953> 
> <tel:+49%208142%206698953>
> > <tel:+49%208142%206698953> Fax:
> > > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980>
> > <tel:+49%208142%206698980> Email: sba...@denx.de
> > > =====================================================================
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "swupdate" group.
> > > To unsubscribe from this group and stop receiving emails from it,
> > send
> > > an email to swupdate+u...@googlegroups.com
> > > <mailto:swupdate+u...@googlegroups.com>.
> > > To view this discussion on the web visit
> > >
> > 
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> > 
> > >
> > <
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> > 
> > 
> > 
> > -- 
> > =====================================================================
> > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: +49-8142-66989-53 <+49%208142%206698953> 
> <tel:+49%208142%206698953> Fax:
> > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980> 
> Email: sba...@denx.de
> > =====================================================================
> > 
> > -- 
> > You received this message because you are subscribed to the Google
> > Groups "swupdate" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to swupdate+u...@googlegroups.com
> > <mailto:swupdate+u...@googlegroups.com>.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> -- 
> =====================================================================
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 <+49%208142%206698953> Fax: +49-8142-66989-80 
> <+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
Stefano Babic Nov. 6, 2020, 8:49 a.m. UTC | #7
Hi Sava,

On 29.10.20 18:25, Sava Jakovljev wrote:
> Hi Stefano,
> 
> Yes, (1) imposes some restrictions that are best to be avoided. 
> I'll check your patch and let you know - thank you for your effort -
> I'll come back to you regarding this ASAP.
> 

Independently for this, I realized that my patch is buggy running
multicore build. I have then written a "mix" between your patch and my
patch, and I will post together with some improvements for the library.

Best regards,
Stefano Babic

> Cheers,
> Sava Jakovljev
> 
> Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:52:48 UTC+1:
> 
>     Hi Sava,
> 
>     On 29.10.20 17:18, Sava Jakovljev wrote:
>     > HI Stefano,
>     >
>     > No, the problems with linking your proprietary licensed programs
>     > statically against LGPL libraries is a real one: your proprietary
>     > software then also falls under LGPL, as far as I know.
> 
>     Not that there is no issue with static linking, but reading from here :
> 
>     https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic
> 
>     Your application remains proprietary and not LGPL. Anyway, (1) adds
>     some
>     issue that are easy removed with the shared library.
> 
>     > Although, there
>     > is always some doubt when legal rules are interpreted by software
>     guys
>     > (or anyone else, in that manner).
>     >
>     > I understand that we need to make sure that there are no regressions
>     > from this - but I also don't see anything that is not solvable in
>     more
>     > or less easy manner.
> 
>     Check my patch and see if this works for you.
> 
>     > That's why I suggest a staged transition with a period of testing and
>     > consultation
>     > - of course, this is your project and you know best how you
>     > want to handle this - my stand-point is that it would make it more
>     > appealing and easier to use.
> 
>     Best regards,
>     Stefano Babic
> 
>     >
>     > Thank you.
>     > Cheers,
>     > Sava Jakovljev
>     > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:11:23
>     UTC+1:
>     >
>     > Hi Sava,
>     >
>     > On 29.10.20 13:23, Sava Jakovljev wrote:
>     > > Hello Stefano,
>     > >
>     > >
>     > > Why would we keep the static library? What is the benefit?
>     >
>     > Well, most packages provide both static and shared library. It is a
>     > choice for the developer to decide.
>     >
>     > The proble here is a sort of uncompatibility in case a new
>     SWUpdate is
>     > used with an old release - this is not officially supported, but
>     let's
>     > say, there are people (and more important, customers..) asking to
>     > switch
>     > to new version of package without switching to newer OE. And the
>     shared
>     > library is not installed on older OE, it adds some more hassle.
>     >
>     > > Sure, the
>     > > library is quite small, but nevertheless, in that way, there is
>     code
>     > > duplication in all of swupdate processes.
>     >
>     > I understand your topic, I want to have a solution with as less
>     > breakage
>     > as possible. I will send briefly a patch as proposal to support the
>     > shared library with less changes, we can discuss afterwards.
>     >
>     > > How would other users be affected by switching to a shared library?
>     >
>     > See above
>     >
>     > > We
>     > > use it with vanilla meta-swupdate layer and it works.
>     >
>     > Exactly what I meant before, apoart of other use cases with weird
>     > combinations.
>     >
>     > > It doesn't break
>     > > anything.
>     > > There are also legal implications - having a static library
>     licensed
>     > > under LGPL is not a good option for external programs that want to
>     > use IPC.
>     >
>     > This is new and I do not think you're right. License is set by the
>     > author of software, independently if you link a static or dynamic
>     > library.
>     >
>     > > Of course, there is workaround for that - don't use the library and
>     > > implement IPC manually - but I'm more biased towards having a
>     library
>     > > used, because it is tested and proven.
>     > >
>     > > Of course, I would like few more people to test it, but I don't
>     > see how
>     > > this could cause problems. Older binaries will still be working,
>     > since
>     > > they linked the linked the library statically, newer will use the
>     > shared
>     > > library.
>     >
>     > If the world could be so simple....
>     >
>     > Best regards,
>     > Stefano Babic
>     >
>     > >
>     > > Cheers,
>     > > Best regards,
>     > > Sava Jakovljev
>     > > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43
>     > UTC+1:
>     > >
>     > > Hi Sava,
>     > >
>     > > On 27.10.20 16:38, Sava Jakovljev wrote:
>     > > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
>     > > > ---
>     > > > Makefile | 53
>     +++++++++++++++++++++++++++++++++++++++-------------
>     > > > ipc/Makefile | 2 +-
>     > > > 2 files changed, 41 insertions(+), 14 deletions(-)
>     > > >
>     > > > diff --git a/Makefile b/Makefile
>     > > > index a94c50d..a3ea9b3 100644
>     > > > --- a/Makefile
>     > > > +++ b/Makefile
>     > > > @@ -4,6 +4,8 @@ SUBLEVEL = 0
>     > > > EXTRAVERSION =
>     > > > NAME =
>     > > >
>     > > > +IPCLIB_VERSION = 0.1
>     > > > +
>     > > > # *DOCUMENTATION*
>     > > > # To see a list of typical targets execute "make help"
>     > > > # More info can be located in ./README
>     > > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
>     > > > # Defaults to vmlinux, but the arch makefile usually adds further
>     > > targets
>     > > >
>     > > > objs-y := core handlers
>     > > > -libs-y := corelib ipc mongoose parser suricatta bootloader
>     > > > +libs-y := corelib mongoose parser suricatta bootloader
>     > > > shareds-y := bindings
>     > > > tools-y := tools
>     > > > > +ipc-y := ipc
>     > > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
>     > > > +ipc-dirs := $(ipc-y)
>     > > > +
>     > > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
>     > > > +
>     > > > swupdate-dirs := $(objs-y) $(libs-y)
>     > > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
>     > > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
>     > > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
>     > > > "$@" \
>     > > > "$(CC)" \
>     > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
>     -L$(srctree)" \
>     > > > "$(swupdate-objs)" \
>     > > > "$(swupdate-libs)" \
>     > > > - "$(LDLIBS)"
>     > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > > >
>     > > > -swupdate_unstripped: $(swupdate-all) FORCE
>     > > > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
>     > > > $(call if_changed,swupdate)
>     > > >
>     > > > quiet_cmd_addon = LD $@
>     > > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
>     > > > "$@" \
>     > > > "$(CC)" \
>     > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
>     -L$(srctree)" \
>     > > > "$(2)" \
>     > > > "$(swupdate-libs)" \
>     > > > - "$(LDLIBS)"
>     > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > > >
>     > > > quiet_cmd_shared = LD $@
>     > > > cmd_shared = $(srctree)/scripts/trylink \
>     > > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
>     > > > "$(CC)" \
>     > > > "-shared -Wl,-soname,$@" \
>     > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
>     -L$(srctree)" \
>     > > > + "$(shared-libs)" \
>     > > > + "" \
>     > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>     > > > +
>     > > > +quiet_cmd_ipclib = LD $@
>     > > > + cmd_ipclib = $(srctree)/scripts/trylink \
>     > > > + "$@" \
>     > > > + "$(CC)" \
>     > > > + "-shared -Wl,-soname,$@" \
>     > > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>     > > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>     > > > - "$(shared-libs) ipc/lib.a" \
>     > > > + "$(ipc-lib)" \
>     > > > + "" \
>     > > > "$(LDLIBS)"
>     > >
>     > > This is quite a duplication of the same command.
>     > >
>     > > It looks to me there is too much overhead. This patch drops the
>     > static
>     > > library, why ? Static (as -dev package) and shared library
>     should be
>     > > both available. If this solves your problem having a shared library
>     > > without Lua, it creates issues for all of users (the majority)
>     > that do
>     > > not need the library. I have the feeling this breaks build on
>     > Yocto and
>     > > maybe on Buildroot, too.
>     > >
>     > > >
>     > > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
>     > > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
>     > > > $(call if_changed,shared)
>     > > >
>     > > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
>     > > > + $(call if_changed,ipclib)
>     > > > +
>     > > > ifeq ($(SKIP_STRIP),y)
>     > > > quiet_cmd_strip = echo $@
>     > > > cmd_strip = cp $@_unstripped $@
>     > > > @@ -443,7 +466,7 @@ endif
>     > > > swupdate: cfg-sanity-check swupdate_unstripped
>     > > > $(call cmd,strip)
>     > > >
>     > > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
>     > > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs}
>     ${swupdate-libs}
>     > > FORCE
>     > > > $(call if_changed,addon,$@.o)
>     > > > @mv $@ $@_unstripped
>     > > > $(call cmd,strip)
>     > > > @@ -459,7 +482,8 @@ install: all
>     > > > install -m 0644 $(srctree)/include/network_ipc.h
>     > > ${DESTDIR}/${INCLUDEDIR}
>     > > > install -m 0644 $(srctree)/include/swupdate_status.h
>     > > ${DESTDIR}/${INCLUDEDIR}
>     > > > install -m 0644 $(srctree)/include/progress_ipc.h
>     > > ${DESTDIR}/${INCLUDEDIR}
>     > > > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
>     > > > + install -m 0755 $(srctree)/${swupdate-ipc-lib}
>     > ${DESTDIR}/${LIBDIR}
>     > > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
>     > > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
>     > > > if [ $(HAVE_LUA) = y ]; then \
>     > > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
>     > > > install -m 0755 ${lua_swupdate}
>     > $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
>     > > > @@ -481,6 +505,7 @@ test:
>     > > > $(sort $(swupdate-all)): $(swupdate-dirs) ;
>     > > > $(sort $(tools-all)): $(tools-dirs) ;
>     > > > $(sort $(shared-all)): $(shared-dirs) ;
>     > > > +$(sort $(ipc-lib)): $(ipc-dirs) ;
>     > > >
>     > > > # Handle descending into subdirectories listed in $(vmlinux-dirs)
>     > > > # Preset locale variables to speed up the build process. Limit
>     > locale
>     > > > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
>     > > > # make menuconfig etc.
>     > > > # Error messages still appears in the original language
>     > > >
>     > > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
>     > > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
>     $(ipc-dirs)
>     > > > $(swupdate-dirs): scripts
>     > > > $(Q)$(MAKE) $(build)=$@
>     > > > $(tools-dirs): scripts
>     > > > $(Q)$(MAKE) $(build)=$@
>     > > > $(shared-dirs): scripts
>     > > > $(Q)$(MAKE) $(build)=$@
>     > > > +$(ipc-dirs): scripts
>     > > > + $(Q)$(MAKE) $(build)=$@
>     > > >
>     > > > ###
>     > > > # Cleaning is done on three levels.
>     > > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
>     > > >
>     > > > # Directories & files removed with 'make clean'
>     > > > CLEAN_DIRS +=
>     > > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>     > > ${tools-bins} \
>     > > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>     > > libswupdate_ipc* ${tools-bins} \
>     > > > $(patsubst %,%_unstripped,$(tools-bins)) \
>     > > > $(patsubst %,%.out,$(tools-bins)) \
>     > > > $(patsubst %,%.map,$(tools-bins)) \
>     > > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags
>     > > TAGS cscope* GPATH GTAGS GRTAGS GSYMS
>     > > > #
>     > > > clean: rm-dirs := $(CLEAN_DIRS)
>     > > > clean: rm-files := $(CLEAN_FILES)
>     > > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs)
>     $(tools-dirs)
>     > > $(shared-dirs) scripts/acceptance-tests)
>     > > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs)
>     > > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
>     > > >
>     > > > PHONY += $(clean-dirs) clean archclean
>     > > > $(clean-dirs):
>     > > > diff --git a/ipc/Makefile b/ipc/Makefile
>     > > > index 5c12d3d..f634dce 100644
>     > > > --- a/ipc/Makefile
>     > > > +++ b/ipc/Makefile
>     > > > @@ -1,6 +1,6 @@
>     > > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
>     > > > #
>     > > > # SPDX-License-Identifier: GPL-2.0-or-later
>     > > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
>     > > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
>     > > >
>     > > > EXTRA_CFLAGS += -fPIC
>     > > >
>     > >
>     > > Best regards,
>     > > Stefano Babic
>     > >
>     > > --
>     > >
>     =====================================================================
>     > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>     > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
>     Germany
>     > > Phone: +49-8142-66989-53 <tel:+49%208142%206698953>
>     <tel:+49%208142%206698953>
>     > <tel:+49%208142%206698953> Fax:
>     > > +49-8142-66989-80 <tel:+49%208142%206698980>
>     <tel:+49%208142%206698980>
>     > <tel:+49%208142%206698980> Email: sba...@denx.de
>     > >
>     =====================================================================
>     > >
>     > > --
>     > > You received this message because you are subscribed to the Google
>     > > Groups "swupdate" group.
>     > > To unsubscribe from this group and stop receiving emails from it,
>     > send
>     > > an email to swupdate+u...@googlegroups.com
>     > > <mailto:swupdate+u...@googlegroups.com>.
>     > > To view this discussion on the web visit
>     > >
>     >
>     https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> 
>     >
>     > >
>     >
>     <https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
>     >
>     >
>     >
>     > --
>     > =====================================================================
>     > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>     > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>     > Phone: +49-8142-66989-53 <tel:+49%208142%206698953>
>     <tel:+49%208142%206698953> Fax:
>     > +49-8142-66989-80 <tel:+49%208142%206698980>
>     <tel:+49%208142%206698980> Email: sba...@denx.de
>     > =====================================================================
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "swupdate" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to swupdate+u...@googlegroups.com
>     > <mailto:swupdate+u...@googlegroups.com>.
>     > To view this discussion on the web visit
>     >
>     https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com
> 
>     >
>     <https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> 
>     -- 
>     =====================================================================
>     DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>     Phone: +49-8142-66989-53 <tel:+49%208142%206698953> Fax:
>     +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>     =====================================================================
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com?utm_medium=email&utm_source=footer>.
Sava Jakovljev Nov. 9, 2020, 9:08 p.m. UTC | #8
Hi Stefano,

Sorry for taking a long time to reply - I am back on SWUpdate support from 
today again.

Sounds good - I can do a small test run using our system and let you know 
whether everything is fine.

Cheers,
Sava Jakovljev

Stefano Babic schrieb am Freitag, 6. November 2020 um 09:49:51 UTC+1:

> Hi Sava,
>
> On 29.10.20 18:25, Sava Jakovljev wrote:
> > Hi Stefano,
> > 
> > Yes, (1) imposes some restrictions that are best to be avoided. 
> > I'll check your patch and let you know - thank you for your effort -
> > I'll come back to you regarding this ASAP.
> > 
>
> Independently for this, I realized that my patch is buggy running
> multicore build. I have then written a "mix" between your patch and my
> patch, and I will post together with some improvements for the library.
>
> Best regards,
> Stefano Babic
>
> > Cheers,
> > Sava Jakovljev
> > 
> > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:52:48 UTC+1:
> > 
> > Hi Sava,
> > 
> > On 29.10.20 17:18, Sava Jakovljev wrote:
> > > HI Stefano,
> > >
> > > No, the problems with linking your proprietary licensed programs
> > > statically against LGPL libraries is a real one: your proprietary
> > > software then also falls under LGPL, as far as I know.
> > 
> > Not that there is no issue with static linking, but reading from here :
> > 
> > https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic
> > 
> > Your application remains proprietary and not LGPL. Anyway, (1) adds
> > some
> > issue that are easy removed with the shared library.
> > 
> > > Although, there
> > > is always some doubt when legal rules are interpreted by software
> > guys
> > > (or anyone else, in that manner).
> > >
> > > I understand that we need to make sure that there are no regressions
> > > from this - but I also don't see anything that is not solvable in
> > more
> > > or less easy manner.
> > 
> > Check my patch and see if this works for you.
> > 
> > > That's why I suggest a staged transition with a period of testing and
> > > consultation
> > > - of course, this is your project and you know best how you
> > > want to handle this - my stand-point is that it would make it more
> > > appealing and easier to use.
> > 
> > Best regards,
> > Stefano Babic
> > 
> > >
> > > Thank you.
> > > Cheers,
> > > Sava Jakovljev
> > > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:11:23
> > UTC+1:
> > >
> > > Hi Sava,
> > >
> > > On 29.10.20 13:23, Sava Jakovljev wrote:
> > > > Hello Stefano,
> > > >
> > > >
> > > > Why would we keep the static library? What is the benefit?
> > >
> > > Well, most packages provide both static and shared library. It is a
> > > choice for the developer to decide.
> > >
> > > The proble here is a sort of uncompatibility in case a new
> > SWUpdate is
> > > used with an old release - this is not officially supported, but
> > let's
> > > say, there are people (and more important, customers..) asking to
> > > switch
> > > to new version of package without switching to newer OE. And the
> > shared
> > > library is not installed on older OE, it adds some more hassle.
> > >
> > > > Sure, the
> > > > library is quite small, but nevertheless, in that way, there is
> > code
> > > > duplication in all of swupdate processes.
> > >
> > > I understand your topic, I want to have a solution with as less
> > > breakage
> > > as possible. I will send briefly a patch as proposal to support the
> > > shared library with less changes, we can discuss afterwards.
> > >
> > > > How would other users be affected by switching to a shared library?
> > >
> > > See above
> > >
> > > > We
> > > > use it with vanilla meta-swupdate layer and it works.
> > >
> > > Exactly what I meant before, apoart of other use cases with weird
> > > combinations.
> > >
> > > > It doesn't break
> > > > anything.
> > > > There are also legal implications - having a static library
> > licensed
> > > > under LGPL is not a good option for external programs that want to
> > > use IPC.
> > >
> > > This is new and I do not think you're right. License is set by the
> > > author of software, independently if you link a static or dynamic
> > > library.
> > >
> > > > Of course, there is workaround for that - don't use the library and
> > > > implement IPC manually - but I'm more biased towards having a
> > library
> > > > used, because it is tested and proven.
> > > >
> > > > Of course, I would like few more people to test it, but I don't
> > > see how
> > > > this could cause problems. Older binaries will still be working,
> > > since
> > > > they linked the linked the library statically, newer will use the
> > > shared
> > > > library.
> > >
> > > If the world could be so simple....
> > >
> > > Best regards,
> > > Stefano Babic
> > >
> > > >
> > > > Cheers,
> > > > Best regards,
> > > > Sava Jakovljev
> > > > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43
> > > UTC+1:
> > > >
> > > > Hi Sava,
> > > >
> > > > On 27.10.20 16:38, Sava Jakovljev wrote:
> > > > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
> > > > > ---
> > > > > Makefile | 53
> > +++++++++++++++++++++++++++++++++++++++-------------
> > > > > ipc/Makefile | 2 +-
> > > > > 2 files changed, 41 insertions(+), 14 deletions(-)
> > > > >
> > > > > diff --git a/Makefile b/Makefile
> > > > > index a94c50d..a3ea9b3 100644
> > > > > --- a/Makefile
> > > > > +++ b/Makefile
> > > > > @@ -4,6 +4,8 @@ SUBLEVEL = 0
> > > > > EXTRAVERSION =
> > > > > NAME =
> > > > >
> > > > > +IPCLIB_VERSION = 0.1
> > > > > +
> > > > > # *DOCUMENTATION*
> > > > > # To see a list of typical targets execute "make help"
> > > > > # More info can be located in ./README
> > > > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
> > > > > # Defaults to vmlinux, but the arch makefile usually adds further
> > > > targets
> > > > >
> > > > > objs-y := core handlers
> > > > > -libs-y := corelib ipc mongoose parser suricatta bootloader
> > > > > +libs-y := corelib mongoose parser suricatta bootloader
> > > > > shareds-y := bindings
> > > > > tools-y := tools
> > > > > > +ipc-y := ipc
> > > > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
> > > > > +ipc-dirs := $(ipc-y)
> > > > > +
> > > > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
> > > > > +
> > > > > swupdate-dirs := $(objs-y) $(libs-y)
> > > > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
> > > > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
> > > > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
> > > > > "$@" \
> > > > > "$(CC)" \
> > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
> > -L$(srctree)" \
> > > > > "$(swupdate-objs)" \
> > > > > "$(swupdate-libs)" \
> > > > > - "$(LDLIBS)"
> > > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > > >
> > > > > -swupdate_unstripped: $(swupdate-all) FORCE
> > > > > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
> > > > > $(call if_changed,swupdate)
> > > > >
> > > > > quiet_cmd_addon = LD $@
> > > > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
> > > > > "$@" \
> > > > > "$(CC)" \
> > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
> > -L$(srctree)" \
> > > > > "$(2)" \
> > > > > "$(swupdate-libs)" \
> > > > > - "$(LDLIBS)"
> > > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > > >
> > > > > quiet_cmd_shared = LD $@
> > > > > cmd_shared = $(srctree)/scripts/trylink \
> > > > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
> > > > > "$(CC)" \
> > > > > "-shared -Wl,-soname,$@" \
> > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
> > -L$(srctree)" \
> > > > > + "$(shared-libs)" \
> > > > > + "" \
> > > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
> > > > > +
> > > > > +quiet_cmd_ipclib = LD $@
> > > > > + cmd_ipclib = $(srctree)/scripts/trylink \
> > > > > + "$@" \
> > > > > + "$(CC)" \
> > > > > + "-shared -Wl,-soname,$@" \
> > > > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
> > > > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
> > > > > - "$(shared-libs) ipc/lib.a" \
> > > > > + "$(ipc-lib)" \
> > > > > + "" \
> > > > > "$(LDLIBS)"
> > > >
> > > > This is quite a duplication of the same command.
> > > >
> > > > It looks to me there is too much overhead. This patch drops the
> > > static
> > > > library, why ? Static (as -dev package) and shared library
> > should be
> > > > both available. If this solves your problem having a shared library
> > > > without Lua, it creates issues for all of users (the majority)
> > > that do
> > > > not need the library. I have the feeling this breaks build on
> > > Yocto and
> > > > maybe on Buildroot, too.
> > > >
> > > > >
> > > > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
> > > > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
> > > > > $(call if_changed,shared)
> > > > >
> > > > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
> > > > > + $(call if_changed,ipclib)
> > > > > +
> > > > > ifeq ($(SKIP_STRIP),y)
> > > > > quiet_cmd_strip = echo $@
> > > > > cmd_strip = cp $@_unstripped $@
> > > > > @@ -443,7 +466,7 @@ endif
> > > > > swupdate: cfg-sanity-check swupdate_unstripped
> > > > > $(call cmd,strip)
> > > > >
> > > > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
> > > > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs}
> > ${swupdate-libs}
> > > > FORCE
> > > > > $(call if_changed,addon,$@.o)
> > > > > @mv $@ $@_unstripped
> > > > > $(call cmd,strip)
> > > > > @@ -459,7 +482,8 @@ install: all
> > > > > install -m 0644 $(srctree)/include/network_ipc.h
> > > > ${DESTDIR}/${INCLUDEDIR}
> > > > > install -m 0644 $(srctree)/include/swupdate_status.h
> > > > ${DESTDIR}/${INCLUDEDIR}
> > > > > install -m 0644 $(srctree)/include/progress_ipc.h
> > > > ${DESTDIR}/${INCLUDEDIR}
> > > > > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
> > > > > + install -m 0755 $(srctree)/${swupdate-ipc-lib}
> > > ${DESTDIR}/${LIBDIR}
> > > > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
> > > > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
> > > > > if [ $(HAVE_LUA) = y ]; then \
> > > > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
> > > > > install -m 0755 ${lua_swupdate}
> > > $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
> > > > > @@ -481,6 +505,7 @@ test:
> > > > > $(sort $(swupdate-all)): $(swupdate-dirs) ;
> > > > > $(sort $(tools-all)): $(tools-dirs) ;
> > > > > $(sort $(shared-all)): $(shared-dirs) ;
> > > > > +$(sort $(ipc-lib)): $(ipc-dirs) ;
> > > > >
> > > > > # Handle descending into subdirectories listed in $(vmlinux-dirs)
> > > > > # Preset locale variables to speed up the build process. Limit
> > > locale
> > > > > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ;
> > > > > # make menuconfig etc.
> > > > > # Error messages still appears in the original language
> > > > >
> > > > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
> > > > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
> > $(ipc-dirs)
> > > > > $(swupdate-dirs): scripts
> > > > > $(Q)$(MAKE) $(build)=$@
> > > > > $(tools-dirs): scripts
> > > > > $(Q)$(MAKE) $(build)=$@
> > > > > $(shared-dirs): scripts
> > > > > $(Q)$(MAKE) $(build)=$@
> > > > > +$(ipc-dirs): scripts
> > > > > + $(Q)$(MAKE) $(build)=$@
> > > > >
> > > > > ###
> > > > > # Cleaning is done on three levels.
> > > > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
> > > > >
> > > > > # Directories & files removed with 'make clean'
> > > > > CLEAN_DIRS +=
> > > > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
> > > > ${tools-bins} \
> > > > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
> > > > libswupdate_ipc* ${tools-bins} \
> > > > > $(patsubst %,%_unstripped,$(tools-bins)) \
> > > > > $(patsubst %,%.out,$(tools-bins)) \
> > > > > $(patsubst %,%.map,$(tools-bins)) \
> > > > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags
> > > > TAGS cscope* GPATH GTAGS GRTAGS GSYMS
> > > > > #
> > > > > clean: rm-dirs := $(CLEAN_DIRS)
> > > > > clean: rm-files := $(CLEAN_FILES)
> > > > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs)
> > $(tools-dirs)
> > > > $(shared-dirs) scripts/acceptance-tests)
> > > > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs)
> > > > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
> > > > >
> > > > > PHONY += $(clean-dirs) clean archclean
> > > > > $(clean-dirs):
> > > > > diff --git a/ipc/Makefile b/ipc/Makefile
> > > > > index 5c12d3d..f634dce 100644
> > > > > --- a/ipc/Makefile
> > > > > +++ b/ipc/Makefile
> > > > > @@ -1,6 +1,6 @@
> > > > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
> > > > > #
> > > > > # SPDX-License-Identifier: GPL-2.0-or-later
> > > > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > > > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
> > > > >
> > > > > EXTRA_CFLAGS += -fPIC
> > > > >
> > > >
> > > > Best regards,
> > > > Stefano Babic
> > > >
> > > > --
> > > >
> > =====================================================================
> > > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> > > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany
> > > > Phone: +49-8142-66989-53 <+49%208142%206698953> 
> <tel:+49%208142%206698953>
> > <tel:+49%208142%206698953>
> > > <tel:+49%208142%206698953> Fax:
> > > > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980>
> > <tel:+49%208142%206698980>
> > > <tel:+49%208142%206698980> Email: sba...@denx.de
> > > >
> > =====================================================================
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "swupdate" group.
> > > > To unsubscribe from this group and stop receiving emails from it,
> > > send
> > > > an email to swupdate+u...@googlegroups.com
> > > > <mailto:swupdate+u...@googlegroups.com>.
> > > > To view this discussion on the web visit
> > > >
> > >
> > 
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> > 
> > >
> > > >
> > >
> > <
> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> > 
> > >
> > >
> > >
> > > --
> > > =====================================================================
> > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > > Phone: +49-8142-66989-53 <+49%208142%206698953> 
> <tel:+49%208142%206698953>
> > <tel:+49%208142%206698953> Fax:
> > > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980>
> > <tel:+49%208142%206698980> Email: sba...@denx.de
> > > =====================================================================
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "swupdate" group.
> > > To unsubscribe from this group and stop receiving emails from it,
> > send
> > > an email to swupdate+u...@googlegroups.com
> > > <mailto:swupdate+u...@googlegroups.com>.
> > > To view this discussion on the web visit
> > >
> > 
> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com
> > 
> > >
> > <
> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
> > 
> > 
> > 
> > -- 
> > =====================================================================
> > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: +49-8142-66989-53 <+49%208142%206698953> 
> <tel:+49%208142%206698953> Fax:
> > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980> 
> Email: sba...@denx.de
> > =====================================================================
> > 
> > -- 
> > You received this message because you are subscribed to the Google
> > Groups "swupdate" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to swupdate+u...@googlegroups.com
> > <mailto:swupdate+u...@googlegroups.com>.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> -- 
> =====================================================================
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 <+49%208142%206698953> Fax: +49-8142-66989-80 
> <+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
Sava Jakovljev Nov. 16, 2020, 1:11 p.m. UTC | #9
Hi Stefano,

Busy days, sorry - I tested the changes, all is as expected, thanks for 
merging it. 

Cheers,
Sava Jakovljev

Sava Jakovljev schrieb am Montag, 9. November 2020 um 22:08:09 UTC+1:

> Hi Stefano,
>
> Sorry for taking a long time to reply - I am back on SWUpdate support from 
> today again.
>
> Sounds good - I can do a small test run using our system and let you know 
> whether everything is fine.
>
> Cheers,
> Sava Jakovljev
>
> Stefano Babic schrieb am Freitag, 6. November 2020 um 09:49:51 UTC+1:
>
>> Hi Sava, 
>>
>> On 29.10.20 18:25, Sava Jakovljev wrote: 
>> > Hi Stefano, 
>> > 
>> > Yes, (1) imposes some restrictions that are best to be avoided.  
>> > I'll check your patch and let you know - thank you for your effort - 
>> > I'll come back to you regarding this ASAP. 
>> > 
>>
>> Independently for this, I realized that my patch is buggy running 
>> multicore build. I have then written a "mix" between your patch and my 
>> patch, and I will post together with some improvements for the library. 
>>
>> Best regards, 
>> Stefano Babic 
>>
>> > Cheers, 
>> > Sava Jakovljev 
>> > 
>> > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:52:48 
>> UTC+1: 
>> > 
>> > Hi Sava, 
>> > 
>> > On 29.10.20 17:18, Sava Jakovljev wrote: 
>> > > HI Stefano, 
>> > > 
>> > > No, the problems with linking your proprietary licensed programs 
>> > > statically against LGPL libraries is a real one: your proprietary 
>> > > software then also falls under LGPL, as far as I know. 
>> > 
>> > Not that there is no issue with static linking, but reading from here : 
>> > 
>> > https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic 
>> > 
>> > Your application remains proprietary and not LGPL. Anyway, (1) adds 
>> > some 
>> > issue that are easy removed with the shared library. 
>> > 
>> > > Although, there 
>> > > is always some doubt when legal rules are interpreted by software 
>> > guys 
>> > > (or anyone else, in that manner). 
>> > > 
>> > > I understand that we need to make sure that there are no regressions 
>> > > from this - but I also don't see anything that is not solvable in 
>> > more 
>> > > or less easy manner. 
>> > 
>> > Check my patch and see if this works for you. 
>> > 
>> > > That's why I suggest a staged transition with a period of testing and 
>> > > consultation 
>> > > - of course, this is your project and you know best how you 
>> > > want to handle this - my stand-point is that it would make it more 
>> > > appealing and easier to use. 
>> > 
>> > Best regards, 
>> > Stefano Babic 
>> > 
>> > > 
>> > > Thank you. 
>> > > Cheers, 
>> > > Sava Jakovljev 
>> > > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um 17:11:23 
>> > UTC+1: 
>> > > 
>> > > Hi Sava, 
>> > > 
>> > > On 29.10.20 13:23, Sava Jakovljev wrote: 
>> > > > Hello Stefano, 
>> > > > 
>> > > > 
>> > > > Why would we keep the static library? What is the benefit? 
>> > > 
>> > > Well, most packages provide both static and shared library. It is a 
>> > > choice for the developer to decide. 
>> > > 
>> > > The proble here is a sort of uncompatibility in case a new 
>> > SWUpdate is 
>> > > used with an old release - this is not officially supported, but 
>> > let's 
>> > > say, there are people (and more important, customers..) asking to 
>> > > switch 
>> > > to new version of package without switching to newer OE. And the 
>> > shared 
>> > > library is not installed on older OE, it adds some more hassle. 
>> > > 
>> > > > Sure, the 
>> > > > library is quite small, but nevertheless, in that way, there is 
>> > code 
>> > > > duplication in all of swupdate processes. 
>> > > 
>> > > I understand your topic, I want to have a solution with as less 
>> > > breakage 
>> > > as possible. I will send briefly a patch as proposal to support the 
>> > > shared library with less changes, we can discuss afterwards. 
>> > > 
>> > > > How would other users be affected by switching to a shared library? 
>> > > 
>> > > See above 
>> > > 
>> > > > We 
>> > > > use it with vanilla meta-swupdate layer and it works. 
>> > > 
>> > > Exactly what I meant before, apoart of other use cases with weird 
>> > > combinations. 
>> > > 
>> > > > It doesn't break 
>> > > > anything. 
>> > > > There are also legal implications - having a static library 
>> > licensed 
>> > > > under LGPL is not a good option for external programs that want to 
>> > > use IPC. 
>> > > 
>> > > This is new and I do not think you're right. License is set by the 
>> > > author of software, independently if you link a static or dynamic 
>> > > library. 
>> > > 
>> > > > Of course, there is workaround for that - don't use the library and 
>> > > > implement IPC manually - but I'm more biased towards having a 
>> > library 
>> > > > used, because it is tested and proven. 
>> > > > 
>> > > > Of course, I would like few more people to test it, but I don't 
>> > > see how 
>> > > > this could cause problems. Older binaries will still be working, 
>> > > since 
>> > > > they linked the linked the library statically, newer will use the 
>> > > shared 
>> > > > library. 
>> > > 
>> > > If the world could be so simple.... 
>> > > 
>> > > Best regards, 
>> > > Stefano Babic 
>> > > 
>> > > > 
>> > > > Cheers, 
>> > > > Best regards, 
>> > > > Sava Jakovljev 
>> > > > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um 20:54:43 
>> > > UTC+1: 
>> > > > 
>> > > > Hi Sava, 
>> > > > 
>> > > > On 27.10.20 16:38, Sava Jakovljev wrote: 
>> > > > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de> 
>> > > > > --- 
>> > > > > Makefile | 53 
>> > +++++++++++++++++++++++++++++++++++++++------------- 
>> > > > > ipc/Makefile | 2 +- 
>> > > > > 2 files changed, 41 insertions(+), 14 deletions(-) 
>> > > > > 
>> > > > > diff --git a/Makefile b/Makefile 
>> > > > > index a94c50d..a3ea9b3 100644 
>> > > > > --- a/Makefile 
>> > > > > +++ b/Makefile 
>> > > > > @@ -4,6 +4,8 @@ SUBLEVEL = 0 
>> > > > > EXTRAVERSION = 
>> > > > > NAME = 
>> > > > > 
>> > > > > +IPCLIB_VERSION = 0.1 
>> > > > > + 
>> > > > > # *DOCUMENTATION* 
>> > > > > # To see a list of typical targets execute "make help" 
>> > > > > # More info can be located in ./README 
>> > > > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags 
>> > > > > # Defaults to vmlinux, but the arch makefile usually adds further 
>> > > > targets 
>> > > > > 
>> > > > > objs-y := core handlers 
>> > > > > -libs-y := corelib ipc mongoose parser suricatta bootloader 
>> > > > > +libs-y := corelib mongoose parser suricatta bootloader 
>> > > > > shareds-y := bindings 
>> > > > > tools-y := tools 
>> > > > > > +ipc-y := ipc 
>> > > > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y)) 
>> > > > > +ipc-dirs := $(ipc-y) 
>> > > > > + 
>> > > > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION} 
>> > > > > + 
>> > > > > swupdate-dirs := $(objs-y) $(libs-y) 
>> > > > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y)) 
>> > > > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y)) 
>> > > > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@ 
>> > > > > "$@" \ 
>> > > > > "$(CC)" \ 
>> > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \ 
>> > > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \ 
>> > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) 
>> > -L$(srctree)" \ 
>> > > > > "$(swupdate-objs)" \ 
>> > > > > "$(swupdate-libs)" \ 
>> > > > > - "$(LDLIBS)" 
>> > > > > + "$(LDLIBS) :${swupdate-ipc-lib}" 
>> > > > > 
>> > > > > -swupdate_unstripped: $(swupdate-all) FORCE 
>> > > > > +swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE 
>> > > > > $(call if_changed,swupdate) 
>> > > > > 
>> > > > > quiet_cmd_addon = LD $@ 
>> > > > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@ 
>> > > > > "$@" \ 
>> > > > > "$(CC)" \ 
>> > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \ 
>> > > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \ 
>> > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) 
>> > -L$(srctree)" \ 
>> > > > > "$(2)" \ 
>> > > > > "$(swupdate-libs)" \ 
>> > > > > - "$(LDLIBS)" 
>> > > > > + "$(LDLIBS) :${swupdate-ipc-lib}" 
>> > > > > 
>> > > > > quiet_cmd_shared = LD $@ 
>> > > > > cmd_shared = $(srctree)/scripts/trylink \ 
>> > > > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@ 
>> > > > > "$(CC)" \ 
>> > > > > "-shared -Wl,-soname,$@" \ 
>> > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \ 
>> > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) 
>> > -L$(srctree)" \ 
>> > > > > + "$(shared-libs)" \ 
>> > > > > + "" \ 
>> > > > > + "$(LDLIBS) :${swupdate-ipc-lib}" 
>> > > > > + 
>> > > > > +quiet_cmd_ipclib = LD $@ 
>> > > > > + cmd_ipclib = $(srctree)/scripts/trylink \ 
>> > > > > + "$@" \ 
>> > > > > + "$(CC)" \ 
>> > > > > + "-shared -Wl,-soname,$@" \ 
>> > > > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \ 
>> > > > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \ 
>> > > > > - "$(shared-libs) ipc/lib.a" \ 
>> > > > > + "$(ipc-lib)" \ 
>> > > > > + "" \ 
>> > > > > "$(LDLIBS)" 
>> > > > 
>> > > > This is quite a duplication of the same command. 
>> > > > 
>> > > > It looks to me there is too much overhead. This patch drops the 
>> > > static 
>> > > > library, why ? Static (as -dev package) and shared library 
>> > should be 
>> > > > both available. If this solves your problem having a shared library 
>> > > > without Lua, it creates issues for all of users (the majority) 
>> > > that do 
>> > > > not need the library. I have the feeling this breaks build on 
>> > > Yocto and 
>> > > > maybe on Buildroot, too. 
>> > > > 
>> > > > > 
>> > > > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE 
>> > > > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE 
>> > > > > $(call if_changed,shared) 
>> > > > > 
>> > > > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE 
>> > > > > + $(call if_changed,ipclib) 
>> > > > > + 
>> > > > > ifeq ($(SKIP_STRIP),y) 
>> > > > > quiet_cmd_strip = echo $@ 
>> > > > > cmd_strip = cp $@_unstripped $@ 
>> > > > > @@ -443,7 +466,7 @@ endif 
>> > > > > swupdate: cfg-sanity-check swupdate_unstripped 
>> > > > > $(call cmd,strip) 
>> > > > > 
>> > > > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE 
>> > > > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} 
>> > ${swupdate-libs} 
>> > > > FORCE 
>> > > > > $(call if_changed,addon,$@.o) 
>> > > > > @mv $@ $@_unstripped 
>> > > > > $(call cmd,strip) 
>> > > > > @@ -459,7 +482,8 @@ install: all 
>> > > > > install -m 0644 $(srctree)/include/network_ipc.h 
>> > > > ${DESTDIR}/${INCLUDEDIR} 
>> > > > > install -m 0644 $(srctree)/include/swupdate_status.h 
>> > > > ${DESTDIR}/${INCLUDEDIR} 
>> > > > > install -m 0644 $(srctree)/include/progress_ipc.h 
>> > > > ${DESTDIR}/${INCLUDEDIR} 
>> > > > > - install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a 
>> > > > > + install -m 0755 $(srctree)/${swupdate-ipc-lib} 
>> > > ${DESTDIR}/${LIBDIR} 
>> > > > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib} 
>> > > > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so 
>> > > > > if [ $(HAVE_LUA) = y ]; then \ 
>> > > > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \ 
>> > > > > install -m 0755 ${lua_swupdate} 
>> > > $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \ 
>> > > > > @@ -481,6 +505,7 @@ test: 
>> > > > > $(sort $(swupdate-all)): $(swupdate-dirs) ; 
>> > > > > $(sort $(tools-all)): $(tools-dirs) ; 
>> > > > > $(sort $(shared-all)): $(shared-dirs) ; 
>> > > > > +$(sort $(ipc-lib)): $(ipc-dirs) ; 
>> > > > > 
>> > > > > # Handle descending into subdirectories listed in $(vmlinux-dirs) 
>> > > > > # Preset locale variables to speed up the build process. Limit 
>> > > locale 
>> > > > > @@ -488,13 +513,15 @@ $(sort $(shared-all)): $(shared-dirs) ; 
>> > > > > # make menuconfig etc. 
>> > > > > # Error messages still appears in the original language 
>> > > > > 
>> > > > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) 
>> > > > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) 
>> > $(ipc-dirs) 
>> > > > > $(swupdate-dirs): scripts 
>> > > > > $(Q)$(MAKE) $(build)=$@ 
>> > > > > $(tools-dirs): scripts 
>> > > > > $(Q)$(MAKE) $(build)=$@ 
>> > > > > $(shared-dirs): scripts 
>> > > > > $(Q)$(MAKE) $(build)=$@ 
>> > > > > +$(ipc-dirs): scripts 
>> > > > > + $(Q)$(MAKE) $(build)=$@ 
>> > > > > 
>> > > > > ### 
>> > > > > # Cleaning is done on three levels. 
>> > > > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts 
>> > > > > 
>> > > > > # Directories & files removed with 'make clean' 
>> > > > > CLEAN_DIRS += 
>> > > > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* 
>> > > > ${tools-bins} \ 
>> > > > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* 
>> > > > libswupdate_ipc* ${tools-bins} \ 
>> > > > > $(patsubst %,%_unstripped,$(tools-bins)) \ 
>> > > > > $(patsubst %,%.out,$(tools-bins)) \ 
>> > > > > $(patsubst %,%.map,$(tools-bins)) \ 
>> > > > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config .config.old tags 
>> > > > TAGS cscope* GPATH GTAGS GRTAGS GSYMS 
>> > > > > # 
>> > > > > clean: rm-dirs := $(CLEAN_DIRS) 
>> > > > > clean: rm-files := $(CLEAN_FILES) 
>> > > > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs) 
>> > $(tools-dirs) 
>> > > > $(shared-dirs) scripts/acceptance-tests) 
>> > > > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs) 
>> > > > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests) 
>> > > > > 
>> > > > > PHONY += $(clean-dirs) clean archclean 
>> > > > > $(clean-dirs): 
>> > > > > diff --git a/ipc/Makefile b/ipc/Makefile 
>> > > > > index 5c12d3d..f634dce 100644 
>> > > > > --- a/ipc/Makefile 
>> > > > > +++ b/ipc/Makefile 
>> > > > > @@ -1,6 +1,6 @@ 
>> > > > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de> 
>> > > > > # 
>> > > > > # SPDX-License-Identifier: GPL-2.0-or-later 
>> > > > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o 
>> > > > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o 
>> > > > > 
>> > > > > EXTRA_CFLAGS += -fPIC 
>> > > > > 
>> > > > 
>> > > > Best regards, 
>> > > > Stefano Babic 
>> > > > 
>> > > > -- 
>> > > > 
>> > ===================================================================== 
>> > > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 
>> > > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, 
>> > Germany 
>> > > > Phone: +49-8142-66989-53 <+49%208142%206698953> 
>> <tel:+49%208142%206698953> 
>> > <tel:+49%208142%206698953> 
>> > > <tel:+49%208142%206698953> Fax: 
>> > > > +49-8142-66989-80 <+49%208142%206698980> 
>> <tel:+49%208142%206698980> 
>> > <tel:+49%208142%206698980> 
>> > > <tel:+49%208142%206698980> Email: sba...@denx.de 
>> > > > 
>> > ===================================================================== 
>> > > > 
>> > > > -- 
>> > > > You received this message because you are subscribed to the Google 
>> > > > Groups "swupdate" group. 
>> > > > To unsubscribe from this group and stop receiving emails from it, 
>> > > send 
>> > > > an email to swupdate+u...@googlegroups.com 
>> > > > <mailto:swupdate+u...@googlegroups.com>. 
>> > > > To view this discussion on the web visit 
>> > > > 
>> > > 
>> > 
>> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com 
>> > 
>> > > 
>> > > > 
>> > > 
>> > <
>> https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>>
>> > 
>> > > 
>> > > 
>> > > 
>> > > -- 
>> > > ===================================================================== 
>> > > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 
>> > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 
>> > > Phone: +49-8142-66989-53 <+49%208142%206698953> 
>> <tel:+49%208142%206698953> 
>> > <tel:+49%208142%206698953> Fax: 
>> > > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980> 
>> > <tel:+49%208142%206698980> Email: sba...@denx.de 
>> > > ===================================================================== 
>> > > 
>> > > -- 
>> > > You received this message because you are subscribed to the Google 
>> > > Groups "swupdate" group. 
>> > > To unsubscribe from this group and stop receiving emails from it, 
>> > send 
>> > > an email to swupdate+u...@googlegroups.com 
>> > > <mailto:swupdate+u...@googlegroups.com>. 
>> > > To view this discussion on the web visit 
>> > > 
>> > 
>> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com 
>> > 
>> > > 
>> > <
>> https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>>
>> > 
>> > 
>> > 
>> > -- 
>> > ===================================================================== 
>> > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 
>> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 
>> > Phone: +49-8142-66989-53 <+49%208142%206698953> 
>> <tel:+49%208142%206698953> Fax: 
>> > +49-8142-66989-80 <+49%208142%206698980> <tel:+49%208142%206698980> 
>> Email: sba...@denx.de 
>> > ===================================================================== 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "swupdate" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> > an email to swupdate+u...@googlegroups.com 
>> > <mailto:swupdate+u...@googlegroups.com>. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com 
>> > <
>> https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>>
>>
>>
>> -- 
>> ===================================================================== 
>> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 
>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 
>> Phone: +49-8142-66989-53 <+49%208142%206698953> Fax: +49-8142-66989-80 
>> <+49%208142%206698980> Email: sba...@denx.de 
>> ===================================================================== 
>>
>
Stefano Babic Nov. 16, 2020, 2:22 p.m. UTC | #10
On 16.11.20 14:11, Sava Jakovljev wrote:
> Hi Stefano,
> 
> Busy days, sorry - I tested the changes, all is as expected, thanks for
> merging it. 
> 

Ok, fine, thanks for reporting this.

Best regards,
Stefano Babic

> Cheers,
> Sava Jakovljev
> 
> Sava Jakovljev schrieb am Montag, 9. November 2020 um 22:08:09 UTC+1:
> 
>     Hi Stefano,
> 
>     Sorry for taking a long time to reply - I am back on SWUpdate
>     support from today again.
> 
>     Sounds good - I can do a small test run using our system and let you
>     know whether everything is fine.
> 
>     Cheers,
>     Sava Jakovljev
> 
>     Stefano Babic schrieb am Freitag, 6. November 2020 um 09:49:51 UTC+1:
> 
>         Hi Sava,
> 
>         On 29.10.20 18:25, Sava Jakovljev wrote:
>         > Hi Stefano,
>         >
>         > Yes, (1) imposes some restrictions that are best to be avoided. 
>         > I'll check your patch and let you know - thank you for your
>         effort -
>         > I'll come back to you regarding this ASAP.
>         >
> 
>         Independently for this, I realized that my patch is buggy running
>         multicore build. I have then written a "mix" between your patch
>         and my
>         patch, and I will post together with some improvements for the
>         library.
> 
>         Best regards,
>         Stefano Babic
> 
>         > Cheers,
>         > Sava Jakovljev
>         >
>         > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um
>         17:52:48 UTC+1:
>         >
>         > Hi Sava,
>         >
>         > On 29.10.20 17:18, Sava Jakovljev wrote:
>         > > HI Stefano,
>         > >
>         > > No, the problems with linking your proprietary licensed
>         programs
>         > > statically against LGPL libraries is a real one: your
>         proprietary
>         > > software then also falls under LGPL, as far as I know.
>         >
>         > Not that there is no issue with static linking, but reading
>         from here :
>         >
>         > https://www.gnu.org/licenses/gpl-faq.html#LGPLStaticVsDynamic
>         >
>         > Your application remains proprietary and not LGPL. Anyway, (1)
>         adds
>         > some
>         > issue that are easy removed with the shared library.
>         >
>         > > Although, there
>         > > is always some doubt when legal rules are interpreted by
>         software
>         > guys
>         > > (or anyone else, in that manner).
>         > >
>         > > I understand that we need to make sure that there are no
>         regressions
>         > > from this - but I also don't see anything that is not
>         solvable in
>         > more
>         > > or less easy manner.
>         >
>         > Check my patch and see if this works for you.
>         >
>         > > That's why I suggest a staged transition with a period of
>         testing and
>         > > consultation
>         > > - of course, this is your project and you know best how you
>         > > want to handle this - my stand-point is that it would make
>         it more
>         > > appealing and easier to use.
>         >
>         > Best regards,
>         > Stefano Babic
>         >
>         > >
>         > > Thank you.
>         > > Cheers,
>         > > Sava Jakovljev
>         > > Stefano Babic schrieb am Donnerstag, 29. Oktober 2020 um
>         17:11:23
>         > UTC+1:
>         > >
>         > > Hi Sava,
>         > >
>         > > On 29.10.20 13:23, Sava Jakovljev wrote:
>         > > > Hello Stefano,
>         > > >
>         > > >
>         > > > Why would we keep the static library? What is the benefit?
>         > >
>         > > Well, most packages provide both static and shared library.
>         It is a
>         > > choice for the developer to decide.
>         > >
>         > > The proble here is a sort of uncompatibility in case a new
>         > SWUpdate is
>         > > used with an old release - this is not officially supported,
>         but
>         > let's
>         > > say, there are people (and more important, customers..)
>         asking to
>         > > switch
>         > > to new version of package without switching to newer OE. And
>         the
>         > shared
>         > > library is not installed on older OE, it adds some more hassle.
>         > >
>         > > > Sure, the
>         > > > library is quite small, but nevertheless, in that way,
>         there is
>         > code
>         > > > duplication in all of swupdate processes.
>         > >
>         > > I understand your topic, I want to have a solution with as less
>         > > breakage
>         > > as possible. I will send briefly a patch as proposal to
>         support the
>         > > shared library with less changes, we can discuss afterwards.
>         > >
>         > > > How would other users be affected by switching to a shared
>         library?
>         > >
>         > > See above
>         > >
>         > > > We
>         > > > use it with vanilla meta-swupdate layer and it works.
>         > >
>         > > Exactly what I meant before, apoart of other use cases with
>         weird
>         > > combinations.
>         > >
>         > > > It doesn't break
>         > > > anything.
>         > > > There are also legal implications - having a static library
>         > licensed
>         > > > under LGPL is not a good option for external programs that
>         want to
>         > > use IPC.
>         > >
>         > > This is new and I do not think you're right. License is set
>         by the
>         > > author of software, independently if you link a static or
>         dynamic
>         > > library.
>         > >
>         > > > Of course, there is workaround for that - don't use the
>         library and
>         > > > implement IPC manually - but I'm more biased towards having a
>         > library
>         > > > used, because it is tested and proven.
>         > > >
>         > > > Of course, I would like few more people to test it, but I
>         don't
>         > > see how
>         > > > this could cause problems. Older binaries will still be
>         working,
>         > > since
>         > > > they linked the linked the library statically, newer will
>         use the
>         > > shared
>         > > > library.
>         > >
>         > > If the world could be so simple....
>         > >
>         > > Best regards,
>         > > Stefano Babic
>         > >
>         > > >
>         > > > Cheers,
>         > > > Best regards,
>         > > > Sava Jakovljev
>         > > > Stefano Babic schrieb am Mittwoch, 28. Oktober 2020 um
>         20:54:43
>         > > UTC+1:
>         > > >
>         > > > Hi Sava,
>         > > >
>         > > > On 27.10.20 16:38, Sava Jakovljev wrote:
>         > > > > Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
>         > > > > ---
>         > > > > Makefile | 53
>         > +++++++++++++++++++++++++++++++++++++++-------------
>         > > > > ipc/Makefile | 2 +-
>         > > > > 2 files changed, 41 insertions(+), 14 deletions(-)
>         > > > >
>         > > > > diff --git a/Makefile b/Makefile
>         > > > > index a94c50d..a3ea9b3 100644
>         > > > > --- a/Makefile
>         > > > > +++ b/Makefile
>         > > > > @@ -4,6 +4,8 @@ SUBLEVEL = 0
>         > > > > EXTRAVERSION =
>         > > > > NAME =
>         > > > >
>         > > > > +IPCLIB_VERSION = 0.1
>         > > > > +
>         > > > > # *DOCUMENTATION*
>         > > > > # To see a list of typical targets execute "make help"
>         > > > > # More info can be located in ./README
>         > > > > @@ -357,10 +359,16 @@ include $(srctree)/Makefile.flags
>         > > > > # Defaults to vmlinux, but the arch makefile usually
>         adds further
>         > > > targets
>         > > > >
>         > > > > objs-y := core handlers
>         > > > > -libs-y := corelib ipc mongoose parser suricatta bootloader
>         > > > > +libs-y := corelib mongoose parser suricatta bootloader
>         > > > > shareds-y := bindings
>         > > > > tools-y := tools
>         > > > > > +ipc-y := ipc
>         > > > > +ipc-lib := $(patsubst %,%/built-in.o, $(ipc-y))
>         > > > > +ipc-dirs := $(ipc-y)
>         > > > > +
>         > > > > +swupdate-ipc-lib := libswupdate_ipc.so.${IPCLIB_VERSION}
>         > > > > +
>         > > > > swupdate-dirs := $(objs-y) $(libs-y)
>         > > > > swupdate-objs := $(patsubst %,%/built-in.o, $(objs-y))
>         > > > > swupdate-libs := $(patsubst %,%/lib.a, $(libs-y))
>         > > > > @@ -400,12 +408,12 @@ quiet_cmd_swupdate = LD $@
>         > > > > "$@" \
>         > > > > "$(CC)" \
>         > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>         > > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>         > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
>         > -L$(srctree)" \
>         > > > > "$(swupdate-objs)" \
>         > > > > "$(swupdate-libs)" \
>         > > > > - "$(LDLIBS)"
>         > > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>         > > > >
>         > > > > -swupdate_unstripped: $(swupdate-all) FORCE
>         > > > > +swupdate_unstripped: ${swupdate-ipc-lib}
>         $(swupdate-all) FORCE
>         > > > > $(call if_changed,swupdate)
>         > > > >
>         > > > > quiet_cmd_addon = LD $@
>         > > > > @@ -413,10 +421,10 @@ quiet_cmd_addon = LD $@
>         > > > > "$@" \
>         > > > > "$(CC)" \
>         > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>         > > > > - "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>         > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
>         > -L$(srctree)" \
>         > > > > "$(2)" \
>         > > > > "$(swupdate-libs)" \
>         > > > > - "$(LDLIBS)"
>         > > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>         > > > >
>         > > > > quiet_cmd_shared = LD $@
>         > > > > cmd_shared = $(srctree)/scripts/trylink \
>         > > > > @@ -424,13 +432,28 @@ quiet_cmd_shared = LD $@
>         > > > > "$(CC)" \
>         > > > > "-shared -Wl,-soname,$@" \
>         > > > > "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>         > > > > + "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)
>         > -L$(srctree)" \
>         > > > > + "$(shared-libs)" \
>         > > > > + "" \
>         > > > > + "$(LDLIBS) :${swupdate-ipc-lib}"
>         > > > > +
>         > > > > +quiet_cmd_ipclib = LD $@
>         > > > > + cmd_ipclib = $(srctree)/scripts/trylink \
>         > > > > + "$@" \
>         > > > > + "$(CC)" \
>         > > > > + "-shared -Wl,-soname,$@" \
>         > > > > + "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
>         > > > > "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
>         > > > > - "$(shared-libs) ipc/lib.a" \
>         > > > > + "$(ipc-lib)" \
>         > > > > + "" \
>         > > > > "$(LDLIBS)"
>         > > >
>         > > > This is quite a duplication of the same command.
>         > > >
>         > > > It looks to me there is too much overhead. This patch
>         drops the
>         > > static
>         > > > library, why ? Static (as -dev package) and shared library
>         > should be
>         > > > both available. If this solves your problem having a
>         shared library
>         > > > without Lua, it creates issues for all of users (the
>         majority)
>         > > that do
>         > > > not need the library. I have the feeling this breaks build on
>         > > Yocto and
>         > > > maybe on Buildroot, too.
>         > > >
>         > > > >
>         > > > > -lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
>         > > > > +lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib}
>         FORCE
>         > > > > $(call if_changed,shared)
>         > > > >
>         > > > > +${swupdate-ipc-lib}: $(ipc-lib) FORCE
>         > > > > + $(call if_changed,ipclib)
>         > > > > +
>         > > > > ifeq ($(SKIP_STRIP),y)
>         > > > > quiet_cmd_strip = echo $@
>         > > > > cmd_strip = cp $@_unstripped $@
>         > > > > @@ -443,7 +466,7 @@ endif
>         > > > > swupdate: cfg-sanity-check swupdate_unstripped
>         > > > > $(call cmd,strip)
>         > > > >
>         > > > > -${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
>         > > > > +${tools-bins}: ${swupdate-ipc-lib} ${tools-objs}
>         > ${swupdate-libs}
>         > > > FORCE
>         > > > > $(call if_changed,addon,$@.o)
>         > > > > @mv $@ $@_unstripped
>         > > > > $(call cmd,strip)
>         > > > > @@ -459,7 +482,8 @@ install: all
>         > > > > install -m 0644 $(srctree)/include/network_ipc.h
>         > > > ${DESTDIR}/${INCLUDEDIR}
>         > > > > install -m 0644 $(srctree)/include/swupdate_status.h
>         > > > ${DESTDIR}/${INCLUDEDIR}
>         > > > > install -m 0644 $(srctree)/include/progress_ipc.h
>         > > > ${DESTDIR}/${INCLUDEDIR}
>         > > > > - install -m 0755 ipc/lib.a
>         ${DESTDIR}/${LIBDIR}/libswupdate.a
>         > > > > + install -m 0755 $(srctree)/${swupdate-ipc-lib}
>         > > ${DESTDIR}/${LIBDIR}
>         > > > > + ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib}
>         > > > ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
>         > > > > if [ $(HAVE_LUA) = y ]; then \
>         > > > > install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
>         > > > > install -m 0755 ${lua_swupdate}
>         > > $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
>         > > > > @@ -481,6 +505,7 @@ test:
>         > > > > $(sort $(swupdate-all)): $(swupdate-dirs) ;
>         > > > > $(sort $(tools-all)): $(tools-dirs) ;
>         > > > > $(sort $(shared-all)): $(shared-dirs) ;
>         > > > > +$(sort $(ipc-lib)): $(ipc-dirs) ;
>         > > > >
>         > > > > # Handle descending into subdirectories listed in
>         $(vmlinux-dirs)
>         > > > > # Preset locale variables to speed up the build process.
>         Limit
>         > > locale
>         > > > > @@ -488,13 +513,15 @@ $(sort $(shared-all)):
>         $(shared-dirs) ;
>         > > > > # make menuconfig etc.
>         > > > > # Error messages still appears in the original language
>         > > > >
>         > > > > -PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
>         > > > > +PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
>         > $(ipc-dirs)
>         > > > > $(swupdate-dirs): scripts
>         > > > > $(Q)$(MAKE) $(build)=$@
>         > > > > $(tools-dirs): scripts
>         > > > > $(Q)$(MAKE) $(build)=$@
>         > > > > $(shared-dirs): scripts
>         > > > > $(Q)$(MAKE) $(build)=$@
>         > > > > +$(ipc-dirs): scripts
>         > > > > + $(Q)$(MAKE) $(build)=$@
>         > > > >
>         > > > > ###
>         > > > > # Cleaning is done on three levels.
>         > > > > @@ -505,7 +532,7 @@ $(shared-dirs): scripts
>         > > > >
>         > > > > # Directories & files removed with 'make clean'
>         > > > > CLEAN_DIRS +=
>         > > > > -CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>         > > > ${tools-bins} \
>         > > > > +CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate*
>         > > > libswupdate_ipc* ${tools-bins} \
>         > > > > $(patsubst %,%_unstripped,$(tools-bins)) \
>         > > > > $(patsubst %,%.out,$(tools-bins)) \
>         > > > > $(patsubst %,%.map,$(tools-bins)) \
>         > > > > @@ -518,7 +545,7 @@ MRPROPER_FILES += .config
>         .config.old tags
>         > > > TAGS cscope* GPATH GTAGS GRTAGS GSYMS
>         > > > > #
>         > > > > clean: rm-dirs := $(CLEAN_DIRS)
>         > > > > clean: rm-files := $(CLEAN_FILES)
>         > > > > -clean-dirs := $(addprefix _clean_, $(swupdate-dirs)
>         > $(tools-dirs)
>         > > > $(shared-dirs) scripts/acceptance-tests)
>         > > > > +clean-dirs := $(addprefix _clean_, $(swupdate-dirs)
>         $(ipc-dirs)
>         > > > $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
>         > > > >
>         > > > > PHONY += $(clean-dirs) clean archclean
>         > > > > $(clean-dirs):
>         > > > > diff --git a/ipc/Makefile b/ipc/Makefile
>         > > > > index 5c12d3d..f634dce 100644
>         > > > > --- a/ipc/Makefile
>         > > > > +++ b/ipc/Makefile
>         > > > > @@ -1,6 +1,6 @@
>         > > > > # Copyright (C) 2014-2018 Stefano Babic <sba...@denx.de>
>         > > > > #
>         > > > > # SPDX-License-Identifier: GPL-2.0-or-later
>         > > > > -lib-y += network_ipc.o network_ipc-if.o progress_ipc.o
>         > > > > +obj-y += network_ipc.o network_ipc-if.o progress_ipc.o
>         > > > >
>         > > > > EXTRA_CFLAGS += -fPIC
>         > > > >
>         > > >
>         > > > Best regards,
>         > > > Stefano Babic
>         > > >
>         > > > --
>         > > >
>         >
>         =====================================================================
> 
>         > > > DENX Software Engineering GmbH, Managing Director:
>         Wolfgang Denk
>         > > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
>         > Germany
>         > > > Phone: +49-8142-66989-53 <tel:+49%208142%206698953>
>         <tel:+49%208142%206698953>
>         > <tel:+49%208142%206698953>
>         > > <tel:+49%208142%206698953> Fax:
>         > > > +49-8142-66989-80 <tel:+49%208142%206698980>
>         <tel:+49%208142%206698980>
>         > <tel:+49%208142%206698980>
>         > > <tel:+49%208142%206698980> Email: sba...@denx.de
>         > > >
>         >
>         =====================================================================
> 
>         > > >
>         > > > --
>         > > > You received this message because you are subscribed to
>         the Google
>         > > > Groups "swupdate" group.
>         > > > To unsubscribe from this group and stop receiving emails
>         from it,
>         > > send
>         > > > an email to swupdate+u...@googlegroups.com
>         > > > <mailto:swupdate+u...@googlegroups.com>.
>         > > > To view this discussion on the web visit
>         > > >
>         > >
>         >
>         https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com
> 
>         >
>         > >
>         > > >
>         > >
>         >
>         <https://groups.google.com/d/msgid/swupdate/b32f2ba7-9961-449e-9e01-e28b8a474ce0n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
>         >
>         > >
>         > >
>         > >
>         > > --
>         > >
>         =====================================================================
> 
>         > > DENX Software Engineering GmbH, Managing Director: Wolfgang
>         Denk
>         > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194
>         Groebenzell, Germany
>         > > Phone: +49-8142-66989-53 <tel:+49%208142%206698953>
>         <tel:+49%208142%206698953>
>         > <tel:+49%208142%206698953> Fax:
>         > > +49-8142-66989-80 <tel:+49%208142%206698980>
>         <tel:+49%208142%206698980>
>         > <tel:+49%208142%206698980> Email: sba...@denx.de
>         > >
>         =====================================================================
> 
>         > >
>         > > --
>         > > You received this message because you are subscribed to the
>         Google
>         > > Groups "swupdate" group.
>         > > To unsubscribe from this group and stop receiving emails
>         from it,
>         > send
>         > > an email to swupdate+u...@googlegroups.com
>         > > <mailto:swupdate+u...@googlegroups.com>.
>         > > To view this discussion on the web visit
>         > >
>         >
>         https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com
> 
>         >
>         > >
>         >
>         <https://groups.google.com/d/msgid/swupdate/9a613b4f-d13a-45f3-8037-85f9c7bf5fa2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
>         >
>         >
>         >
>         > --
>         >
>         =====================================================================
> 
>         > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>         > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
>         Germany
>         > Phone: +49-8142-66989-53 <tel:+49%208142%206698953>
>         <tel:+49%208142%206698953> Fax:
>         > +49-8142-66989-80 <tel:+49%208142%206698980>
>         <tel:+49%208142%206698980> Email: sba...@denx.de
>         >
>         =====================================================================
> 
>         >
>         > --
>         > You received this message because you are subscribed to the
>         Google
>         > Groups "swupdate" group.
>         > To unsubscribe from this group and stop receiving emails from
>         it, send
>         > an email to swupdate+u...@googlegroups.com
>         > <mailto:swupdate+u...@googlegroups.com>.
>         > To view this discussion on the web visit
>         >
>         https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com
> 
>         >
>         <https://groups.google.com/d/msgid/swupdate/329e3545-db19-4016-ad04-c6df89cb0a1bn%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> 
>         -- 
>         =====================================================================
> 
>         DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
>         HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
>         Germany
>         Phone: +49-8142-66989-53 <tel:+49%208142%206698953> Fax:
>         +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
>         =====================================================================
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/fa7f90bd-0f9a-41fe-b2ea-1f121a0b8306n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/fa7f90bd-0f9a-41fe-b2ea-1f121a0b8306n%40googlegroups.com?utm_medium=email&utm_source=footer>.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index a94c50d..a3ea9b3 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,8 @@  SUBLEVEL = 0
 EXTRAVERSION =
 NAME =
 
+IPCLIB_VERSION = 0.1
+
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
 # More info can be located in ./README
@@ -357,10 +359,16 @@  include $(srctree)/Makefile.flags
 # Defaults to vmlinux, but the arch makefile usually adds further targets
 
 objs-y		:= core handlers
-libs-y		:= corelib ipc mongoose parser suricatta bootloader
+libs-y		:= corelib mongoose parser suricatta bootloader
 shareds-y	:= bindings
 tools-y		:= tools
 
+ipc-y		:= ipc
+ipc-lib 	:= $(patsubst %,%/built-in.o, $(ipc-y))
+ipc-dirs 	:= $(ipc-y)
+
+swupdate-ipc-lib 	:= libswupdate_ipc.so.${IPCLIB_VERSION}
+
 swupdate-dirs	:= $(objs-y) $(libs-y)
 swupdate-objs	:= $(patsubst %,%/built-in.o, $(objs-y))
 swupdate-libs	:= $(patsubst %,%/lib.a, $(libs-y))
@@ -400,12 +408,12 @@  quiet_cmd_swupdate = LD      $@
       "$@" \
       "$(CC)" \
       "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
-      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
+      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
       "$(swupdate-objs)" \
       "$(swupdate-libs)" \
-      "$(LDLIBS)"
+	  "$(LDLIBS) :${swupdate-ipc-lib}"
 
-swupdate_unstripped: $(swupdate-all) FORCE
+swupdate_unstripped: ${swupdate-ipc-lib} $(swupdate-all) FORCE
 	$(call if_changed,swupdate)
 
 quiet_cmd_addon = LD      $@
@@ -413,10 +421,10 @@  quiet_cmd_addon = LD      $@
       "$@" \
       "$(CC)" \
       "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
-      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
+      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
       "$(2)" \
       "$(swupdate-libs)" \
-      "$(LDLIBS)"
+	  "$(LDLIBS) :${swupdate-ipc-lib}"
 
 quiet_cmd_shared = LD      $@
       cmd_shared = $(srctree)/scripts/trylink \
@@ -424,13 +432,28 @@  quiet_cmd_shared = LD      $@
       "$(CC)" \
       "-shared -Wl,-soname,$@" \
       "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
+      "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate) -L$(srctree)" \
+      "$(shared-libs)" \
+	  "" \
+	  "$(LDLIBS) :${swupdate-ipc-lib}"
+
+quiet_cmd_ipclib = LD      $@
+      cmd_ipclib = $(srctree)/scripts/trylink \
+      "$@" \
+      "$(CC)" \
+      "-shared -Wl,-soname,$@" \
+      "$(KBUILD_CFLAGS) $(CFLAGS_swupdate)" \
       "$(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_swupdate)" \
-      "$(shared-libs) ipc/lib.a" \
+      "$(ipc-lib)" \
+	  "" \
       "$(LDLIBS)"
 
-lua_swupdate.so.0.1: $(shared-libs) ${swupdate-libs} FORCE
+lua_swupdate.so.0.1: $(shared-libs) ${swupdate-ipc-lib} FORCE
 	$(call if_changed,shared)
 
+${swupdate-ipc-lib}: $(ipc-lib) FORCE
+	$(call if_changed,ipclib)
+
 ifeq ($(SKIP_STRIP),y)
 quiet_cmd_strip = echo $@
 cmd_strip = cp $@_unstripped $@
@@ -443,7 +466,7 @@  endif
 swupdate: cfg-sanity-check swupdate_unstripped
 	$(call cmd,strip)
 
-${tools-bins}: ${tools-objs} ${swupdate-libs} FORCE
+${tools-bins}: ${swupdate-ipc-lib} ${tools-objs} ${swupdate-libs} FORCE
 	$(call if_changed,addon,$@.o)
 	@mv $@ $@_unstripped
 	$(call cmd,strip)
@@ -459,7 +482,8 @@  install: all
 	install -m 0644 $(srctree)/include/network_ipc.h ${DESTDIR}/${INCLUDEDIR}
 	install -m 0644 $(srctree)/include/swupdate_status.h ${DESTDIR}/${INCLUDEDIR}
 	install -m 0644 $(srctree)/include/progress_ipc.h ${DESTDIR}/${INCLUDEDIR}
-	install -m 0755 ipc/lib.a ${DESTDIR}/${LIBDIR}/libswupdate.a
+	install -m 0755 $(srctree)/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}
+	ln -sr ${DESTDIR}/${LIBDIR}/${swupdate-ipc-lib} ${DESTDIR}/${LIBDIR}/libswupdate_ipc.so
 	if [ $(HAVE_LUA) = y ]; then \
 		install -d ${DESTDIR}/${LIBDIR}/lua/$(LUAVER); \
 		install -m 0755 ${lua_swupdate} $(DESTDIR)/${LIBDIR}/lua/$(LUAVER); \
@@ -481,6 +505,7 @@  test:
 $(sort $(swupdate-all)): $(swupdate-dirs) ;
 $(sort $(tools-all)): $(tools-dirs) ;
 $(sort $(shared-all)): $(shared-dirs) ;
+$(sort $(ipc-lib)): $(ipc-dirs) ;
 
 # Handle descending into subdirectories listed in $(vmlinux-dirs)
 # Preset locale variables to speed up the build process. Limit locale
@@ -488,13 +513,15 @@  $(sort $(shared-all)): $(shared-dirs) ;
 # make menuconfig etc.
 # Error messages still appears in the original language
 
-PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs)
+PHONY += $(swupdate-dirs) $(tools-dirs) $(shared-dirs) $(ipc-dirs)
 $(swupdate-dirs): scripts
 	$(Q)$(MAKE) $(build)=$@
 $(tools-dirs): scripts
 	$(Q)$(MAKE) $(build)=$@
 $(shared-dirs): scripts
 	$(Q)$(MAKE) $(build)=$@
+$(ipc-dirs): scripts
+	$(Q)$(MAKE) $(build)=$@
 
 ###
 # Cleaning is done on three levels.
@@ -505,7 +532,7 @@  $(shared-dirs): scripts
 
 # Directories & files removed with 'make clean'
 CLEAN_DIRS  +=
-CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* ${tools-bins} \
+CLEAN_FILES += swupdate swupdate_unstripped* lua_swupdate* libswupdate_ipc* ${tools-bins} \
 	$(patsubst %,%_unstripped,$(tools-bins)) \
 	$(patsubst %,%.out,$(tools-bins)) \
 	$(patsubst %,%.map,$(tools-bins)) \
@@ -518,7 +545,7 @@  MRPROPER_FILES += .config .config.old tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)
-clean-dirs      := $(addprefix _clean_, $(swupdate-dirs) $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
+clean-dirs      := $(addprefix _clean_, $(swupdate-dirs) $(ipc-dirs) $(tools-dirs) $(shared-dirs) scripts/acceptance-tests)
 
 PHONY += $(clean-dirs) clean archclean
 $(clean-dirs):
diff --git a/ipc/Makefile b/ipc/Makefile
index 5c12d3d..f634dce 100644
--- a/ipc/Makefile
+++ b/ipc/Makefile
@@ -1,6 +1,6 @@ 
 # Copyright (C) 2014-2018 Stefano Babic <sbabic@denx.de>
 #
 # SPDX-License-Identifier:     GPL-2.0-or-later
-lib-y			+= network_ipc.o network_ipc-if.o progress_ipc.o
+obj-y			+= network_ipc.o network_ipc-if.o progress_ipc.o
 
 EXTRA_CFLAGS += -fPIC