[vlc-devel] [PATCH] contrib: allow using prebuilt packages when cross-compiling

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 31 08:52:18 CET 2020


On 2020-01-30 17:21, Rémi Denis-Courmont wrote:
> Le torstaina 30. tammikuuta 2020, 17.13.02 EET Steve Lhomme a écrit :
>> In the case of Raspbian there's a heavily patched libavcodec which we can
>> access through pre-built packages.
>> Qt cross compiling also a major PITA which we can avoid this way.
>> ---
>>   contrib/src/main.mak | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/contrib/src/main.mak b/contrib/src/main.mak
>> index 27722baf513..1b7ff3190f3 100644
>> --- a/contrib/src/main.mak
>> +++ b/contrib/src/main.mak
>> @@ -45,13 +45,10 @@ ifeq ($(ARCH)-$(HAVE_WIN32),aarch64-1)
>>   HAVE_WIN64 := 1
>>   endif
>>
>> +need_pkg = $(shell $(PKG_CONFIG) $(1) || echo 1)
>>   ifdef HAVE_CROSS_COMPILE
>> -need_pkg = 1
>> -else
>>   ifeq ($(findstring mingw32,$(BUILD)),mingw32)
>>   need_pkg = $(shell PKG_CONFIG_LIBDIR="${PKG_CONFIG_PATH}" $(PKG_CONFIG)
>> $(1) || echo 1) -else
>> -need_pkg = $(shell $(PKG_CONFIG) $(1) || echo 1)
>>   endif
>>   endif
> 
> Are we always setting the cross-pkg-config correctly? The hack is there because
> we did not back way back when.

In fact autotools tries to use it when PKG_CONFIG is not forced. For 
example here it is for win64 cross-compilation:

configure:22274: checking for x86_64-w64-mingw32-pkg-config
configure:22292: found /usr/bin/x86_64-w64-mingw32-pkg-config
configure:22304: result: /usr/bin/x86_64-w64-mingw32-pkg-config

In contribs we force PKG_CONFIG to pkg-config if the environment doesn't 
set it. But it seems to have no impact on autotools contribs, they still 
check it and use the triplet one.

CMake doesn't use the triplet one (surprise!) even though we set the 
_CMAKE_TOOLCHAIN_PREFIX which is used to find compilers/binutils but not 
pkg-config.

Meson also doesn't seem to use the triplet version:

Pkg-config binary for MachineChoice.HOST is not cached.
Pkg-config binary for MachineChoice.HOST specified from cross file, 
native file, or env var as ['pkg-config']
Trying pkg-config binary pkg-config for machine MachineChoice.HOST at 
['/usr/bin/pkg-config']
Found pkg-config: /usr/bin/pkg-config (0.29)

But we set it explicitely to 'pkg-config' in the crossfile.meson file. 
We don't set a triplet/prefix in that file so it may not be able to find 
it by itself anyway.

So we should probably do a quick detection between prefix/system and set 
it for all contribs, so everything is using the same thing.


More information about the vlc-devel mailing list