Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/noip: fix static build
@ 2022-06-08 19:56 Fabrice Fontaine
  2022-06-09 20:38 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-06-08 19:56 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Pass TARGET_LDFLAGS (which will contain -static) through LIBS (as
LDFLAGS is not supported) to fix the following static build failure
(e.g. with musl):

/home/autobuild/autobuild/instance-15/output-1/host/lib/gcc/microblazeel-buildroot-linux-musl/10.3.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: /home/autobuild/autobuild/instance-15/output-1/host/lib/gcc/microblazeel-buildroot-linux-musl/10.3.0/libgcc.a(unwind-dw2.o): in function `__gthread_once':
/home/autobuild/autobuild/instance-15/output-1/build/host-gcc-final-10.3.0/build/microblazeel-buildroot-linux-musl/libgcc/gthr-default.h:700: undefined reference to `pthread_once'

While at it, drop CFLAGS (which is not supported by Makefile)

Fixes:
 - http://autobuild.buildroot.org/results/5ea9b1b976aecc401e0aff21eef3e31c8ed17181

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/noip/noip.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/noip/noip.mk b/package/noip/noip.mk
index b7fcc84e2f..3b4850a633 100644
--- a/package/noip/noip.mk
+++ b/package/noip/noip.mk
@@ -13,7 +13,7 @@ NOIP_LICENSE_FILES = COPYING
 define NOIP_BUILD_CMDS
 	$(SED) "/^#define CONFIG_FILENAME/ s/PREFIX//" $(@D)/noip2.c
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC)" \
-		CFLAGS="$(TARGET_CFLAGS)" PREFIX=/usr CONFDIR=/etc
+		LIBS="$(TARGET_LDFLAGS)" PREFIX=/usr CONFDIR=/etc
 endef
 
 define NOIP_INSTALL_TARGET_CMDS
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/noip: fix static build
  2022-06-08 19:56 [Buildroot] [PATCH 1/1] package/noip: fix static build Fabrice Fontaine
@ 2022-06-09 20:38 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-06-09 20:38 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

On Wed,  8 Jun 2022 21:56:18 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Pass TARGET_LDFLAGS (which will contain -static) through LIBS (as
> LDFLAGS is not supported) to fix the following static build failure
> (e.g. with musl):
> 
> /home/autobuild/autobuild/instance-15/output-1/host/lib/gcc/microblazeel-buildroot-linux-musl/10.3.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: /home/autobuild/autobuild/instance-15/output-1/host/lib/gcc/microblazeel-buildroot-linux-musl/10.3.0/libgcc.a(unwind-dw2.o): in function `__gthread_once':
> /home/autobuild/autobuild/instance-15/output-1/build/host-gcc-final-10.3.0/build/microblazeel-buildroot-linux-musl/libgcc/gthr-default.h:700: undefined reference to `pthread_once'
> 
> While at it, drop CFLAGS (which is not supported by Makefile)

Be careful with this: $(CFLAGS) is used by implicit make rules, so even
if it's not visible in the Makefile, CFLAGS may be used by make.

However, in the particular case of this project, they don't rely on
implicit make rules, as their make rule is:

${TGT}: Makefile ${TGT}.c 
        ${CC} -Wall -g -D${ARCH} -DPREFIX=\"${PREFIX}\" ${TGT}.c -o ${TGT} ${LIBS}

So indeed, passing CFLAGS has no effect.

However, what you could do is:

	LIBS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)"

Yes, it's a hack, and it will need a comment in the .mk file, but at
least with this, all flags are properly passed :-)

Cheers,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-06-09 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-08 19:56 [Buildroot] [PATCH 1/1] package/noip: fix static build Fabrice Fontaine
2022-06-09 20:38 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox