* [musl] configure: LIBCC auto detection not using {C,LD}FLAGS
@ 2025-03-04 20:15 Sertonix
2025-03-04 20:25 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Sertonix @ 2025-03-04 20:15 UTC (permalink / raw)
To: musl
Hi,
I noticed that the autodetection of LIBCC doesn't use the
CFLAGS/LDFLAGS variables. This means that the result of the auto
detection might be incorrect when --sysroot is set through CFLAGS/LDFLAGS
and not CC. Would it be may be better to use $LDFLAGS (or similar) in
tryldflag?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] configure: LIBCC auto detection not using {C,LD}FLAGS
2025-03-04 20:15 [musl] configure: LIBCC auto detection not using {C,LD}FLAGS Sertonix
@ 2025-03-04 20:25 ` Rich Felker
2025-03-04 22:01 ` Sertonix
0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2025-03-04 20:25 UTC (permalink / raw)
To: Sertonix; +Cc: musl
On Tue, Mar 04, 2025 at 08:15:16PM +0000, Sertonix wrote:
> Hi,
>
> I noticed that the autodetection of LIBCC doesn't use the
> CFLAGS/LDFLAGS variables. This means that the result of the auto
> detection might be incorrect when --sysroot is set through CFLAGS/LDFLAGS
> and not CC. Would it be may be better to use $LDFLAGS (or similar) in
> tryldflag?
You can't put things that change the *identity* of the compiler
toolchain in CFLAGS or LDFLAGS. --sysroot has to go as part of CC,
defining a different compiler.
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] configure: LIBCC auto detection not using {C,LD}FLAGS
2025-03-04 20:25 ` Rich Felker
@ 2025-03-04 22:01 ` Sertonix
2025-03-05 2:15 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Sertonix @ 2025-03-04 22:01 UTC (permalink / raw)
To: musl
On Tue Mar 4, 2025 at 9:25 PM CET, Rich Felker wrote:
> On Tue, Mar 04, 2025 at 08:15:16PM +0000, Sertonix wrote:
>> Hi,
>>
>> I noticed that the autodetection of LIBCC doesn't use the
>> CFLAGS/LDFLAGS variables. This means that the result of the auto
>> detection might be incorrect when --sysroot is set through CFLAGS/LDFLAGS
>> and not CC. Would it be may be better to use $LDFLAGS (or similar) in
>> tryldflag?
>
> You can't put things that change the *identity* of the compiler
> toolchain in CFLAGS or LDFLAGS. --sysroot has to go as part of CC,
> defining a different compiler.
Oh, I haven't seen such a rule before but I understand why. Is there any
any doc/spec that this is mentioned in (as a reference)?
One more thing that reqires completely reworked how cross compilation is
done on alpine linux :(
But thanks for the reply anyways!
> Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] configure: LIBCC auto detection not using {C,LD}FLAGS
2025-03-04 22:01 ` Sertonix
@ 2025-03-05 2:15 ` Rich Felker
2025-03-05 10:54 ` Thorsten Glaser
0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2025-03-05 2:15 UTC (permalink / raw)
To: Sertonix; +Cc: musl
On Tue, Mar 04, 2025 at 10:01:09PM +0000, Sertonix wrote:
> On Tue Mar 4, 2025 at 9:25 PM CET, Rich Felker wrote:
> > On Tue, Mar 04, 2025 at 08:15:16PM +0000, Sertonix wrote:
> >> Hi,
> >>
> >> I noticed that the autodetection of LIBCC doesn't use the
> >> CFLAGS/LDFLAGS variables. This means that the result of the auto
> >> detection might be incorrect when --sysroot is set through CFLAGS/LDFLAGS
> >> and not CC. Would it be may be better to use $LDFLAGS (or similar) in
> >> tryldflag?
> >
> > You can't put things that change the *identity* of the compiler
> > toolchain in CFLAGS or LDFLAGS. --sysroot has to go as part of CC,
> > defining a different compiler.
>
> Oh, I haven't seen such a rule before but I understand why. Is there any
> any doc/spec that this is mentioned in (as a reference)?
I'm not sure, but it's at least our policy and I think it makes sense.
For example if configure needs to probe something about the selected
CC, but it's not actually compiling or linking anything, should it use
CFLAGS? LDFLAGS? Both? Neither?
One good example is using an x86_64 targeting compiler to build x32
musl. It wouldn't make sense to have the option for that in CFLAGS or
LDFLAGS, because it's changing what target the compiler driver is for.
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] configure: LIBCC auto detection not using {C,LD}FLAGS
2025-03-05 2:15 ` Rich Felker
@ 2025-03-05 10:54 ` Thorsten Glaser
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Glaser @ 2025-03-05 10:54 UTC (permalink / raw)
To: musl
On Tue, 4 Mar 2025, Rich Felker wrote:
>For example if configure needs to probe something about the selected
>CC, but it's not actually compiling or linking anything, should it use
>CFLAGS? LDFLAGS? Both? Neither?
At least CFLAGS and very likely CPPFLAGS. There are also things like
-m32 or -Dconst= (for ACK) or -Xa (SINIX) or -YPOSIX that can change
things, and probing something about CC is effectively always at least
compiling a test program except for very few very brittle things (in
my vast porting experience, I gave up trying to do so without passing
a test program that just returns 0).
bye,
//mirabilos
--
11:56⎜«liwakura:#!/bin/mksh» also, i wanted to add mksh to my own distro │
i was disappointed that there is no makefile │ but somehow the Build.sh is
the least painful built system i've ever seen │ honours CC, {CPP,C,LD}FLAGS
properly │ looks cleary like done by someone who knows what they are doing
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-05 10:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-04 20:15 [musl] configure: LIBCC auto detection not using {C,LD}FLAGS Sertonix
2025-03-04 20:25 ` Rich Felker
2025-03-04 22:01 ` Sertonix
2025-03-05 2:15 ` Rich Felker
2025-03-05 10:54 ` Thorsten Glaser
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).