* [Buildroot] [PATCH] openssh: fix static linking
@ 2014-09-09 18:29 ANDY KENNEDY
2014-09-09 18:37 ` Baruch Siach
2014-09-09 19:34 ` Thomas Petazzoni
0 siblings, 2 replies; 6+ messages in thread
From: ANDY KENNEDY @ 2014-09-09 18:29 UTC (permalink / raw)
To: buildroot
When BR2_PREFER_STATIC_LIB is set, openssl is a static library, openssh
attempts to build dynamically as the LDFLAGS are dropped out of this build.
If PREFER_STATIC is set, add back in --static to the LDFLAGS of openssh
to make the linker happy.
Signed-off-by: Andy Kennedy <andy.kennedy@adtran.com>
---
diff -Naur a/package/openssh/openssh.mk b/package/openssh/openssh.mk
--- a/package/openssh/openssh.mk 2014-02-27 14:51:23.000000000 -0600
+++ b/package/openssh/openssh.mk 2014-09-09 12:09:57.043850866 -0500
@@ -6,10 +6,18 @@
OPENSSH_VERSION = 6.5p1
OPENSSH_SITE = http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
-OPENSSH_CONF_ENV = LD="$(TARGET_CC)" LDFLAGS="$(TARGET_CFLAGS)"
+OPENSSH_CONF_ENV = LD="$(TARGET_CC)"
OPENSSH_CONF_OPT = --disable-lastlog --disable-utmp \
--disable-utmpx --disable-wtmp --disable-wtmpx --disable-strip
+OPENSSH_LDFLAGS_FOR_CONF = $(TARGET_CFLAGS)
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+OPENSSH_LDFLAGS_FOR_CONF += --static
+endif
+
+OPENSSH_CONFIGURE_ENV += LDFLAGS="$(OPENSSH_LDFLAGS_FOR_CONF)"
+
OPENSSH_DEPENDENCIES = zlib openssl
ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] openssh: fix static linking
2014-09-09 18:29 [Buildroot] [PATCH] openssh: fix static linking ANDY KENNEDY
@ 2014-09-09 18:37 ` Baruch Siach
2014-09-09 19:17 ` ANDY KENNEDY
2014-09-09 19:34 ` Thomas Petazzoni
1 sibling, 1 reply; 6+ messages in thread
From: Baruch Siach @ 2014-09-09 18:37 UTC (permalink / raw)
To: buildroot
Hi Andy,
On Tue, Sep 09, 2014 at 06:29:31PM +0000, ANDY KENNEDY wrote:
> When BR2_PREFER_STATIC_LIB is set, openssl is a static library, openssh
> attempts to build dynamically as the LDFLAGS are dropped out of this build.
> If PREFER_STATIC is set, add back in --static to the LDFLAGS of openssh
> to make the linker happy.
>
> Signed-off-by: Andy Kennedy <andy.kennedy@adtran.com>
> ---
> diff -Naur a/package/openssh/openssh.mk b/package/openssh/openssh.mk
> --- a/package/openssh/openssh.mk 2014-02-27 14:51:23.000000000 -0600
> +++ b/package/openssh/openssh.mk 2014-09-09 12:09:57.043850866 -0500
> @@ -6,10 +6,18 @@
>
> OPENSSH_VERSION = 6.5p1
> OPENSSH_SITE = http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
> -OPENSSH_CONF_ENV = LD="$(TARGET_CC)" LDFLAGS="$(TARGET_CFLAGS)"
> +OPENSSH_CONF_ENV = LD="$(TARGET_CC)"
> OPENSSH_CONF_OPT = --disable-lastlog --disable-utmp \
> --disable-utmpx --disable-wtmp --disable-wtmpx --disable-strip
>
> +OPENSSH_LDFLAGS_FOR_CONF = $(TARGET_CFLAGS)
> +
> +ifeq ($(BR2_PREFER_STATIC_LIB),y)
> +OPENSSH_LDFLAGS_FOR_CONF += --static
> +endif
> +
> +OPENSSH_CONFIGURE_ENV += LDFLAGS="$(OPENSSH_LDFLAGS_FOR_CONF)"
Shouldn't this be OPENSSH_CONF_ENV? Have you tested this?
baruch
> +
> OPENSSH_DEPENDENCIES = zlib openssl
>
> ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] openssh: fix static linking
2014-09-09 18:37 ` Baruch Siach
@ 2014-09-09 19:17 ` ANDY KENNEDY
0 siblings, 0 replies; 6+ messages in thread
From: ANDY KENNEDY @ 2014-09-09 19:17 UTC (permalink / raw)
To: buildroot
> > -OPENSSH_CONF_ENV = LD="$(TARGET_CC)" LDFLAGS="$(TARGET_CFLAGS)"
> > +OPENSSH_CONF_ENV = LD="$(TARGET_CC)"
> > OPENSSH_CONF_OPT = --disable-lastlog --disable-utmp \
> > +OPENSSH_CONFIGURE_ENV += LDFLAGS="$(OPENSSH_LDFLAGS_FOR_CONF)"
>
> Shouldn't this be OPENSSH_CONF_ENV? Have you tested this?
>
> baruch
Yes, and yes. Hmmm, that's strange. Kinda makes me wonder why
that worked at all. Made that modification and retesting.
Like I said in the other thread, this works about once out of
three times anyway. So, maybe I didn't do what I thought I did.
I assume that the LDFLAGS=$(TARGET_CFLAGS) are needed, and that
it _could_ break the build on other platforms. I don't understand
why that would have worked for this particular platform I'm on.
I'll resubmit when I verify the fix.
Andy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] openssh: fix static linking
2014-09-09 18:29 [Buildroot] [PATCH] openssh: fix static linking ANDY KENNEDY
2014-09-09 18:37 ` Baruch Siach
@ 2014-09-09 19:34 ` Thomas Petazzoni
2014-09-09 19:40 ` ANDY KENNEDY
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2014-09-09 19:34 UTC (permalink / raw)
To: buildroot
Hello,
On Tue, 9 Sep 2014 18:29:31 +0000, ANDY KENNEDY wrote:
> When BR2_PREFER_STATIC_LIB is set, openssl is a static library, openssh
> attempts to build dynamically as the LDFLAGS are dropped out of this build.
> If PREFER_STATIC is set, add back in --static to the LDFLAGS of openssh
> to make the linker happy.
>
> Signed-off-by: Andy Kennedy <andy.kennedy@adtran.com>
Sorry, but it does not make sense, because:
ifeq ($(BR2_PREFER_STATIC_LIB),y)
SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
TARGET_CFLAGS += -static
TARGET_CXXFLAGS += -static
TARGET_LDFLAGS += -static
else
SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
endif
So, TARGET_CFLAGS does have -static.
Please make sure to test your patches against the latest master. I'm
sure you're again testing against 2014.02, and there has been quite a
few changes since then in terms of static library support.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] openssh: fix static linking
2014-09-09 19:34 ` Thomas Petazzoni
@ 2014-09-09 19:40 ` ANDY KENNEDY
2014-09-09 20:18 ` Thomas Petazzoni
0 siblings, 1 reply; 6+ messages in thread
From: ANDY KENNEDY @ 2014-09-09 19:40 UTC (permalink / raw)
To: buildroot
> ifeq ($(BR2_PREFER_STATIC_LIB),y)
> SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
> TARGET_CFLAGS += -static
> TARGET_CXXFLAGS += -static
> TARGET_LDFLAGS += -static
> else
> SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
> endif
>
> So, TARGET_CFLAGS does have -static.
OOOHHHH!! Maybe that is the problem. I changed this a few
years back:
-static gets eaten by autoconf. --static doesn't. I wonder if
that has been the problem the whole time?
>
> Please make sure to test your patches against the latest master. I'm
> sure you're again testing against 2014.02, and there has been quite a
> few changes since then in terms of static library support.
Yeah, I hear ya. I'll get to it eventually. I've done too much
testing with 2014.02 and we're getting ready for a release.
I'll bump that rev later and may have to go through all this again.
Till then, I'll quit submitting patches until I'm at tip again :).
Andy
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] openssh: fix static linking
2014-09-09 19:40 ` ANDY KENNEDY
@ 2014-09-09 20:18 ` Thomas Petazzoni
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-09-09 20:18 UTC (permalink / raw)
To: buildroot
Dear ANDY KENNEDY,
On Tue, 9 Sep 2014 19:40:01 +0000, ANDY KENNEDY wrote:
> OOOHHHH!! Maybe that is the problem. I changed this a few
> years back:
>
> -static gets eaten by autoconf. --static doesn't. I wonder if
> that has been the problem the whole time?
Yes, but we reverted this change. Now we're back to using -static
instead of --static. And we've patched libtool so that -static is
actually understood as -all-static. See commits
8d764327a697a2572bba96878972c1a469f864f3 and
5d66a9b1fb67cf009fe4f15028c02a8386109dc5, as well as
97703978ac870ce2b14ad144f8e082de82aa2c64.
> Yeah, I hear ya. I'll get to it eventually. I've done too much
> testing with 2014.02 and we're getting ready for a release.
>
> I'll bump that rev later and may have to go through all this again.
>
> Till then, I'll quit submitting patches until I'm at tip again :).
Yes, before sending patches, please test them on top of the latest
master. Patches against 2014.02 are generally a bit useless, due to the
fairly high rate of changes occurring these days in Buildroot.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-09 20:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09 18:29 [Buildroot] [PATCH] openssh: fix static linking ANDY KENNEDY
2014-09-09 18:37 ` Baruch Siach
2014-09-09 19:17 ` ANDY KENNEDY
2014-09-09 19:34 ` Thomas Petazzoni
2014-09-09 19:40 ` ANDY KENNEDY
2014-09-09 20:18 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox