* [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl @ 2016-09-19 10:50 Sakari Ailus 2016-09-19 11:22 ` Mauro Carvalho Chehab 2016-09-19 13:22 ` [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically Sakari Ailus 0 siblings, 2 replies; 15+ messages in thread From: Sakari Ailus @ 2016-09-19 10:50 UTC (permalink / raw) To: linux-media; +Cc: gjasny v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols are found by the linker only if these libraries are specified after the objects that depend on them. As LDFLAGS variable end up expanded on libtool command line before LDADD, move the libraries to LDADD after local objects. -lpthread is added as on some systems librt depends on libpthread. This is the case on Ubuntu 16.04 for instance. After this patch, creating a static build using the command LDFLAGS="--static -static" ./configure --disable-shared --enable-static works again. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- Hi, This patch fixes the static build; the error is: CXXLD v4l2-compliance ../../lib/libv4l2/.libs/libv4l2.a(libv4l2_la-v4l2-plugin.o): In function `v4l2_plugin_init': /home/sailus/a/v4l-utils/lib/libv4l2/v4l2-plugin.c:75: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/sailus/a/v4l-utils/lib/libv4lconvert/.libs/libv4lconvert.a(libv4lconvert_la-libv4lcontrol.o): In function `v4lcontrol_create': /home/sailus/a/v4l-utils/lib/libv4lconvert/control/libv4lcontrol.c:693: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(shm_open.o): In function `shm_open': (.text+0x1f): undefined reference to `__shm_directory' collect2: error: ld returned 1 exit status distcc[21660] ERROR: compile (null) on localhost failed Makefile:559: recipe for target 'v4l2-compliance' failed Kind regards, Sakari utils/v4l2-compliance/Makefile.am | 4 ++-- utils/v4l2-ctl/Makefile.am | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am index a895e8e..c2b5919 100644 --- a/utils/v4l2-compliance/Makefile.am +++ b/utils/v4l2-compliance/Makefile.am @@ -5,12 +5,12 @@ DEFS := v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-input-output.cpp \ v4l2-test-controls.cpp v4l2-test-io-config.cpp v4l2-test-formats.cpp v4l2-test-buffers.cpp \ v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h -v4l2_compliance_LDFLAGS = -lrt v4l2_compliance_CPPFLAGS = -I../common if WITH_V4L2_COMPLIANCE_LIBV4L -v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la +v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread else +v4l2_compliance_LDADD = -lrt -lpthread DEFS += -DNO_LIBV4L2 endif diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am index 56943cd..2a05644 100644 --- a/utils/v4l2-ctl/Makefile.am +++ b/utils/v4l2-ctl/Makefile.am @@ -7,11 +7,10 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \ v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c -v4l2_ctl_LDFLAGS = -lrt v4l2_ctl_CPPFLAGS = -I../common if WITH_V4L2_CTL_LIBV4L -v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la +v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread else DEFS += -DNO_LIBV4L2 endif -- 2.7.4 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-19 10:50 [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl Sakari Ailus @ 2016-09-19 11:22 ` Mauro Carvalho Chehab 2016-09-19 13:21 ` Sakari Ailus 2016-09-19 13:22 ` [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically Sakari Ailus 1 sibling, 1 reply; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-19 11:22 UTC (permalink / raw) To: Sakari Ailus; +Cc: linux-media, gjasny Em Mon, 19 Sep 2016 13:50:25 +0300 Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > are found by the linker only if these libraries are specified after the > objects that depend on them. > > As LDFLAGS variable end up expanded on libtool command line before LDADD, > move the libraries to LDADD after local objects. -lpthread is added as on > some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > for instance. > > After this patch, creating a static build using the command > > LDFLAGS="--static -static" ./configure --disable-shared --enable-static It sounds weird to use LDFLAGS="--static -static" here, as the configure options are already asking for static. IMHO, the right way would be to change configure.ac to add those LDFLAGS when --disable-shared is used. Regards, Mauro > > works again. > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > Hi, > > This patch fixes the static build; the error is: > > CXXLD v4l2-compliance > ../../lib/libv4l2/.libs/libv4l2.a(libv4l2_la-v4l2-plugin.o): In function `v4l2_plugin_init': > /home/sailus/a/v4l-utils/lib/libv4l2/v4l2-plugin.c:75: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking > /home/sailus/a/v4l-utils/lib/libv4lconvert/.libs/libv4lconvert.a(libv4lconvert_la-libv4lcontrol.o): In function `v4lcontrol_create': > /home/sailus/a/v4l-utils/lib/libv4lconvert/control/libv4lcontrol.c:693: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking > /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/librt.a(shm_open.o): In function `shm_open': > (.text+0x1f): undefined reference to `__shm_directory' > collect2: error: ld returned 1 exit status > distcc[21660] ERROR: compile (null) on localhost failed > Makefile:559: recipe for target 'v4l2-compliance' failed > > Kind regards, > Sakari > > utils/v4l2-compliance/Makefile.am | 4 ++-- > utils/v4l2-ctl/Makefile.am | 3 +-- > 2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am > index a895e8e..c2b5919 100644 > --- a/utils/v4l2-compliance/Makefile.am > +++ b/utils/v4l2-compliance/Makefile.am > @@ -5,12 +5,12 @@ DEFS := > v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-input-output.cpp \ > v4l2-test-controls.cpp v4l2-test-io-config.cpp v4l2-test-formats.cpp v4l2-test-buffers.cpp \ > v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h > -v4l2_compliance_LDFLAGS = -lrt > v4l2_compliance_CPPFLAGS = -I../common > > if WITH_V4L2_COMPLIANCE_LIBV4L > -v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la > +v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread > else > +v4l2_compliance_LDADD = -lrt -lpthread > DEFS += -DNO_LIBV4L2 > endif > > diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am > index 56943cd..2a05644 100644 > --- a/utils/v4l2-ctl/Makefile.am > +++ b/utils/v4l2-ctl/Makefile.am > @@ -7,11 +7,10 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp > v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \ > v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ > v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c > -v4l2_ctl_LDFLAGS = -lrt > v4l2_ctl_CPPFLAGS = -I../common > > if WITH_V4L2_CTL_LIBV4L > -v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la > +v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread > else > DEFS += -DNO_LIBV4L2 > endif Thanks, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-19 11:22 ` Mauro Carvalho Chehab @ 2016-09-19 13:21 ` Sakari Ailus 2016-09-19 14:19 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2016-09-19 13:21 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: linux-media, gjasny Hi Mauro, On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > Em Mon, 19 Sep 2016 13:50:25 +0300 > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols >> are found by the linker only if these libraries are specified after the >> objects that depend on them. >> >> As LDFLAGS variable end up expanded on libtool command line before LDADD, >> move the libraries to LDADD after local objects. -lpthread is added as on >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 >> for instance. >> >> After this patch, creating a static build using the command >> >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > It sounds weird to use LDFLAGS="--static -static" here, as the > configure options are already asking for static. > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > when --disable-shared is used. That's one option, but then shared libraries won't be built at all. I'm not sure what would be the use cases for that, though: static linking isn't very commonly needed except when you need to run the binaries elsewhere (for whatever reason) where you don't have the libraries you linked against available. That's still a separate issue from what this patch fixes. Ideally it should be possible to link the binaries statically while still building shared libraries: both are built by default right now, yet shared libraries are always used for linking unless you disable shared libraries. Most of the time this makes sense but not always. I'm sending a separate patch to fix that by adding --with-static-binaries option. -- Sakari Ailus sakari.ailus@linux.intel.com ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-19 13:21 ` Sakari Ailus @ 2016-09-19 14:19 ` Mauro Carvalho Chehab 2016-09-26 15:46 ` Sakari Ailus 0 siblings, 1 reply; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-19 14:19 UTC (permalink / raw) To: Sakari Ailus; +Cc: linux-media, gjasny Em Mon, 19 Sep 2016 16:21:30 +0300 Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > Hi Mauro, > > On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > > Em Mon, 19 Sep 2016 13:50:25 +0300 > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > >> are found by the linker only if these libraries are specified after the > >> objects that depend on them. > >> > >> As LDFLAGS variable end up expanded on libtool command line before LDADD, > >> move the libraries to LDADD after local objects. -lpthread is added as on > >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > >> for instance. > >> > >> After this patch, creating a static build using the command > >> > >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > > > It sounds weird to use LDFLAGS="--static -static" here, as the > > configure options are already asking for static. > > > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > > when --disable-shared is used. > > That's one option, but then shared libraries won't be built at all. Well, my understanding is that --disable-shared is meant to disable building the shared library build :) > I'm > not sure what would be the use cases for that, though: static linking > isn't very commonly needed except when you need to run the binaries > elsewhere (for whatever reason) where you don't have the libraries you > linked against available. Yeah, that's the common usage. It is also interesting if someone wants to build 2 versions of the same utility, each using a different library, for testing purposes. The usecase I can't see is to use --disable-shared but keeping using the dynamic library for the exec files. > That's still a separate issue from what this patch fixes. > > Ideally it should be possible to link the binaries statically while > still building shared libraries: both are built by default right now, > yet shared libraries are always used for linking unless you disable > shared libraries. Well, the point is: if dynamic library build is disabled, it should be doing static links that are produced by the build, instead of using an already existing set of dynamic libraries present on the system (that may not contain the symbols needed by the tool, or miss some patches that were on -git). > Most of the time this makes sense but not always. > > I'm sending a separate patch to fix that by adding > --with-static-binaries option. > Thanks, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-19 14:19 ` Mauro Carvalho Chehab @ 2016-09-26 15:46 ` Sakari Ailus 2016-09-26 16:59 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2016-09-26 15:46 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Sakari Ailus, linux-media, gjasny Hi Mauro, On Mon, Sep 19, 2016 at 11:19:12AM -0300, Mauro Carvalho Chehab wrote: > Em Mon, 19 Sep 2016 16:21:30 +0300 > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > Hi Mauro, > > > > On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > > > Em Mon, 19 Sep 2016 13:50:25 +0300 > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > > >> are found by the linker only if these libraries are specified after the > > >> objects that depend on them. > > >> > > >> As LDFLAGS variable end up expanded on libtool command line before LDADD, > > >> move the libraries to LDADD after local objects. -lpthread is added as on > > >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > > >> for instance. > > >> > > >> After this patch, creating a static build using the command > > >> > > >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > > > > > It sounds weird to use LDFLAGS="--static -static" here, as the > > > configure options are already asking for static. > > > > > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > > > when --disable-shared is used. > > > > That's one option, but then shared libraries won't be built at all. > > Well, my understanding is that --disable-shared is meant to disable > building the shared library build :) > > > I'm > > not sure what would be the use cases for that, though: static linking > > isn't very commonly needed except when you need to run the binaries > > elsewhere (for whatever reason) where you don't have the libraries you > > linked against available. > > Yeah, that's the common usage. It is also interesting if someone > wants to build 2 versions of the same utility, each using a > different library, for testing purposes. > > The usecase I can't see is to use --disable-shared but keeping > using the dynamic library for the exec files. There are three primary options here, 1. build an entirely static binary, 2. build a binary that relies on dynamic libraries as well and 3. build a binary that relies on dynamic libraries outside v4l-utils package but that links v4l-utils originating libraries statically. If you say 3. is not needed then we could just use --disable-shared also to tell that static binaries are to be built. 3. is always used for libv4l2subdev and libmediactl as the libraries do not have stable APIs. > > > That's still a separate issue from what this patch fixes. > > > > Ideally it should be possible to link the binaries statically while > > still building shared libraries: both are built by default right now, > > yet shared libraries are always used for linking unless you disable > > shared libraries. > > Well, the point is: if dynamic library build is disabled, it should > be doing static links that are produced by the build, instead of using > an already existing set of dynamic libraries present on the system > (that may not contain the symbols needed by the tool, or miss some > patches that were on -git). No, it uses the static libraries that are built at the same time. -- Kind regards, Sakari Ailus e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-26 15:46 ` Sakari Ailus @ 2016-09-26 16:59 ` Mauro Carvalho Chehab 2016-09-26 21:40 ` Sakari Ailus 0 siblings, 1 reply; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-26 16:59 UTC (permalink / raw) To: Sakari Ailus; +Cc: Sakari Ailus, linux-media, gjasny Em Mon, 26 Sep 2016 18:46:40 +0300 Sakari Ailus <sakari.ailus@iki.fi> escreveu: > Hi Mauro, > > On Mon, Sep 19, 2016 at 11:19:12AM -0300, Mauro Carvalho Chehab wrote: > > Em Mon, 19 Sep 2016 16:21:30 +0300 > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > Hi Mauro, > > > > > > On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > > > > Em Mon, 19 Sep 2016 13:50:25 +0300 > > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > > > >> are found by the linker only if these libraries are specified after the > > > >> objects that depend on them. > > > >> > > > >> As LDFLAGS variable end up expanded on libtool command line before LDADD, > > > >> move the libraries to LDADD after local objects. -lpthread is added as on > > > >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > > > >> for instance. > > > >> > > > >> After this patch, creating a static build using the command > > > >> > > > >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > > > > > > > It sounds weird to use LDFLAGS="--static -static" here, as the > > > > configure options are already asking for static. > > > > > > > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > > > > when --disable-shared is used. > > > > > > That's one option, but then shared libraries won't be built at all. > > > > Well, my understanding is that --disable-shared is meant to disable > > building the shared library build :) > > > > > I'm > > > not sure what would be the use cases for that, though: static linking > > > isn't very commonly needed except when you need to run the binaries > > > elsewhere (for whatever reason) where you don't have the libraries you > > > linked against available. > > > > Yeah, that's the common usage. It is also interesting if someone > > wants to build 2 versions of the same utility, each using a > > different library, for testing purposes. > > > > The usecase I can't see is to use --disable-shared but keeping > > using the dynamic library for the exec files. > > There are three primary options here, > > 1. build an entirely static binary, > 2. build a binary that relies on dynamic libraries as well and > 3. build a binary that relies on dynamic libraries outside v4l-utils package > but that links v4l-utils originating libraries statically. > > If you say 3. is not needed then we could just use --disable-shared also to > tell that static binaries are to be built. > > 3. is always used for libv4l2subdev and libmediactl as the libraries do not > have stable APIs. Sakari, I can't see what you mean by scenario (2). I mean, if --disable-shared is called, it *should not* use dynamic libraries for any library provided by v4l-utils, as the generated binaries will either: a) don't work, because those libraries weren't built; b) will do the wrong thing, as they'll be dynamically linked to an older version of the library. So, there are only 3 possible scenarios, IMHO: 1) dynamic libraries, dynamic execs 2) static v4l-utils libraries, static execs 3) static v4l-utils libraries, static links for v4l-utils libs, dyn for the rest. In practice, I don't see any reason for keeping support for both (2) and (3), as all usecases for (3) can be covered by a fully static exec. It is also very confusing for one to understand that. For example, right now, we have those static/shared options: --enable-static[=PKGS] build static libraries [default=yes] --enable-shared[=PKGS] build shared libraries [default=yes] with, IMHO, sounds confusing, as those options don't seem to be orthogonal. I mean, what happens someone calls ./configure with: ./configure --disable-static --disable-shared Thanks, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-26 16:59 ` Mauro Carvalho Chehab @ 2016-09-26 21:40 ` Sakari Ailus 2016-09-27 16:04 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2016-09-26 21:40 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Sakari Ailus, linux-media, gjasny Hi Mauro, On Mon, Sep 26, 2016 at 01:59:45PM -0300, Mauro Carvalho Chehab wrote: > Em Mon, 26 Sep 2016 18:46:40 +0300 > Sakari Ailus <sakari.ailus@iki.fi> escreveu: > > > Hi Mauro, > > > > On Mon, Sep 19, 2016 at 11:19:12AM -0300, Mauro Carvalho Chehab wrote: > > > Em Mon, 19 Sep 2016 16:21:30 +0300 > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > Hi Mauro, > > > > > > > > On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > > > > > Em Mon, 19 Sep 2016 13:50:25 +0300 > > > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > > > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > > > > >> are found by the linker only if these libraries are specified after the > > > > >> objects that depend on them. > > > > >> > > > > >> As LDFLAGS variable end up expanded on libtool command line before LDADD, > > > > >> move the libraries to LDADD after local objects. -lpthread is added as on > > > > >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > > > > >> for instance. > > > > >> > > > > >> After this patch, creating a static build using the command > > > > >> > > > > >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > > > > > > > > > It sounds weird to use LDFLAGS="--static -static" here, as the > > > > > configure options are already asking for static. > > > > > > > > > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > > > > > when --disable-shared is used. > > > > > > > > That's one option, but then shared libraries won't be built at all. > > > > > > Well, my understanding is that --disable-shared is meant to disable > > > building the shared library build :) > > > > > > > I'm > > > > not sure what would be the use cases for that, though: static linking > > > > isn't very commonly needed except when you need to run the binaries > > > > elsewhere (for whatever reason) where you don't have the libraries you > > > > linked against available. > > > > > > Yeah, that's the common usage. It is also interesting if someone > > > wants to build 2 versions of the same utility, each using a > > > different library, for testing purposes. > > > > > > The usecase I can't see is to use --disable-shared but keeping > > > using the dynamic library for the exec files. > > > > There are three primary options here, > > > > 1. build an entirely static binary, > > 2. build a binary that relies on dynamic libraries as well and > > 3. build a binary that relies on dynamic libraries outside v4l-utils package > > but that links v4l-utils originating libraries statically. > > > > If you say 3. is not needed then we could just use --disable-shared also to > > tell that static binaries are to be built. > > > > 3. is always used for libv4l2subdev and libmediactl as the libraries do not > > have stable APIs. > > Sakari, > > I can't see what you mean by scenario (2). I mean, if > --disable-shared is called, it *should not* use dynamic libraries > for any library provided by v4l-utils, as the generated binaries will > either: > > a) don't work, because those libraries weren't built; > b) will do the wrong thing, as they'll be dynamically linked > to an older version of the library. > > So, there are only 3 possible scenarios, IMHO: > > 1) dynamic libraries, dynamic execs > 2) static v4l-utils libraries, static execs > 3) static v4l-utils libraries, static links for v4l-utils libs, dyn for the rest. > > In practice, I don't see any reason for keeping support for both (2) > and (3), as all usecases for (3) can be covered by a fully static > exec. It is also very confusing for one to understand that. > For example, right now, we have those static/shared options: > > --enable-static[=PKGS] build static libraries [default=yes] > --enable-shared[=PKGS] build shared libraries [default=yes] > > with, IMHO, sounds confusing, as those options don't seem to be > orthogonal. I mean, what happens someone calls ./configure with: > > ./configure --disable-static --disable-shared That doesn't make much sense --- to disable the build for both static and dynamic libraries. What would you prefer? Link binaries statically iff shared libraries are not built? I'd just like to get this fixed. Currently building static binaries is simply broken. -- Regards, Sakari Ailus e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-26 21:40 ` Sakari Ailus @ 2016-09-27 16:04 ` Mauro Carvalho Chehab 2016-09-27 17:35 ` Mauro Carvalho Chehab 0 siblings, 1 reply; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-27 16:04 UTC (permalink / raw) To: Sakari Ailus; +Cc: Sakari Ailus, linux-media, gjasny Em Tue, 27 Sep 2016 00:40:51 +0300 Sakari Ailus <sakari.ailus@iki.fi> escreveu: > Hi Mauro, > > On Mon, Sep 26, 2016 at 01:59:45PM -0300, Mauro Carvalho Chehab wrote: > > Em Mon, 26 Sep 2016 18:46:40 +0300 > > Sakari Ailus <sakari.ailus@iki.fi> escreveu: > > > > > Hi Mauro, > > > > > > On Mon, Sep 19, 2016 at 11:19:12AM -0300, Mauro Carvalho Chehab wrote: > > > > Em Mon, 19 Sep 2016 16:21:30 +0300 > > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > > > Hi Mauro, > > > > > > > > > > On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > > > > > > Em Mon, 19 Sep 2016 13:50:25 +0300 > > > > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > > > > > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > > > > > >> are found by the linker only if these libraries are specified after the > > > > > >> objects that depend on them. > > > > > >> > > > > > >> As LDFLAGS variable end up expanded on libtool command line before LDADD, > > > > > >> move the libraries to LDADD after local objects. -lpthread is added as on > > > > > >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > > > > > >> for instance. > > > > > >> > > > > > >> After this patch, creating a static build using the command > > > > > >> > > > > > >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > > > > > > > > > > > It sounds weird to use LDFLAGS="--static -static" here, as the > > > > > > configure options are already asking for static. > > > > > > > > > > > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > > > > > > when --disable-shared is used. > > > > > > > > > > That's one option, but then shared libraries won't be built at all. > > > > > > > > Well, my understanding is that --disable-shared is meant to disable > > > > building the shared library build :) > > > > > > > > > I'm > > > > > not sure what would be the use cases for that, though: static linking > > > > > isn't very commonly needed except when you need to run the binaries > > > > > elsewhere (for whatever reason) where you don't have the libraries you > > > > > linked against available. > > > > > > > > Yeah, that's the common usage. It is also interesting if someone > > > > wants to build 2 versions of the same utility, each using a > > > > different library, for testing purposes. > > > > > > > > The usecase I can't see is to use --disable-shared but keeping > > > > using the dynamic library for the exec files. > > > > > > There are three primary options here, > > > > > > 1. build an entirely static binary, > > > 2. build a binary that relies on dynamic libraries as well and > > > 3. build a binary that relies on dynamic libraries outside v4l-utils package > > > but that links v4l-utils originating libraries statically. > > > > > > If you say 3. is not needed then we could just use --disable-shared also to > > > tell that static binaries are to be built. > > > > > > 3. is always used for libv4l2subdev and libmediactl as the libraries do not > > > have stable APIs. > > > > Sakari, > > > > I can't see what you mean by scenario (2). I mean, if > > --disable-shared is called, it *should not* use dynamic libraries > > for any library provided by v4l-utils, as the generated binaries will > > either: > > > > a) don't work, because those libraries weren't built; > > b) will do the wrong thing, as they'll be dynamically linked > > to an older version of the library. > > > > So, there are only 3 possible scenarios, IMHO: > > > > 1) dynamic libraries, dynamic execs > > 2) static v4l-utils libraries, static execs > > 3) static v4l-utils libraries, static links for v4l-utils libs, dyn for the rest. > > > > In practice, I don't see any reason for keeping support for both (2) > > and (3), as all usecases for (3) can be covered by a fully static > > exec. It is also very confusing for one to understand that. > > For example, right now, we have those static/shared options: > > > > --enable-static[=PKGS] build static libraries [default=yes] > > --enable-shared[=PKGS] build shared libraries [default=yes] > > > > with, IMHO, sounds confusing, as those options don't seem to be > > orthogonal. I mean, what happens someone calls ./configure with: > > > > ./configure --disable-static --disable-shared > > That doesn't make much sense --- to disable the build for both static and > dynamic libraries. Yes, but it is still a "valid" set of options, as configure won't complain. Yet, this will cause build errors: /usr/bin/ld: ../../lib/libdvbv5/.libs/libdvbv5.a(libdvbv5_la-dvb-dev-local.o): undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5' /usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status > What would you prefer? Link binaries statically iff shared libraries are not > built? I'd just like to get this fixed. Currently building static binaries > is simply broken. IMHO, if --disable-shared is issued, it should do static linking for all libraries. Gregor may have a different opinion, as I think he knows a lot more about how distros usually expect those options to be handled. Thanks, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl 2016-09-27 16:04 ` Mauro Carvalho Chehab @ 2016-09-27 17:35 ` Mauro Carvalho Chehab 0 siblings, 0 replies; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-27 17:35 UTC (permalink / raw) To: Sakari Ailus; +Cc: Sakari Ailus, linux-media, gjasny Em Tue, 27 Sep 2016 13:04:07 -0300 Mauro Carvalho Chehab <mchehab@s-opensource.com> escreveu: > Em Tue, 27 Sep 2016 00:40:51 +0300 > Sakari Ailus <sakari.ailus@iki.fi> escreveu: > > > Hi Mauro, > > > > On Mon, Sep 26, 2016 at 01:59:45PM -0300, Mauro Carvalho Chehab wrote: > > > Em Mon, 26 Sep 2016 18:46:40 +0300 > > > Sakari Ailus <sakari.ailus@iki.fi> escreveu: > > > > > > > Hi Mauro, > > > > > > > > On Mon, Sep 19, 2016 at 11:19:12AM -0300, Mauro Carvalho Chehab wrote: > > > > > Em Mon, 19 Sep 2016 16:21:30 +0300 > > > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > > > > > Hi Mauro, > > > > > > > > > > > > On 09/19/16 14:22, Mauro Carvalho Chehab wrote: > > > > > > > Em Mon, 19 Sep 2016 13:50:25 +0300 > > > > > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > > > > > > > > > >> v4l2-compliance and v4l2-ctl depend on librt and libpthread. The symbols > > > > > > >> are found by the linker only if these libraries are specified after the > > > > > > >> objects that depend on them. > > > > > > >> > > > > > > >> As LDFLAGS variable end up expanded on libtool command line before LDADD, > > > > > > >> move the libraries to LDADD after local objects. -lpthread is added as on > > > > > > >> some systems librt depends on libpthread. This is the case on Ubuntu 16.04 > > > > > > >> for instance. > > > > > > >> > > > > > > >> After this patch, creating a static build using the command > > > > > > >> > > > > > > >> LDFLAGS="--static -static" ./configure --disable-shared --enable-static > > > > > > > > > > > > > > It sounds weird to use LDFLAGS="--static -static" here, as the > > > > > > > configure options are already asking for static. > > > > > > > > > > > > > > IMHO, the right way would be to change configure.ac to add those LDFLAGS > > > > > > > when --disable-shared is used. > > > > > > > > > > > > That's one option, but then shared libraries won't be built at all. > > > > > > > > > > Well, my understanding is that --disable-shared is meant to disable > > > > > building the shared library build :) > > > > > > > > > > > I'm > > > > > > not sure what would be the use cases for that, though: static linking > > > > > > isn't very commonly needed except when you need to run the binaries > > > > > > elsewhere (for whatever reason) where you don't have the libraries you > > > > > > linked against available. > > > > > > > > > > Yeah, that's the common usage. It is also interesting if someone > > > > > wants to build 2 versions of the same utility, each using a > > > > > different library, for testing purposes. > > > > > > > > > > The usecase I can't see is to use --disable-shared but keeping > > > > > using the dynamic library for the exec files. > > > > > > > > There are three primary options here, > > > > > > > > 1. build an entirely static binary, > > > > 2. build a binary that relies on dynamic libraries as well and > > > > 3. build a binary that relies on dynamic libraries outside v4l-utils package > > > > but that links v4l-utils originating libraries statically. > > > > > > > > If you say 3. is not needed then we could just use --disable-shared also to > > > > tell that static binaries are to be built. > > > > > > > > 3. is always used for libv4l2subdev and libmediactl as the libraries do not > > > > have stable APIs. > > > > > > Sakari, > > > > > > I can't see what you mean by scenario (2). I mean, if > > > --disable-shared is called, it *should not* use dynamic libraries > > > for any library provided by v4l-utils, as the generated binaries will > > > either: > > > > > > a) don't work, because those libraries weren't built; > > > b) will do the wrong thing, as they'll be dynamically linked > > > to an older version of the library. > > > > > > So, there are only 3 possible scenarios, IMHO: > > > > > > 1) dynamic libraries, dynamic execs > > > 2) static v4l-utils libraries, static execs > > > 3) static v4l-utils libraries, static links for v4l-utils libs, dyn for the rest. > > > > > > In practice, I don't see any reason for keeping support for both (2) > > > and (3), as all usecases for (3) can be covered by a fully static > > > exec. It is also very confusing for one to understand that. > > > For example, right now, we have those static/shared options: > > > > > > --enable-static[=PKGS] build static libraries [default=yes] > > > --enable-shared[=PKGS] build shared libraries [default=yes] > > > > > > with, IMHO, sounds confusing, as those options don't seem to be > > > orthogonal. I mean, what happens someone calls ./configure with: > > > > > > ./configure --disable-static --disable-shared > > > > That doesn't make much sense --- to disable the build for both static and > > dynamic libraries. > > Yes, but it is still a "valid" set of options, as configure won't > complain. Yet, this will cause build errors: > > /usr/bin/ld: ../../lib/libdvbv5/.libs/libdvbv5.a(libdvbv5_la-dvb-dev-local.o): undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5' > /usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line > collect2: error: ld returned 1 exit status Double-checked: configure will ignore --disable-static if --disable-shared is used. The above is actually a problem with libdvbv5 and pthread. I pushed a patch fixing it (and another one to display the options. > > What would you prefer? Link binaries statically iff shared libraries are not > > built? I'd just like to get this fixed. Currently building static binaries > > is simply broken. > > IMHO, if --disable-shared is issued, it should do static linking for > all libraries. > > Gregor may have a different opinion, as I think he knows a lot more > about how distros usually expect those options to be handled. After doing some tests and re-checking the patches you're proposing, patch 1 actually seems OK to me. I'm applying it. Yet, I guess we have another issues here: 1) libv4l1 and qv4l2 just assumes that pthread is available, instead of relying on the autoconf check. 2) static builds don't work here (Fedora 24, x86-64). I tried to do a build with: LDFLAGS="--static -static" ./configure --disable-shared --enable-static after applying your patch. It didn't work: /devel-/devv4l/-v4l-utils/liblocal.o): In/libdvbv5 function/dvb- `handle_device_changedev-local.c:305': /devel/: undefined reference v4lto/ `udev_enumerate_get_list_entry' /v4ldevel-/v4lutils//libv4l/-libdvbv5/dvb-devutils/lib/libdvbv5-local.c:/187: undefineddvb -reference devto-local.c:310 :` undefinedudev_device_get_sysattr_value 'reference to ` udev_list_entry_get_name/'devel/v4l/v4l /devel/v4l-utils/lib//libdvbv5v4l/-utils/lib/dvblibdvbv5-/dvb-devdev--local.c:312:local.c :undefined188: undefined referencereference to to `udev_device_new_from_syspath`' ../udev_device_get_sysattr_value' /devel././lib/v4llibdvbv5//.libs/v4llibdvbv5.a-(libdvbv5_lautils-dvb-dev-/local.olib):/ libdvbv5/Indvb-dev-local.c:116: undefined reference to `udev_device_get_devnode' ../../lib/libdvbv5/.libs/libdvbv5.a(libdvbv5_la-dvb-dev-local.o): In function `dvb_local_find': /devel/v4l/v4l-utils/lib/libdvbv5/dvb-dev-local.c:332: undefined reference to `udev_unref' collect2: error: ld returned 1 exit status function `handle_device_change': /devel/v4l/v4l-utils/lib/libdvbv5/dvb-dev-local.c:124: undefined reference to `udev_device_get_devnode' /devel/v4l/v4l-utils/lib/libdvbv5/dvb-dev-local.c:131: undefined reference to `udev_device_get_property_value' ... Basically, at least on my system, libsystemd doesn't come with a static libudev. In thesis, this should actually be the syntax for static builds, in order to let pkg-config to know that it will be doing a static build: PKG_CONFIG="pkg-config --static" LDFLAGS="--static -static" ./configure --disable-shared --enable-static But it still fails to link. So, I guess that, if you want to fix for static build, you'll need to add some additional checks at the configure.ac for it to verify if the information returned by pkg-config really works for static build, disabling the packages if not. Regards, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically 2016-09-19 10:50 [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl Sakari Ailus 2016-09-19 11:22 ` Mauro Carvalho Chehab @ 2016-09-19 13:22 ` Sakari Ailus 2016-09-19 14:21 ` Mauro Carvalho Chehab 1 sibling, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2016-09-19 13:22 UTC (permalink / raw) To: linux-media; +Cc: mchehab, gjasny Add a new variable STATIC_LDFLAGS to add the linker flags required for static linking for each binary built. Static and dynamic libraries are built by default but the binaries are otherwise linked dynamically. --with-static-binaries requires that static libraries are built. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- configure.ac | 5 +++++ contrib/gconv/Makefile.am | 4 ++-- contrib/test/Makefile.am | 8 ++++---- lib/libv4l1/Makefile.am | 2 +- lib/libv4l2/Makefile.am | 2 +- utils/cec-compliance/Makefile.am | 2 +- utils/cec-ctl/Makefile.am | 1 + utils/cec-follower/Makefile.am | 2 +- utils/cx18-ctl/Makefile.am | 1 + utils/decode_tm6000/Makefile.am | 2 +- utils/dvb/Makefile.am | 10 +++++----- utils/ir-ctl/Makefile.am | 2 +- utils/ivtv-ctl/Makefile.am | 2 +- utils/keytable/Makefile.am | 2 +- utils/media-ctl/Makefile.am | 1 + utils/qv4l2/Makefile.am | 6 +++--- utils/rds-ctl/Makefile.am | 2 +- utils/v4l2-compliance/Makefile.am | 1 + utils/v4l2-ctl/Makefile.am | 1 + utils/v4l2-sysfs-path/Makefile.am | 2 +- 20 files changed, 34 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 0d416b0..91597a4 100644 --- a/configure.ac +++ b/configure.ac @@ -427,6 +427,11 @@ AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x${enable_v4l2_compliance_li # append -static to libtool compile and link command to enforce static libs AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])]) AS_IF([test x$enable_libv4l = xno], [AC_SUBST([ENFORCE_LIBV4L_STATIC], ["-static"])]) +AC_ARG_WITH([static-binaries], AS_HELP_STRING([--with-static-binaries], [link binaries statically, requires static libraries to be built])) +AS_IF([test x$with_static_binaries = xyes], + [AS_IF([test x$enable_static = xno], + [AC_MSG_ERROR([--with-static-binaries requires --enable-static])])] + [AC_SUBST([STATIC_LDFLAGS], ["--static -static"])]) # misc diff --git a/contrib/gconv/Makefile.am b/contrib/gconv/Makefile.am index 0e89f5b..2a39e5e 100644 --- a/contrib/gconv/Makefile.am +++ b/contrib/gconv/Makefile.am @@ -9,9 +9,9 @@ gconv_base_sources = iconv/skeleton.c iconv/loop.c arib-std-b24.c, en300-468-tab00.c: $(gconv_base_sources) ARIB_STD_B24_la_SOURCES = arib-std-b24.c jis0201.h jis0208.h jisx0213.h -ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R @gconvsysdir@ -lJIS -lJISX0213 +ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R @gconvsysdir@ -lJIS -lJISX0213 $(STATIC_LDFLAGS) EN300_468_TAB00_la_SOURCES = en300-468-tab00.c -EN300_468_TAB00_la_LDFLAGS = $(gconv_ldflags) +EN300_468_TAB00_la_LDFLAGS = $(gconv_ldflags) $(STATIC_LDFLAGS) EXTRA_DIST = $(gconv_base_sources) $(gconv_DATA) gconv.map diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am index 4641e21..7914f72 100644 --- a/contrib/test/Makefile.am +++ b/contrib/test/Makefile.am @@ -21,18 +21,18 @@ driver_test_LDADD = ../../utils/libv4l2util/libv4l2util.la pixfmt_test_SOURCES = pixfmt-test.c pixfmt_test_CFLAGS = $(X11_CFLAGS) -pixfmt_test_LDFLAGS = $(X11_LIBS) +pixfmt_test_LDFLAGS = $(X11_LIBS) $(STATIC_LDFLAGS) v4l2grab_SOURCES = v4l2grab.c -v4l2grab_LDFLAGS = $(ARGP_LIBS) +v4l2grab_LDFLAGS = $(ARGP_LIBS) $(STATIC_LDFLAGS) v4l2grab_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lpthread v4l2gl_SOURCES = v4l2gl.c -v4l2gl_LDFLAGS = $(X11_LIBS) $(GL_LIBS) $(GLU_LIBS) $(ARGP_LIBS) +v4l2gl_LDFLAGS = $(X11_LIBS) $(GL_LIBS) $(GLU_LIBS) $(ARGP_LIBS) $(STATIC_LDFLAGS) v4l2gl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la mc_nextgen_test_CFLAGS = $(LIBUDEV_CFLAGS) -mc_nextgen_test_LDFLAGS = $(LIBUDEV_LIBS) +mc_nextgen_test_LDFLAGS = $(LIBUDEV_LIBS) $(STATIC_LDFLAGS) ioctl_test_SOURCES = ioctl-test.c ioctl-test.h ioctl_32.h ioctl_64.h diff --git a/lib/libv4l1/Makefile.am b/lib/libv4l1/Makefile.am index f768eaa..ea1fdf0 100644 --- a/lib/libv4l1/Makefile.am +++ b/lib/libv4l1/Makefile.am @@ -23,7 +23,7 @@ libv4l1_la_LIBADD = ../libv4l2/libv4l2.la v4l1compat_la_SOURCES = v4l1compat.c v4l1compat_la_LIBADD = libv4l1.la -v4l1compat_la_LDFLAGS = -avoid-version -module -shared -export-dynamic +v4l1compat_la_LDFLAGS = -avoid-version -module -shared -export-dynamic $(STATIC_LDFLAGS) v4l1compat_la_LIBTOOLFLAGS = --tag=disable-static EXTRA_DIST = libv4l1-kernelcode-license.txt diff --git a/lib/libv4l2/Makefile.am b/lib/libv4l2/Makefile.am index 1314a99..316d2e0 100644 --- a/lib/libv4l2/Makefile.am +++ b/lib/libv4l2/Makefile.am @@ -22,7 +22,7 @@ libv4l2_la_LIBADD = ../libv4lconvert/libv4lconvert.la v4l2convert_la_SOURCES = v4l2convert.c v4l2convert_la_LIBADD = libv4l2.la -v4l2convert_la_LDFLAGS = -avoid-version -module -shared -export-dynamic +v4l2convert_la_LDFLAGS = -avoid-version -module -shared -export-dynamic $(STATIC_LDFLAGS) v4l2convert_la_LIBTOOLFLAGS = --tag=disable-static EXTRA_DIST = Android.mk v4l2-plugin-android.c diff --git a/utils/cec-compliance/Makefile.am b/utils/cec-compliance/Makefile.am index 8b0c4f3..f831122 100644 --- a/utils/cec-compliance/Makefile.am +++ b/utils/cec-compliance/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = cec-compliance man_MANS = cec-compliance.1 cec_compliance_SOURCES = cec-compliance.cpp cec-test.cpp cec-test-adapter.cpp cec-test-audio.cpp cec-test-power.cpp -cec_compliance_LDFLAGS = -lrt +cec_compliance_LDFLAGS = -lrt $(STATIC_LDFLAGS) cec-compliance.cpp: cec-table.h diff --git a/utils/cec-ctl/Makefile.am b/utils/cec-ctl/Makefile.am index c11fbfa..f5e2cc5 100644 --- a/utils/cec-ctl/Makefile.am +++ b/utils/cec-ctl/Makefile.am @@ -2,6 +2,7 @@ bin_PROGRAMS = cec-ctl man_MANS = cec-ctl.1 cec_ctl_SOURCES = cec-ctl.cpp +cec_ctl_LDFLAGS = $(STATIC_LDFLAGS) cec-ctl.cpp: cec-ctl-gen.h diff --git a/utils/cec-follower/Makefile.am b/utils/cec-follower/Makefile.am index 835c7a8..48d6f53 100644 --- a/utils/cec-follower/Makefile.am +++ b/utils/cec-follower/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS = cec-follower man_MANS = cec-follower.1 cec_follower_SOURCES = cec-follower.cpp cec-processing.cpp cec-log.cpp -cec_follower_LDFLAGS = -lrt +cec_follower_LDFLAGS = -lrt $(STATIC_LDFLAGS) cec-log.cpp: cec-log.h diff --git a/utils/cx18-ctl/Makefile.am b/utils/cx18-ctl/Makefile.am index 94fce36..71e2100 100644 --- a/utils/cx18-ctl/Makefile.am +++ b/utils/cx18-ctl/Makefile.am @@ -1,3 +1,4 @@ bin_PROGRAMS = cx18-ctl cx18_ctl_SOURCES = cx18-ctl.c +cx18_ctl_LDFLAGS = $(STATIC_LDFLAGS) diff --git a/utils/decode_tm6000/Makefile.am b/utils/decode_tm6000/Makefile.am index ac4e85e..7c3fbef 100644 --- a/utils/decode_tm6000/Makefile.am +++ b/utils/decode_tm6000/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS = decode_tm6000 decode_tm6000_SOURCES = decode_tm6000.c decode_tm6000_LDADD = ../libv4l2util/libv4l2util.la -decode_tm6000_LDFLAGS = $(ARGP_LIBS) +decode_tm6000_LDFLAGS = $(ARGP_LIBS) $(STATIC_LDFLAGS) diff --git a/utils/dvb/Makefile.am b/utils/dvb/Makefile.am index d2f9b53..619f508 100644 --- a/utils/dvb/Makefile.am +++ b/utils/dvb/Makefile.am @@ -9,23 +9,23 @@ man_MANS = dvb-fe-tool.1 dvbv5-zap.1 dvbv5-scan.1 dvb-format-convert.1 dvb_fe_tool_SOURCES = dvb-fe-tool.c dvb_fe_tool_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) -dvb_fe_tool_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) +dvb_fe_tool_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(STATIC_LDFLAGS) dvbv5_zap_SOURCES = dvbv5-zap.c dvbv5_zap_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) -dvbv5_zap_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) +dvbv5_zap_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(STATIC_LDFLAGS) dvbv5_scan_SOURCES = dvbv5-scan.c dvbv5_scan_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) -dvbv5_scan_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) +dvbv5_scan_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(STATIC_LDFLAGS) dvb_format_convert_SOURCES = dvb-format-convert.c dvb_format_convert_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) -dvb_format_convert_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) +dvb_format_convert_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(STATIC_LDFLAGS) dvbv5_daemon_SOURCES = dvbv5-daemon.c dvbv5_daemon_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) $(PTHREAD_LDADD) -dvbv5_daemon_LDFLAGS = $(ARGP_LIBS) -lm $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) +dvbv5_daemon_LDFLAGS = $(ARGP_LIBS) -lm $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) $(STATIC_LDFLAGS) dvbv5_daemon_CFLAGS = $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) EXTRA_DIST = README diff --git a/utils/ir-ctl/Makefile.am b/utils/ir-ctl/Makefile.am index 9a1bfed..bfe85ef 100644 --- a/utils/ir-ctl/Makefile.am +++ b/utils/ir-ctl/Makefile.am @@ -3,4 +3,4 @@ man_MANS = ir-ctl.1 ir_ctl_SOURCES = ir-ctl.c ir_ctl_LDADD = @LIBINTL@ -ir_ctl_LDFLAGS = $(ARGP_LIBS) +ir_ctl_LDFLAGS = $(ARGP_LIBS) $(STATIC_LDFLAGS) diff --git a/utils/ivtv-ctl/Makefile.am b/utils/ivtv-ctl/Makefile.am index c119667..76509a0 100644 --- a/utils/ivtv-ctl/Makefile.am +++ b/utils/ivtv-ctl/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS = ivtv-ctl ivtv_ctl_SOURCES = ivtv-ctl.c -ivtv_ctl_LDFLAGS = -lm +ivtv_ctl_LDFLAGS = -lm $(STATIC_LDFLAGS) diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index 62b90ad..aa33996 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -6,7 +6,7 @@ udevrules_DATA = 70-infrared.rules ir_keytable_SOURCES = keytable.c parse.h ir_keytable_LDADD = @LIBINTL@ -ir_keytable_LDFLAGS = $(ARGP_LIBS) +ir_keytable_LDFLAGS = $(ARGP_LIBS) $(STATIC_LDFLAGS) EXTRA_DIST = 70-infrared.rules rc_keymaps rc_keymaps_userspace gen_keytables.pl ir-keytable.1 rc_maps.cfg diff --git a/utils/media-ctl/Makefile.am b/utils/media-ctl/Makefile.am index ee7dcc9..35684e9 100644 --- a/utils/media-ctl/Makefile.am +++ b/utils/media-ctl/Makefile.am @@ -26,4 +26,5 @@ noinst_HEADERS = mediactl.h v4l2subdev.h bin_PROGRAMS = media-ctl media_ctl_SOURCES = media-ctl.c options.c options.h tools.h +media_ctl_LDFLAGS = $(STATIC_LDFLAGS) media_ctl_LDADD = libmediactl.la libv4l2subdev.la diff --git a/utils/qv4l2/Makefile.am b/utils/qv4l2/Makefile.am index fd58486..fc8827d 100644 --- a/utils/qv4l2/Makefile.am +++ b/utils/qv4l2/Makefile.am @@ -12,14 +12,14 @@ qv4l2_CPPFLAGS = -I../common if WITH_QTGL qv4l2_CPPFLAGS += $(QTGL_CFLAGS) -qv4l2_LDFLAGS = $(QTGL_LIBS) +qv4l2_LDFLAGS = $(QTGL_LIBS) $(STATIC_LDFLAGS) else qv4l2_CPPFLAGS += $(QT_CFLAGS) -qv4l2_LDFLAGS = $(QT_LIBS) +qv4l2_LDFLAGS = $(QT_LIBS) $(STATIC_LDFLAGS) endif qv4l2_CPPFLAGS += $(ALSA_CFLAGS) -qv4l2_LDFLAGS += $(ALSA_LIBS) -pthread +qv4l2_LDFLAGS += $(ALSA_LIBS) -pthread $(STATIC_LDFLAGS) EXTRA_DIST = enterbutt.png exit.png fileopen.png qv4l2_24x24.png qv4l2_64x64.png qv4l2.png qv4l2.svg \ snapshot.png video-television.png fileclose.png qv4l2_16x16.png qv4l2_32x32.png qv4l2.desktop \ diff --git a/utils/rds-ctl/Makefile.am b/utils/rds-ctl/Makefile.am index df546ad..8600118 100644 --- a/utils/rds-ctl/Makefile.am +++ b/utils/rds-ctl/Makefile.am @@ -2,4 +2,4 @@ bin_PROGRAMS = rds-ctl rds_ctl_SOURCES = rds-ctl.cpp rds_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la ../../lib/libv4l2rds/libv4l2rds.la - +rds_ctl_LDFLAGS = $(STATIC_LDFLAGS) diff --git a/utils/v4l2-compliance/Makefile.am b/utils/v4l2-compliance/Makefile.am index c2b5919..8363e45 100644 --- a/utils/v4l2-compliance/Makefile.am +++ b/utils/v4l2-compliance/Makefile.am @@ -6,6 +6,7 @@ v4l2_compliance_SOURCES = v4l2-compliance.cpp v4l2-test-debug.cpp v4l2-test-inpu v4l2-test-controls.cpp v4l2-test-io-config.cpp v4l2-test-formats.cpp v4l2-test-buffers.cpp \ v4l2-test-codecs.cpp v4l2-test-colors.cpp v4l2-compliance.h v4l2_compliance_CPPFLAGS = -I../common +v4l2_compliance_LDFLAGS = $(STATIC_LDFLAGS) if WITH_V4L2_COMPLIANCE_LIBV4L v4l2_compliance_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am index 2a05644..674f0c4 100644 --- a/utils/v4l2-ctl/Makefile.am +++ b/utils/v4l2-ctl/Makefile.am @@ -8,6 +8,7 @@ v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cp v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp v4l2-ctl-modes.cpp \ v4l2-tpg-colors.c v4l2-tpg-core.c v4l-stream.c v4l2_ctl_CPPFLAGS = -I../common +v4l2_ctl_LDFLAGS = $(STATIC_LDFLAGS) if WITH_V4L2_CTL_LIBV4L v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lrt -lpthread diff --git a/utils/v4l2-sysfs-path/Makefile.am b/utils/v4l2-sysfs-path/Makefile.am index 6ef4228..d6deede 100644 --- a/utils/v4l2-sysfs-path/Makefile.am +++ b/utils/v4l2-sysfs-path/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS = v4l2-sysfs-path v4l2_sysfs_path_SOURCES = v4l2-sysfs-path.c v4l2_sysfs_path_LDADD = ../libmedia_dev/libmedia_dev.la -v4l2_sysfs_path_LDFLAGS = $(ARGP_LIBS) +v4l2_sysfs_path_LDFLAGS = $(ARGP_LIBS) $(STATIC_LDFLAGS) -- 2.7.4 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically 2016-09-19 13:22 ` [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically Sakari Ailus @ 2016-09-19 14:21 ` Mauro Carvalho Chehab 2016-09-19 14:34 ` Sakari Ailus 2016-09-26 17:41 ` Gregor Jasny 0 siblings, 2 replies; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-19 14:21 UTC (permalink / raw) To: Sakari Ailus; +Cc: linux-media, gjasny Em Mon, 19 Sep 2016 16:22:30 +0300 Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > Add a new variable STATIC_LDFLAGS to add the linker flags required for > static linking for each binary built. > > Static and dynamic libraries are built by default but the binaries are > otherwise linked dynamically. --with-static-binaries requires that static > libraries are built. > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > configure.ac | 5 +++++ > contrib/gconv/Makefile.am | 4 ++-- > contrib/test/Makefile.am | 8 ++++---- > lib/libv4l1/Makefile.am | 2 +- > lib/libv4l2/Makefile.am | 2 +- > utils/cec-compliance/Makefile.am | 2 +- > utils/cec-ctl/Makefile.am | 1 + > utils/cec-follower/Makefile.am | 2 +- > utils/cx18-ctl/Makefile.am | 1 + > utils/decode_tm6000/Makefile.am | 2 +- > utils/dvb/Makefile.am | 10 +++++----- > utils/ir-ctl/Makefile.am | 2 +- > utils/ivtv-ctl/Makefile.am | 2 +- > utils/keytable/Makefile.am | 2 +- > utils/media-ctl/Makefile.am | 1 + > utils/qv4l2/Makefile.am | 6 +++--- > utils/rds-ctl/Makefile.am | 2 +- > utils/v4l2-compliance/Makefile.am | 1 + > utils/v4l2-ctl/Makefile.am | 1 + > utils/v4l2-sysfs-path/Makefile.am | 2 +- > 20 files changed, 34 insertions(+), 24 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 0d416b0..91597a4 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -427,6 +427,11 @@ AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x${enable_v4l2_compliance_li > # append -static to libtool compile and link command to enforce static libs > AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])]) > AS_IF([test x$enable_libv4l = xno], [AC_SUBST([ENFORCE_LIBV4L_STATIC], ["-static"])]) > +AC_ARG_WITH([static-binaries], AS_HELP_STRING([--with-static-binaries], [link binaries statically, requires static libraries to be built])) > +AS_IF([test x$with_static_binaries = xyes], > + [AS_IF([test x$enable_static = xno], > + [AC_MSG_ERROR([--with-static-binaries requires --enable-static])])] > + [AC_SUBST([STATIC_LDFLAGS], ["--static -static"])]) > > # misc > > diff --git a/contrib/gconv/Makefile.am b/contrib/gconv/Makefile.am > index 0e89f5b..2a39e5e 100644 > --- a/contrib/gconv/Makefile.am > +++ b/contrib/gconv/Makefile.am > @@ -9,9 +9,9 @@ gconv_base_sources = iconv/skeleton.c iconv/loop.c > arib-std-b24.c, en300-468-tab00.c: $(gconv_base_sources) > > ARIB_STD_B24_la_SOURCES = arib-std-b24.c jis0201.h jis0208.h jisx0213.h > -ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R @gconvsysdir@ -lJIS -lJISX0213 > +ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R @gconvsysdir@ -lJIS -lJISX0213 $(STATIC_LDFLAGS) Instead of adding STATIC_LDFLAGS to all LDFLAGS, wouldn't be better to add the flags to LDFLAGS on configure.ac? Regards, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically 2016-09-19 14:21 ` Mauro Carvalho Chehab @ 2016-09-19 14:34 ` Sakari Ailus 2016-09-26 17:41 ` Gregor Jasny 1 sibling, 0 replies; 15+ messages in thread From: Sakari Ailus @ 2016-09-19 14:34 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Sakari Ailus, linux-media, gjasny Hi Mauro, On Mon, Sep 19, 2016 at 11:21:50AM -0300, Mauro Carvalho Chehab wrote: > Em Mon, 19 Sep 2016 16:22:30 +0300 > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > Add a new variable STATIC_LDFLAGS to add the linker flags required for > > static linking for each binary built. > > > > Static and dynamic libraries are built by default but the binaries are > > otherwise linked dynamically. --with-static-binaries requires that static > > libraries are built. > > > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > --- > > configure.ac | 5 +++++ > > contrib/gconv/Makefile.am | 4 ++-- > > contrib/test/Makefile.am | 8 ++++---- > > lib/libv4l1/Makefile.am | 2 +- > > lib/libv4l2/Makefile.am | 2 +- > > utils/cec-compliance/Makefile.am | 2 +- > > utils/cec-ctl/Makefile.am | 1 + > > utils/cec-follower/Makefile.am | 2 +- > > utils/cx18-ctl/Makefile.am | 1 + > > utils/decode_tm6000/Makefile.am | 2 +- > > utils/dvb/Makefile.am | 10 +++++----- > > utils/ir-ctl/Makefile.am | 2 +- > > utils/ivtv-ctl/Makefile.am | 2 +- > > utils/keytable/Makefile.am | 2 +- > > utils/media-ctl/Makefile.am | 1 + > > utils/qv4l2/Makefile.am | 6 +++--- > > utils/rds-ctl/Makefile.am | 2 +- > > utils/v4l2-compliance/Makefile.am | 1 + > > utils/v4l2-ctl/Makefile.am | 1 + > > utils/v4l2-sysfs-path/Makefile.am | 2 +- > > 20 files changed, 34 insertions(+), 24 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 0d416b0..91597a4 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -427,6 +427,11 @@ AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x${enable_v4l2_compliance_li > > # append -static to libtool compile and link command to enforce static libs > > AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])]) > > AS_IF([test x$enable_libv4l = xno], [AC_SUBST([ENFORCE_LIBV4L_STATIC], ["-static"])]) > > +AC_ARG_WITH([static-binaries], AS_HELP_STRING([--with-static-binaries], [link binaries statically, requires static libraries to be built])) > > +AS_IF([test x$with_static_binaries = xyes], > > + [AS_IF([test x$enable_static = xno], > > + [AC_MSG_ERROR([--with-static-binaries requires --enable-static])])] > > + [AC_SUBST([STATIC_LDFLAGS], ["--static -static"])]) > > > > # misc > > > > diff --git a/contrib/gconv/Makefile.am b/contrib/gconv/Makefile.am > > index 0e89f5b..2a39e5e 100644 > > --- a/contrib/gconv/Makefile.am > > +++ b/contrib/gconv/Makefile.am > > @@ -9,9 +9,9 @@ gconv_base_sources = iconv/skeleton.c iconv/loop.c > > arib-std-b24.c, en300-468-tab00.c: $(gconv_base_sources) > > > > ARIB_STD_B24_la_SOURCES = arib-std-b24.c jis0201.h jis0208.h jisx0213.h > > -ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R @gconvsysdir@ -lJIS -lJISX0213 > > +ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R @gconvsysdir@ -lJIS -lJISX0213 $(STATIC_LDFLAGS) > > Instead of adding STATIC_LDFLAGS to all LDFLAGS, wouldn't be better to > add the flags to LDFLAGS on configure.ac? That would affect libraries as well, which would break the build for shared libraries, say, if you just pass --with-static-binaries, you'll get both static and shared libraries as well as static binaries. -- Sakari Ailus e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically 2016-09-19 14:21 ` Mauro Carvalho Chehab 2016-09-19 14:34 ` Sakari Ailus @ 2016-09-26 17:41 ` Gregor Jasny 2016-09-26 18:02 ` Mauro Carvalho Chehab 1 sibling, 1 reply; 15+ messages in thread From: Gregor Jasny @ 2016-09-26 17:41 UTC (permalink / raw) To: Mauro Carvalho Chehab, Sakari Ailus; +Cc: linux-media On 19/09/2016 16:21, Mauro Carvalho Chehab wrote: > Em Mon, 19 Sep 2016 16:22:30 +0300 > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > >> Add a new variable STATIC_LDFLAGS to add the linker flags required for >> static linking for each binary built. >> >> Static and dynamic libraries are built by default but the binaries are >> otherwise linked dynamically. --with-static-binaries requires that static >> libraries are built. >> > Instead of adding STATIC_LDFLAGS to all LDFLAGS, wouldn't be better to > add the flags to LDFLAGS on configure.ac? I don't really like adding all those build variants into the configure script itself. It is already way too complex and adding another dimension does not make it better. Why is passing --disable-shared --enable-static LDLAGS="--static -static" to configure not sufficient? Thanks, Gregor ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically 2016-09-26 17:41 ` Gregor Jasny @ 2016-09-26 18:02 ` Mauro Carvalho Chehab 2018-02-22 9:02 ` Sakari Ailus 0 siblings, 1 reply; 15+ messages in thread From: Mauro Carvalho Chehab @ 2016-09-26 18:02 UTC (permalink / raw) To: Gregor Jasny; +Cc: Sakari Ailus, linux-media Em Mon, 26 Sep 2016 19:41:39 +0200 Gregor Jasny <gjasny@googlemail.com> escreveu: > On 19/09/2016 16:21, Mauro Carvalho Chehab wrote: > > Em Mon, 19 Sep 2016 16:22:30 +0300 > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > >> Add a new variable STATIC_LDFLAGS to add the linker flags required for > >> static linking for each binary built. > >> > >> Static and dynamic libraries are built by default but the binaries are > >> otherwise linked dynamically. --with-static-binaries requires that static > >> libraries are built. > >> > > Instead of adding STATIC_LDFLAGS to all LDFLAGS, wouldn't be better to > > add the flags to LDFLAGS on configure.ac? > > I don't really like adding all those build variants into the configure > script itself. It is already way too complex and adding another > dimension does not make it better. > > Why is passing --disable-shared --enable-static LDLAGS="--static > -static" to configure not sufficient? That sounds better than adding an extra STATIC_LDFLAGS option, but, IMHO, this sounds confusing, and it is not documented. The advantage of having an option is that the expected behavior can be documented in a way that the user will know what each option would be doing by calling ./configure --help. Yet, IMHO, the above parameters don't make clear about what type of output for executable files (static, dynamic, "partially" dynamic). We could (should?) also print, at the ./configure "summary" what kind of libraries will be generated and what kind of executables. Thanks, Mauro ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically 2016-09-26 18:02 ` Mauro Carvalho Chehab @ 2018-02-22 9:02 ` Sakari Ailus 0 siblings, 0 replies; 15+ messages in thread From: Sakari Ailus @ 2018-02-22 9:02 UTC (permalink / raw) To: Mauro Carvalho Chehab; +Cc: Gregor Jasny, Sakari Ailus, linux-media Hi guys, On Mon, Sep 26, 2016 at 03:02:53PM -0300, Mauro Carvalho Chehab wrote: > Em Mon, 26 Sep 2016 19:41:39 +0200 > Gregor Jasny <gjasny@googlemail.com> escreveu: > > > On 19/09/2016 16:21, Mauro Carvalho Chehab wrote: > > > Em Mon, 19 Sep 2016 16:22:30 +0300 > > > Sakari Ailus <sakari.ailus@linux.intel.com> escreveu: > > > > > >> Add a new variable STATIC_LDFLAGS to add the linker flags required for > > >> static linking for each binary built. > > >> > > >> Static and dynamic libraries are built by default but the binaries are > > >> otherwise linked dynamically. --with-static-binaries requires that static > > >> libraries are built. > > >> > > > Instead of adding STATIC_LDFLAGS to all LDFLAGS, wouldn't be better to > > > add the flags to LDFLAGS on configure.ac? > > > > I don't really like adding all those build variants into the configure > > script itself. It is already way too complex and adding another > > dimension does not make it better. > > > > Why is passing --disable-shared --enable-static LDLAGS="--static > > -static" to configure not sufficient? > > That sounds better than adding an extra STATIC_LDFLAGS option, but, > IMHO, this sounds confusing, and it is not documented. > > The advantage of having an option is that the expected behavior > can be documented in a way that the user will know what each option > would be doing by calling ./configure --help. Yet, IMHO, the above > parameters don't make clear about what type of output for executable > files (static, dynamic, "partially" dynamic). > > We could (should?) also print, at the ./configure "summary" what > kind of libraries will be generated and what kind of executables. It's an old thread... anyway, the INSTALL file is another option to put this. I'd just like that it'd be easy for people to find this information rather than require them to figure it out somehow. Not everyone is an expert in autoconf / automake --- certainly not me at least. Another advantage of documenting this is that it tends to get tested more widely and if it doesn't work, it's obvious that it's broken rather than v4l-utils is being built the wrong way. So, configure help text or INSTALL? -- Regards, Sakari Ailus e-mail: sakari.ailus@iki.fi ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2018-02-22 9:02 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-09-19 10:50 [v4l-utils PATCH 1/1] Fix static linking of v4l2-compliance and v4l2-ctl Sakari Ailus 2016-09-19 11:22 ` Mauro Carvalho Chehab 2016-09-19 13:21 ` Sakari Ailus 2016-09-19 14:19 ` Mauro Carvalho Chehab 2016-09-26 15:46 ` Sakari Ailus 2016-09-26 16:59 ` Mauro Carvalho Chehab 2016-09-26 21:40 ` Sakari Ailus 2016-09-27 16:04 ` Mauro Carvalho Chehab 2016-09-27 17:35 ` Mauro Carvalho Chehab 2016-09-19 13:22 ` [v4l-utils PATCH 2/2] Add --with-static-binaries option to link binaries statically Sakari Ailus 2016-09-19 14:21 ` Mauro Carvalho Chehab 2016-09-19 14:34 ` Sakari Ailus 2016-09-26 17:41 ` Gregor Jasny 2016-09-26 18:02 ` Mauro Carvalho Chehab 2018-02-22 9:02 ` Sakari Ailus
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).