[vlc-devel] [PATCH] contrib: Unexport env variables when cross-compiling

Steve Lhomme robux4 at ycbcr.xyz
Thu Jun 6 14:55:41 CEST 2019


On 2019-06-06 14:51, Marvin Scholz wrote:
> On 6 Jun 2019, at 14:31, Steve Lhomme wrote:
> 
>> On 2019-06-06 13:47, Marvin Scholz wrote:
>>> Meson always interprets these env variables for the build compiler,
>>
>> This does not seem like a bug. The ones found in the cross compile 
>> file are for the target and the environment ones are assumed to be for 
>> the current host to compile native tools. I suppose that's the intention.
> 
> Yes it is, this is not a bug in meson, this is by design this way.
> 
>>
>> This is not how autotools does it though. There are CC_FOR_BUILD (and 
>> other variants) to achieve that. And I think CMake has its own probe 
>> to find a native compiler on the system.
>>
>> Is there a way to set the native compiler in the meson crossfile ?
> 
> No, the cross file is just for the cross stuff. Meson correctly detects 
> the native compiler though

So what are you trying to solve if the cross compilation uses the right 
stuff and the native compilation uses the right stuff ?

I fear unsetting some common values we had in the Makefile might break 
some contrib compilation where it's not passed properly (or rather it 
should be inherited in the first place)0

> so I do not think thats necessary currently. Afaik none of the 
> dependencies we have that use meson
> actually builds any native tools right now.
> 
>>
>>> even when cross-compiling, therefore we need to unset them,
>>> they are anyway included in HOSTVARS already for other build systems.
>>> ---
>>>   contrib/src/main.mak | 22 +++++++++++++++++++---
>>>   1 file changed, 19 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
>>> index 8944a5a1d7..c7a45964cb 100644
>>> --- a/contrib/src/main.mak
>>> +++ b/contrib/src/main.mak
>>> @@ -329,9 +329,25 @@ HOSTVARS_PIC := $(HOSTTOOLS) \
>>>       CXXFLAGS="$(CXXFLAGS) $(PIC)" \
>>>       LDFLAGS="$(LDFLAGS)"
>>>  -# Keep a version of HOSTVARS without the tools, since meson 
>>> requires the
>>> -# tools variables to point to the native ones
>>> -HOSTVARS_MESON := $(HOSTVARS)
>>> +# For cross-compilation with meson, we need to unset compiler and flags
>>> +# env variables as meson will always use them for the BUILD machine 
>>> compiler!
>>> +ifdef HAVE_CROSS_COMPILE
>>> +HOSTVARS_MESON := PATH="$(PREFIX)/bin:$(PATH)"
>>> +unexport CC
>>> +unexport CXX
>>> +unexport LD
>>> +unexport AR
>>> +unexport CCAS
>>> +unexport RANLIB
>>> +unexport STRIP
>>> +unexport CPPFLAGS
>>> +unexport CFLAGS
>>> +unexport CXXFLAGS
>>> +unexport LDFLAGS
>>> +else
>>> +HOSTVARS_MESON := $(HOSTTOOLS) $(HOSTVARS)
>>> +endif
>>> +
>>>   HOSTVARS := $(HOSTTOOLS) $(HOSTVARS)
>>>    download_git = \
>>> -- 
>>> 2.20.1 (Apple Git-117)
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list