meson: meson 1.1.0 regression: Dependency "llvm" not found

Describe the bug The update to meson 1.1.0 breaks the detection of LLVM in a mingw cross-compilation context The meson version 1.0.1 is ok on the same testcase

To Reproduce meson.build:

project('simple', ['c', 'cpp'])

llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit', 'core', 'executionengine', 'scalaropts', 'transformutils', 'instcombine']
dep_llvm = dependency('llvm',
   version : '>=13.0',
   modules : llvm_modules,
   required : true,
   static: true,
   include_type : 'system',
)

executable('myexe', 'main.cpp')

returns:

$ x86_64-w64-mingw32-meson build
The Meson build system
Version: 1.1.0
Source dir: /home/xantares/projects/helloworld-cmake
Build dir: /home/xantares/projects/helloworld-cmake/build
Build type: cross build
Project name: simple
Project version: undefined
C compiler for the host machine: x86_64-w64-mingw32-gcc (gcc 12.2.0 "x86_64-w64-mingw32-gcc (GCC) 12.2.0")
C linker for the host machine: x86_64-w64-mingw32-gcc ld.bfd 2.38
C++ compiler for the host machine: x86_64-w64-mingw32-g++ (gcc 12.2.0 "x86_64-w64-mingw32-g++ (GCC) 12.2.0")
C++ linker for the host machine: x86_64-w64-mingw32-g++ ld.bfd 2.38
C compiler for the build machine: cc (gcc 13.1.1 "cc (GCC) 13.1.1 20230429")
C linker for the build machine: cc ld.bfd 2.40.0
C++ compiler for the build machine: c++ (gcc 13.1.1 "c++ (GCC) 13.1.1 20230429")
C++ linker for the build machine: c++ ld.bfd 2.40.0
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
Found CMake: /usr/bin/x86_64-w64-mingw32-cmake (3.26.4)
WARNING: Ignoring LLVM CMake dependency because dynamic was requested
llvm-config found: NO need ['>=13.0']
Run-time dependency LLVM found: NO (tried cmake and config-tool)

meson.build:5:0: ERROR: Dependency "llvm" not found, tried cmake and config-tool

A full log can be found at /home/xantares/projects/helloworld-cmake/build/meson-logs/meson-log.txt

meson-log.txt

Expected behavior Reverting to meson 1.0.1 I get a correct detection:

$ sudo pacman -U https://archive.archlinux.org/packages/m/meson/meson-1.0.1-3-any.pkg.tar.zst
$ x86_64-w64-mingw32-meson build
The Meson build system
Version: 1.0.1
Source dir: /home/xantares/projects/helloworld-cmake
Build dir: /home/xantares/projects/helloworld-cmake/build
Build type: cross build
Project name: simple
Project version: undefined
C compiler for the host machine: x86_64-w64-mingw32-gcc (gcc 12.2.0 "x86_64-w64-mingw32-gcc (GCC) 12.2.0")
C linker for the host machine: x86_64-w64-mingw32-gcc ld.bfd 2.38
C++ compiler for the host machine: x86_64-w64-mingw32-g++ (gcc 12.2.0 "x86_64-w64-mingw32-g++ (GCC) 12.2.0")
C++ linker for the host machine: x86_64-w64-mingw32-g++ ld.bfd 2.38
C compiler for the build machine: cc (gcc 13.1.1 "cc (GCC) 13.1.1 20230429")
C linker for the build machine: cc ld.bfd 2.40.0
C++ compiler for the build machine: c++ (gcc 13.1.1 "c++ (GCC) 13.1.1 20230429")
C++ linker for the build machine: c++ ld.bfd 2.40.0
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
Found CMake: /usr/bin/x86_64-w64-mingw32-cmake (3.26.4)
Run-time dependency LLVM (modules: bitwriter, core, engine, executionengine, instcombine, mcdisassembler, mcjit, scalaropts, transformutils) found: YES 15.0.7
Build targets in project: 1

simple undefined

  User defined options
    Cross files    : /usr/share/mingw/toolchain-x86_64-w64-mingw32.meson
    bindir         : /usr/x86_64-w64-mingw32/bin
    buildtype      : release
    datadir        : /usr/x86_64-w64-mingw32/share
    default_library: shared
    includedir     : /usr/x86_64-w64-mingw32/include
    infodir        : /usr/x86_64-w64-mingw32/share/info
    libdir         : /usr/x86_64-w64-mingw32/lib
    libexecdir     : /usr/x86_64-w64-mingw32/lib
    localedir      : /usr/x86_64-w64-mingw32/share/locale
    localstatedir  : /var
    mandir         : /usr/x86_64-w64-mingw32/share/man
    prefix         : /usr/x86_64-w64-mingw32
    sbindir        : /usr/x86_64-w64-mingw32/bin
    sharedstatedir : /var/lib
    strip          : true
    sysconfdir     : /usr/x86_64-w64-mingw32/etc
    wrap_mode      : nofallback

Found ninja-1.11.1 at /usr/bin/ninja

meson-log.txt

system parameters

  • Archlinux
  • Python 3.11.3
  • Meson 1.1.0
  • Ninja 1.11.3
  • this is a cross build for mingw target with a standard cross file for that target:
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
fortran = 'x86_64-w64-mingw32-gfortran'
ar = 'x86_64-w64-mingw32-gcc-ar'
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
ranlib = 'x86_64-w64-mingw32-gcc-ranlib'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
cmake = 'x86_64-w64-mingw32-cmake'

[properties]
root = 'x86_64-w64-mingw32'
sys_root = '/usr/x86_64-w64-mingw32'
needs_exe_wrapper = true

[built-in options]
c_args = ['-D_FORTIFY_SOURCE=2', '-D_GLIBCXX_ASSERTIONS', '-O2', '-pipe', '-fno-plt', '-fexceptions', '--param=ssp-buffer-size=4', '-Wformat', '-Werror=format-security', '-fcf-protection']
cpp_args = ['-D_FORTIFY_SOURCE=2', '-D_GLIBCXX_ASSERTIONS', '-O2', '-pipe', '-fno-plt', '-fexceptions', '--param=ssp-buffer-size=4', '-Wformat', '-Werror=format-security', '-fcf-protection']
c_link_args = ['-Wl,-O1,--sort-common,--as-needed', '-fstack-protector']
cpp_link_args = ['-Wl,-O1,--sort-common,--as-needed', '-fstack-protector']

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

and a wrapper script from https://aur.archlinux.org/packages/mingw-w64-meson:

$ cat /usr/bin/x86_64-w64-mingw32-meson 
#!/bin/sh

if [ -z ${CROSS_FILE} ]
then
  if [ -z ${NEED_WINE} ]
  then
    CROSS_FILE=/usr/share/mingw/toolchain-x86_64-w64-mingw32.meson
  else
    CROSS_FILE=/usr/share/mingw/toolchain-x86_64-w64-mingw32-wine.meson
    MESON_EXE_WRAPPER=/usr/bin/x86_64-w64-mingw32-wine
  fi
fi

exec meson setup \
  --prefix         /usr/x86_64-w64-mingw32 \
  --libdir         /usr/x86_64-w64-mingw32/lib \
  --libexecdir     /usr/x86_64-w64-mingw32/lib \
  --bindir         /usr/x86_64-w64-mingw32/bin \
  --sbindir        /usr/x86_64-w64-mingw32/bin \
  --includedir     /usr/x86_64-w64-mingw32/include \
  --datadir        /usr/x86_64-w64-mingw32/share \
  --mandir         /usr/x86_64-w64-mingw32/share/man \
  --infodir        /usr/x86_64-w64-mingw32/share/info \
  --localedir      /usr/x86_64-w64-mingw32/share/locale \
  --sysconfdir     /usr/x86_64-w64-mingw32/etc \
  --localstatedir  /var \
  --sharedstatedir /var/lib \
  --buildtype      release \
  --wrap-mode      nofallback \
  -D               strip=true \
  --cross-file ${CROSS_FILE} \
  --default-library shared \
  "$@"

it also needs the llvm package:

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@Martchus I updated llvm to build as static libs but with a main llvm dll like msys does, could you rebuild it ? I will also bump mesa and ceres as they need a rebuild

I learned recently that llvm-config is deprecated, so I may have to figure out how to get on my employeer’s LLVM committer list so I can just submit patches to generate pkg-config for LLVM… which would make all of this go away.