Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/noip: fix static build
Date: Thu, 9 Jun 2022 22:38:31 +0200	[thread overview]
Message-ID: <20220609223831.13344e13@windsurf> (raw)
In-Reply-To: <20220608195618.2243703-1-fontaine.fabrice@gmail.com>

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

      reply	other threads:[~2022-06-09 20:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220609223831.13344e13@windsurf \
    --to=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox