Skip to content

developer doc: meson setup build fails with an error about cunit #3432

@bhaller

Description

@bhaller

OK, in my continuing battle to do a simple PR for tskit, I am now at https://tskit.dev/tskit/docs/latest/development.html#building. It says:

To set up the initial build directory, run

$ cd c
$ meson setup build

That fails:

bhaller@glass % meson setup build
The Meson build system
Version: 1.10.1
Source dir: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c
Build dir: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build
Build type: native build
Project name: tskit
Project version: 1.3.1
C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the host machine: cc ld64 1115.7.3
C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C++ linker for the host machine: c++ ld64 1115.7.3
Host machine cpu family: aarch64
Host machine cpu: aarch64

Executing subproject kastore 

kastore| Project name: kastore
kastore| Project version: 2.1.2
kastore| C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
kastore| C linker for the host machine: cc ld64 1115.7.3
kastore| C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
kastore| C++ linker for the host machine: c++ ld64 1115.7.3
kastore| Build targets in project: 1
kastore| Subproject kastore finished.

Library m found: YES
Found pkg-config: YES (/opt/local/bin/pkg-config) 0.29.2
Found CMake: /opt/local/bin/cmake (3.31.10)
Run-time dependency cunit found: NO (tried pkgconfig, framework and cmake)

A full log can be found at /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-logs/meson-log.txt

I have no idea what cunit is. :-> I opened the log file in question. It says (sorry, this is a bit long):

Build started at 2026-03-12T10:34:14.880284
Main binary: /opt/local/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14
Build Options: 
Python system: Darwin
The Meson build system
Version: 1.10.1
Source dir: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c
Build dir: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build
Build type: native build
Project name: tskit
Project version: 1.3.1
-----------
Detecting compiler via: `cc --version` -> 0
stdout:
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
-----------
Running command: -x c -E -dM -
-----
-----------
Detecting linker via: `cc -Wl,--version` -> 1
stderr:
ld: unknown options: --version 
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `cc -Wl,-v` -> 0
stderr:
@(#)PROGRAM:ld PROJECT:ld-1115.7.3
BUILD 23:52:02 Dec  5 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 16.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 16.0.0 (tapi-1600.0.11.9)
-----------
Sanity testing C compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  '/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckc.exe'
-----------
Sanity check: `'/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckc.exe'` -> 0
C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the host machine: cc ld64 1115.7.3
-----------
Detecting archiver via: `llvm-ar-16 --version` -> [Errno 2] No such file or directory: 'llvm-ar-16'
-----------
Detecting archiver via: `llvm-ar --version` -> [Errno 2] No such file or directory: 'llvm-ar'
-----------
Detecting archiver via: `ar --version` -> 1
stderr:
usage:  ar -d [-TLsv] archive file ...
	ar -m [-TLsv] archive file ...
	ar -m [-abiTLsv] position archive file ...
	ar -p [-TLsv] archive [file ...]
	ar -q [-cTLsv] archive file ...
	ar -r [-cuTLsv] archive file ...
	ar -r [-abciuTLsv] position archive file ...
	ar -t [-TLsv] archive [file ...]
	ar -x [-ouTLsv] archive [file ...]
-----------
-----------
Detecting compiler via: `c++ --version` -> 0
stdout:
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
-----------
Running command: -x c++ -E -dM -
-----
-----------
Detecting linker via: `c++ -Wl,--version` -> 1
stderr:
ld: unknown options: --version 
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `c++ -Wl,-v` -> 0
stderr:
@(#)PROGRAM:ld PROJECT:ld-1115.7.3
BUILD 23:52:02 Dec  5 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 16.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 16.0.0 (tapi-1600.0.11.9)
-----------
Sanity testing C++ compiler: c++
Is cross compiler: False.
Sanity check compiler command line: c++ sanitycheckcpp.cc -o sanitycheckcpp.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  '/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckcpp.exe'
-----------
Sanity check: `'/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckcpp.exe'` -> 0
C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C++ linker for the host machine: c++ ld64 1115.7.3
-----------
Detecting compiler via: `cc --version` -> 0
stdout:
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
-----------
Running command: -x c -E -dM -
-----
-----------
Detecting linker via: `cc -Wl,--version` -> 1
stderr:
ld: unknown options: --version 
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `cc -Wl,-v` -> 0
stderr:
@(#)PROGRAM:ld PROJECT:ld-1115.7.3
BUILD 23:52:02 Dec  5 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 16.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 16.0.0 (tapi-1600.0.11.9)
-----------
Sanity testing C compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  '/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckc.exe'
-----------
Sanity check: `'/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckc.exe'` -> 0
C compiler for the build machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the build machine: cc ld64 1115.7.3
-----------
Detecting archiver via: `llvm-ar-16 --version` -> [Errno 2] No such file or directory: 'llvm-ar-16'
-----------
Detecting archiver via: `llvm-ar --version` -> [Errno 2] No such file or directory: 'llvm-ar'
-----------
Detecting archiver via: `ar --version` -> 1
stderr:
usage:  ar -d [-TLsv] archive file ...
	ar -m [-TLsv] archive file ...
	ar -m [-abiTLsv] position archive file ...
	ar -p [-TLsv] archive [file ...]
	ar -q [-cTLsv] archive file ...
	ar -r [-cuTLsv] archive file ...
	ar -r [-abciuTLsv] position archive file ...
	ar -t [-TLsv] archive [file ...]
	ar -x [-ouTLsv] archive [file ...]
-----------
-----------
Detecting compiler via: `c++ --version` -> 0
stdout:
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
-----------
Running command: -x c++ -E -dM -
-----
-----------
Detecting linker via: `c++ -Wl,--version` -> 1
stderr:
ld: unknown options: --version 
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `c++ -Wl,-v` -> 0
stderr:
@(#)PROGRAM:ld PROJECT:ld-1115.7.3
BUILD 23:52:02 Dec  5 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 16.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 16.0.0 (tapi-1600.0.11.9)
-----------
Sanity testing C++ compiler: c++
Is cross compiler: False.
Sanity check compiler command line: c++ sanitycheckcpp.cc -o sanitycheckcpp.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  '/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckcpp.exe'
-----------
Sanity check: `'/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/sanitycheckcpp.exe'` -> 0
C++ compiler for the build machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C++ linker for the build machine: c++ ld64 1115.7.3
Build machine cpu family: aarch64
Build machine cpu: aarch64
Host machine cpu family: aarch64
Host machine cpu: aarch64
Target machine cpu family: aarch64
Target machine cpu: aarch64

Executing subproject kastore 

Project name: kastore
Project version: 2.1.2
C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the host machine: cc ld64 1115.7.3
C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C++ linker for the host machine: c++ ld64 1115.7.3
C compiler for the build machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the build machine: cc ld64 1115.7.3
C++ compiler for the build machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C++ linker for the build machine: c++ ld64 1115.7.3
Build targets in project: 1
Subproject kastore finished.

Running compile:
Working directory:  /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/tmp228zwnbm
Code:
int main(void) { return 0; }

-----------
Command line: `cc '/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/tmp228zwnbm/testfile.c' -o '/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/tmp228zwnbm/output.exe' -O0 -Werror=implicit-function-declaration -lm -Wl,-undefined,dynamic_lookup` -> 0
Library m found: YES
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Found pkg-config: YES (/opt/local/bin/pkg-config) 0.29.2
Determining dependency 'cunit' with pkg-config executable '/opt/local/bin/pkg-config'
env[PKG_CONFIG_PATH]: 
env[PKG_CONFIG]: /opt/local/bin/pkg-config
-----------
Called: `/opt/local/bin/pkg-config --modversion cunit` -> 1
stderr:
Package cunit was not found in the pkg-config search path.
Perhaps you should add the directory containing `cunit.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cunit' found
-----------
Finding framework path by running:  c++ -v -E - 

Looking for framework cunit in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
CMake binary for host machine is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: /opt/local/bin/cmake (3.31.10)
Extracting basic cmake information
CMake Toolchain: Calling CMake once to generate the compiler state
Calling CMake (['/opt/local/bin/cmake']) in /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/__CMake_compiler_info__ with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-G"
  - "Ninja"
  - "-DCMAKE_TOOLCHAIN_FILE=/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/__CMake_compiler_info__/CMakeMesonTempToolchainFile.cmake"
  - "."
CMake trace warning: add_executable() non imported executables are not supported
CMake TRACE: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-2YKHVg/CMakeLists.txt:22 add_executable(['cmTC_b4dc8'])
CMake trace warning: target_link_libraries() TARGET cmTC_b4dc8 not found
CMake TRACE: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-2YKHVg/CMakeLists.txt:28 target_link_libraries(['cmTC_b4dc8', ''])
CMake trace warning: add_executable() non imported executables are not supported
CMake TRACE: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-UC4aIP/CMakeLists.txt:22 add_executable(['cmTC_ff977'])
CMake trace warning: target_link_libraries() TARGET cmTC_ff977 not found
CMake TRACE: /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/__CMake_compiler_info__/CMakeFiles/CMakeScratch/TryCompile-UC4aIP/CMakeLists.txt:28 target_link_libraries(['cmTC_ff977', ''])
Try CMake generator: auto
Calling CMake (['/opt/local/bin/cmake']) in /Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/cmake_cunit with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-DCMAKE_TOOLCHAIN_FILE=/Users/bhaller/Documents/Research/MesserLab/other software/tskit/c/build/meson-private/cmake_cunit/CMakeMesonToolchainFile.cmake"
  - "."
  -- Module search paths:    ['/', '/Applications', '/Applications/Xcode.app/Contents/Applications', '/Applications/Xcode.app/Contents/Developer/Applications', '/Applications/Xcode.app/Contents/Developer/Library/Frameworks', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/System/Library/Frameworks', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk/usr', '/Library/Frameworks', '/System/Library/Frameworks', '/Users/bhaller/Applications', '/opt', '/opt/local', '/usr', '/usr/local']
  -- CMake root:             /opt/local/share/cmake-3.31
  -- CMake architectures:    []
  -- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share', '']
Preliminary CMake check failed. Aborting.
Run-time dependency cunit found: NO (tried pkgconfig, framework and cmake)

meson.build:47:16: ERROR: Dependency "cunit" not found, tried pkgconfig, framework and cmake

Surmising that maybe this is a package I need to install, I tried sudo port install cunit, that worked, and then meson setup build worked, so hopefully that fixes things. I guess the issue here is: if there are external dependencies that the user needs to have installed, it would be helpful for the doc to warn about that. I wasn't sure whether the issue was that, or some other sort of internal cmake problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions