All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ebtables: extend the 'static' build target fix.
@ 2022-06-25  8:14 Justin Swartz
  2022-07-03  9:52 ` [PATCH resend] " Justin Swartz
  0 siblings, 1 reply; 5+ messages in thread
From: Justin Swartz @ 2022-06-25  8:14 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Robert Kolchmeyer, Justin Swartz

Assign "-all-static" (instead of "-static") to "static_LDFLAGS" in
Makefile.am, as libtool will only produce a static binary if it is
explicitly told that all of the linked libraries should be static.

BEFORE

$ file static
static: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV),
        dynamically linked, interpreter /lib/ld-musl-i386.so.1,
        not stripped

AFTER

$ file static
static: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
        statically linked, not stripped

REFERENCE

"Another common situation where static linking is desirable is in
 creating a standalone binary. Use libtool to do the linking and
 add the -all-static flag."  --  Libtool Manual, Section 3.7

Signed-off-by: Justin Swartz <justin.swartz@risingedge.co.za>
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index b246064..d011919 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,7 +51,7 @@ ebtablesd_LDADD = libebtc.la
 ebtables_legacy_restore_SOURCES = ebtables-restore.c
 ebtables_legacy_restore_LDADD = libebtc.la
 static_SOURCES = ebtables-standalone.c $(libebtc_la_SOURCES)
-static_LDFLAGS = -static
+static_LDFLAGS = -all-static
 examples_ulog_test_ulog_SOURCES = examples/ulog/test_ulog.c getethertype.c
 
 daemon: ebtablesd ebtablesu
-- 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH resend] ebtables: extend the 'static' build target fix.
  2022-06-25  8:14 [PATCH] ebtables: extend the 'static' build target fix Justin Swartz
@ 2022-07-03  9:52 ` Justin Swartz
  2022-07-28  8:13   ` Florian Westphal
  0 siblings, 1 reply; 5+ messages in thread
From: Justin Swartz @ 2022-07-03  9:52 UTC (permalink / raw)
  To: netfilter-devel; +Cc: justin.swartz, rkolchmeyer, fw, pablo

Assign "-all-static" (instead of "-static") to "static_LDFLAGS" in
Makefile.am, as libtool will only produce a static binary if it is
explicitly told that all of the linked libraries should be static.

BEFORE

$ file static
static: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV),
         dynamically linked, interpreter /lib/ld-musl-i386.so.1,
         not stripped

AFTER

$ file static
static: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
         statically linked, not stripped

REFERENCE

"Another common situation where static linking is desirable is in
  creating a standalone binary. Use libtool to do the linking and
  add the -all-static flag."  --  Libtool Manual, Section 3.7

Signed-off-by: Justin Swartz <justin.swartz@risingedge.co.za>
---
  Makefile.am | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index b246064..d011919 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,7 +51,7 @@ ebtablesd_LDADD = libebtc.la
  ebtables_legacy_restore_SOURCES = ebtables-restore.c
  ebtables_legacy_restore_LDADD = libebtc.la
  static_SOURCES = ebtables-standalone.c $(libebtc_la_SOURCES)
-static_LDFLAGS = -static
+static_LDFLAGS = -all-static
  examples_ulog_test_ulog_SOURCES = examples/ulog/test_ulog.c 
getethertype.c

  daemon: ebtablesd ebtablesu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH resend] ebtables: extend the 'static' build target fix.
  2022-07-03  9:52 ` [PATCH resend] " Justin Swartz
@ 2022-07-28  8:13   ` Florian Westphal
  2022-07-28  8:56     ` Justin Swartz
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2022-07-28  8:13 UTC (permalink / raw)
  To: Justin Swartz; +Cc: netfilter-devel, rkolchmeyer, pablo

Justin Swartz <justin.swartz@risingedge.co.za> wrote:
> Assign "-all-static" (instead of "-static") to "static_LDFLAGS" in
> Makefile.am, as libtool will only produce a static binary if it is
> explicitly told that all of the linked libraries should be static.

Before libtool conversion "make static" did not create a static binary
either.  It builds a version of ebtables that has libebtables.so 
baked in.

So, as far as I can see, "make static" does the same thing it
did prio to automake/libtool conversion, place all the extensions
and libebtables in the "static" binary, but link libc.so dynamically.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH resend] ebtables: extend the 'static' build target fix.
  2022-07-28  8:13   ` Florian Westphal
@ 2022-07-28  8:56     ` Justin Swartz
  2022-07-28 10:37       ` Florian Westphal
  0 siblings, 1 reply; 5+ messages in thread
From: Justin Swartz @ 2022-07-28  8:56 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, rkolchmeyer, pablo

On 2022-07-28 10:13, Florian Westphal wrote:
> Justin Swartz <justin.swartz@risingedge.co.za> wrote:
>> Assign "-all-static" (instead of "-static") to "static_LDFLAGS" in
>> Makefile.am, as libtool will only produce a static binary if it is
>> explicitly told that all of the linked libraries should be static.
> 
> Before libtool conversion "make static" did not create a static binary
> either.  It builds a version of ebtables that has libebtables.so
> baked in.
> 
> So, as far as I can see, "make static" does the same thing it
> did prio to automake/libtool conversion, place all the extensions
> and libebtables in the "static" binary, but link libc.so dynamically.

Thanks for the clarification.

I assumed "make static" was intended to produce an actual static binary.

As part of a small distribution that I use on a few bridging firewalls,
I have only ebtables and busybox, both built as static binaries, plus
inittab and a few init scripts.

I don't mind patching "Makefile.am" for myself, but I would also be 
happy
to submit something like the following, if nice-to-have, to provide an
"allstatic" which shouldn't break anything for those who require 
"static"
in its current form.

--%--

  sbin_PROGRAMS = ebtables-legacy ebtablesd ebtablesu 
ebtables-legacy-restore
-EXTRA_PROGRAMS = static examples/ulog/test_ulog
+EXTRA_PROGRAMS = allstatic static examples/ulog/test_ulog
  sysconf_DATA = ethertypes

  ...

  static_SOURCES = ebtables-standalone.c $(libebtc_la_SOURCES)
  static_LDFLAGS = -static
+allstatic_SOURCES = $(static_SOURCES)
+allstatic_LDFLAGS = -all-static
  examples_ulog_test_ulog_SOURCES = examples/ulog/test_ulog.c 
getethertype.c

--%--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH resend] ebtables: extend the 'static' build target fix.
  2022-07-28  8:56     ` Justin Swartz
@ 2022-07-28 10:37       ` Florian Westphal
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Westphal @ 2022-07-28 10:37 UTC (permalink / raw)
  To: Justin Swartz; +Cc: Florian Westphal, netfilter-devel, rkolchmeyer, pablo

Justin Swartz <justin.swartz@risingedge.co.za> wrote:
> > So, as far as I can see, "make static" does the same thing it
> > did prio to automake/libtool conversion, place all the extensions
> > and libebtables in the "static" binary, but link libc.so dynamically.
> 
> Thanks for the clarification.
> 
> I assumed "make static" was intended to produce an actual static binary.
> 
> As part of a small distribution that I use on a few bridging firewalls,
> I have only ebtables and busybox, both built as static binaries, plus
> inittab and a few init scripts.
> 
> I don't mind patching "Makefile.am" for myself, but I would also be happy
> to submit something like the following, if nice-to-have, to provide an
> "allstatic" which shouldn't break anything for those who require "static"
> in its current form.

If you can't get what you need without patching the ebables build
scripts then sure, feel free to submit a change that allows to build a
fully static binary.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-28 10:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-25  8:14 [PATCH] ebtables: extend the 'static' build target fix Justin Swartz
2022-07-03  9:52 ` [PATCH resend] " Justin Swartz
2022-07-28  8:13   ` Florian Westphal
2022-07-28  8:56     ` Justin Swartz
2022-07-28 10:37       ` Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.