haasn / libplacebo

Official mirror of libplacebo
http://libplacebo.org/
GNU Lesser General Public License v2.1
523 stars 63 forks source link

Unable to cross-compile with -Dlcms=enabled -Dshaderc=enabled -Dvulkan=enabled -Dd3d11=enabled #275

Open Windev2024 opened 6 days ago

Windev2024 commented 6 days ago

Hello @haasn

I'm attempting to cross-compile libplacebo for Windows (i686 architecture) using Meson on a Linux host. I've set up my cross-compilation environment with the necessary tools (i686-w64-mingw32-gcc, i686-w64-mingw32-g++, etc.) and configured my Meson cross file (i686_64-w64-mingw32.txt) accordingly.

Configuration Details:

Cross File (i686_64-w64-mingw32.txt) `[binaries] c = 'i686-w64-mingw32-gcc' cpp = 'i686-w64-mingw32-g++' ar = 'i686-w64-mingw32-ar' strip = 'i686-w64-mingw32-strip' windres = 'i686-w64-mingw32-windres' dlltool = 'i686-w64-mingw32-dlltool' ld = 'i686-w64-mingw32-ld'

[built-in options] buildtype = 'release'

[host_machine] system = 'windows' subsystem = 'windows' cpu_family = 'x86' cpu = 'i686' endian = 'little' `

I encountered several issues during the configuration phase:

Dependency Errors:

without pkg-config in cross file

`meson setup -Ddefault_library=static -Dprefer_static=true -Dc_link_args='-static' -Dcpp_link_args='-static' -Dlcms=enabled -Dshaderc=enabled -Dvulkan=enabled -Dd3d11=enabled --cross-file i686_64-w64-mingw32.txt build The Meson build system Version: 1.3.2 Source dir: /home/libplacebo Build dir: /home/libplacebo/build Build type: cross build Project name: libplacebo Project version: 7.349.0 C compiler for the host machine: i686-w64-mingw32-gcc (gcc 13.0.0 "i686-w64-mingw32-gcc (GCC) 13-win32") C linker for the host machine: i686-w64-mingw32-gcc ld.bfd 2.41.90.20240122 C++ compiler for the host machine: i686-w64-mingw32-g++ (gcc 13.0.0 "i686-w64-mingw32-g++ (GCC) 13-win32") C++ linker for the host machine: i686-w64-mingw32-g++ ld.bfd 2.41.90.20240122 C compiler for the build machine: ccache cc (gcc 13.2.0 "cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0") C linker for the build machine: cc ld.bfd 2.42 C++ compiler for the build machine: ccache c++ (gcc 13.2.0 "c++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0") C++ linker for the build machine: c++ ld.bfd 2.42 Build machine cpu family: x86_64 Build machine cpu: x86_64 Host machine cpu family: x86 Host machine cpu: i686 Target machine cpu family: x86 Target machine cpu: i686 Compiler for C supports arguments -Wincompatible-pointer-types: YES Compiler for C supports link arguments -Wl,--exclude-libs=ALL: YES Configuring libplacebo.rc using configuration Configuring demos.rc using configuration Library m found: YES Program python3 found: YES (/usr/bin/python3) Found pkg-config: NO Found CMake: NO Run-time dependency libunwind found: NO (tried pkgconfig and cmake) Library execinfo found: NO Checking for function "backtrace_symbols" with dependency -lexecinfo: NO Check usable header "dbghelp.h" : YES Library shlwapi found: YES Fetching value of define "MINGW32" : 1 Run-time dependency shaderc found: NO (tried system)

src/glsl/meson.build:2:10: ERROR: Dependency lookup for shaderc with method 'pkgconfig' failed: Pkg-config for machine host machine not found. Giving up. ` with pkgconfig in cross file pkg-config = '/usr/bin/i686-w64-mingw32-pkg-config'

`Run-time dependency shaderc found: NO (tried pkgconfig, pkgconfig, pkgconfig and system)

src/glsl/meson.build:2:10: ERROR: Dependency "shaderc" not found, tried pkgconfig, pkgconfig, pkgconfig and system ` When I include pkg-config = 'pkgconf' in the cross file

`The Meson build system Version: 1.3.2 Source dir: /home/libplacebo Build dir: /home/libplacebo/build Build type: cross build Project name: libplacebo Project version: 7.349.0 C compiler for the host machine: i686-w64-mingw32-gcc (gcc 13.0.0 "i686-w64-mingw32-gcc (GCC) 13-win32") C linker for the host machine: i686-w64-mingw32-gcc ld.bfd 2.41.90.20240122 C++ compiler for the host machine: i686-w64-mingw32-g++ (gcc 13.0.0 "i686-w64-mingw32-g++ (GCC) 13-win32") C++ linker for the host machine: i686-w64-mingw32-g++ ld.bfd 2.41.90.20240122 C compiler for the build machine: ccache cc (gcc 13.2.0 "cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0") C linker for the build machine: cc ld.bfd 2.42 C++ compiler for the build machine: ccache c++ (gcc 13.2.0 "c++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0") C++ linker for the build machine: c++ ld.bfd 2.42 Build machine cpu family: x86_64 Build machine cpu: x86_64 Host machine cpu family: x86 Host machine cpu: i686 Target machine cpu family: x86 Target machine cpu: i686 Compiler for C supports arguments -Wincompatible-pointer-types: YES Compiler for C supports link arguments -Wl,--exclude-libs=ALL: YES Configuring libplacebo.rc using configuration Configuring demos.rc using configuration Library m found: YES Program python3 found: YES (/usr/bin/python3) Found pkg-config: YES (/usr/bin/pkgconf) 1.8.1 Found CMake: NO Run-time dependency libunwind found: NO (tried pkgconfig and cmake) Library execinfo found: NO Checking for function "backtrace_symbols" with dependency -lexecinfo: NO Check usable header "dbghelp.h" : YES Library shlwapi found: YES Fetching value of define "MINGW32" : 1 Run-time dependency shaderc found: YES 2023.8.1 Library glslang-default-resource-limits found: NO Library SPIRV found: NO

src/glsl/meson.build:34:16: ERROR: C++ shared library 'SPIRV' not found ` Could someone please advise on how to correctly configure Meson for cross-compiling libplacebo on Linux for Windows (i686)?

My main issue revolves around building mpv via cross-compilation using the Meson build system. For more details, please refer to this discussion

(https://github.com/mpv-player/mpv/discussions/14389)

Thank you for your assistance!