BinaryBuilder on Yggdrasil: cmake build fails on Windows; meson build fails on MacOs

I am trying to build a binary pkg using BinaryBuilder and Yggdrasil.
My PR can be found here.
odrpack: new package for Odrpack.jl by HugoMVale · Pull Request #11806 · JuliaPackaging/Yggdrasil

When I build the library using cmake, the build succeeds for all platforms except windows, where I get the following file/folder error.

[15:42:51]  ---> cd $WORKSPACE/srcdir/odrpack95
[15:42:51]  ---> mkdir build
[15:42:51]  ---> cd build
[15:42:51]  ---> cmake .. -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DBUILD_SHARED=ON
[15:42:51] -- The C compiler identification is GNU 14.2.0
[15:42:51] -- The Fortran compiler identification is GNU 14.2.0
[15:42:51] -- Detecting C compiler ABI info
[15:42:52] -- Detecting C compiler ABI info - done
[15:42:52] -- Check for working C compiler: /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gcc - skipped
[15:42:52] -- Detecting C compile features
[15:42:52] -- Detecting C compile features - done
[15:42:52] -- Detecting Fortran compiler ABI info
[15:42:52] -- Detecting Fortran compiler ABI info - done
[15:42:52] -- Check for working Fortran compiler: /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran - skipped
[15:42:52] -- Checking whether /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran supports Fortran 90
[15:42:52] -- Checking whether /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran supports Fortran 90 - yes
[15:42:52] -- Checking for module 'openblas'
[15:42:52] --   Found openblas, version 0.3.29
[15:42:52] -- Using OpenBLAS as BLAS library.
[15:42:52] -- Adding GNU Fortran-specific flags to odrpack95.
[15:42:52] -- Configuring done
[15:42:52] -- Generating done
[15:42:52] -- Build files have been written to: /workspace/srcdir/odrpack95/build
[15:42:52]  ---> cmake --build . --parallel ${nproc}
[15:42:52] /usr/bin/cmake -S/workspace/srcdir/odrpack95 -B/workspace/srcdir/odrpack95/build --check-build-system CMakeFiles/Makefile.cmake 0
[15:42:52] /usr/bin/cmake -E cmake_progress_start /workspace/srcdir/odrpack95/build/CMakeFiles /workspace/srcdir/odrpack95/build//CMakeFiles/progress.marks
[15:42:52] /usr/bin/make  -f CMakeFiles/Makefile2 all
[15:42:52] make[1]: Entering directory '/workspace/srcdir/odrpack95/build'
[15:42:52] /usr/bin/make  -f CMakeFiles/odrpack95.dir/build.make CMakeFiles/odrpack95.dir/depend
[15:42:52] make[2]: Entering directory '/workspace/srcdir/odrpack95/build'
[15:42:52] cd /workspace/srcdir/odrpack95/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /workspace/srcdir/odrpack95 /workspace/srcdir/odrpack95 /workspace/srcdir/odrpack95/build /workspace/srcdir/odrpack95/build /workspace/srcdir/odrpack95/build/CMakeFiles/odrpack95.dir/DependInfo.cmake --color=
[15:42:52] Dependee "/workspace/srcdir/odrpack95/build/CMakeFiles/odrpack95.dir/DependInfo.cmake" is newer than depender "/workspace/srcdir/odrpack95/build/CMakeFiles/odrpack95.dir/depend.internal".
[15:42:52] Dependee "/workspace/srcdir/odrpack95/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/workspace/srcdir/odrpack95/build/CMakeFiles/odrpack95.dir/depend.internal".
[15:42:52] Scanning dependencies of target odrpack95
[15:42:52] make[2]: Leaving directory '/workspace/srcdir/odrpack95/build'
[15:42:52] /usr/bin/make  -f CMakeFiles/odrpack95.dir/build.make CMakeFiles/odrpack95.dir/build
[15:42:52] make[2]: Entering directory '/workspace/srcdir/odrpack95/build'
[15:42:52] [ 12%] Building Fortran object CMakeFiles/odrpack95.dir/src/odrpack_kinds.F90.o
[15:42:52] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/odrpack_kinds.F90 -o CMakeFiles/odrpack95.dir/src/odrpack_kinds.F90.o
[15:42:52] /usr/bin/cmake -E cmake_copy_f90_mod odrpack_kinds.mod CMakeFiles/odrpack95.dir/odrpack_kinds.mod.stamp GNU
[15:42:52] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/odrpack_kinds.F90.o.provides.build
[15:42:52] [ 25%] Building Fortran object CMakeFiles/odrpack95.dir/src/blas_interfaces.f90.o
[15:42:52] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/blas_interfaces.f90 -o CMakeFiles/odrpack95.dir/src/blas_interfaces.f90.o
[15:42:52] /usr/bin/cmake -E cmake_copy_f90_mod blas_interfaces.mod CMakeFiles/odrpack95.dir/blas_interfaces.mod.stamp GNU
[15:42:52] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/blas_interfaces.f90.o.provides.build
[15:42:52] [ 37%] Building Fortran object CMakeFiles/odrpack95.dir/src/linpack.f.o
[15:42:52] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/linpack.f -o CMakeFiles/odrpack95.dir/src/linpack.f.o
[15:42:53] /usr/bin/cmake -E cmake_copy_f90_mod linpack.mod CMakeFiles/odrpack95.dir/linpack.mod.stamp GNU
[15:42:53] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/linpack.f.o.provides.build
[15:42:53] [ 50%] Building Fortran object CMakeFiles/odrpack95.dir/src/odrpack_core.f90.o
[15:42:53] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/odrpack_core.f90 -o CMakeFiles/odrpack95.dir/src/odrpack_core.f90.o
[15:42:57] /usr/bin/cmake -E cmake_copy_f90_mod odrpack_core.mod CMakeFiles/odrpack95.dir/odrpack_core.mod.stamp GNU
[15:42:57] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/odrpack_core.f90.o.provides.build
[15:42:57] [ 62%] Building Fortran object CMakeFiles/odrpack95.dir/src/odrpack_reports.f90.o
[15:42:57] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/odrpack_reports.f90 -o CMakeFiles/odrpack95.dir/src/odrpack_reports.f90.o
[15:42:58] /usr/bin/cmake -E cmake_copy_f90_mod odrpack_reports.mod CMakeFiles/odrpack95.dir/odrpack_reports.mod.stamp GNU
[15:42:58] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/odrpack_reports.f90.o.provides.build
[15:42:58] [ 75%] Building Fortran object CMakeFiles/odrpack95.dir/src/odrpack.f90.o
[15:42:58] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/odrpack.f90 -o CMakeFiles/odrpack95.dir/src/odrpack.f90.o
[15:43:00] /usr/bin/cmake -E cmake_copy_f90_mod odrpack.mod CMakeFiles/odrpack95.dir/odrpack.mod.stamp GNU
[15:43:01] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/odrpack.f90.o.provides.build
[15:43:01] [ 87%] Building Fortran object CMakeFiles/odrpack95.dir/src/odrpack_capi.f90.o
[15:43:01] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -Dodrpack95_EXPORTS @CMakeFiles/odrpack95.dir/includes_Fortran.rsp -O3 -DNDEBUG -O3 -Wno-compare-reals -Wno-unused-dummy-argument -c /workspace/srcdir/odrpack95/src/odrpack_capi.f90 -o CMakeFiles/odrpack95.dir/src/odrpack_capi.f90.o
[15:43:01] /usr/bin/cmake -E cmake_copy_f90_mod odrpack_capi.mod CMakeFiles/odrpack95.dir/odrpack_capi.mod.stamp GNU
[15:43:01] /usr/bin/cmake -E touch CMakeFiles/odrpack95.dir/src/odrpack_capi.f90.o.provides.build
[15:43:01] [100%] Linking Fortran shared library libodrpack95.dll
[15:43:01] /usr/bin/cmake -E cmake_link_script CMakeFiles/odrpack95.dir/link.txt --verbose=1
[15:43:01] /usr/bin/cmake -E rm -f CMakeFiles/odrpack95.dir/objects.a
[15:43:01] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-ar qc CMakeFiles/odrpack95.dir/objects.a @CMakeFiles/odrpack95.dir/objects1.rsp
[15:43:01] /opt/bin/i686-w64-mingw32-libgfortran5-cxx11/i686-w64-mingw32-gfortran --sysroot=/opt/i686-w64-mingw32/i686-w64-mingw32/sys-root/ -O3 -DNDEBUG -O3 -shared -o libodrpack95.dll -Wl,--out-implib,libodrpack95.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles/odrpack95.dir/objects.a -Wl,--no-whole-archive @CMakeFiles/odrpack95.dir/linklibs.rsp
[15:43:02] make[2]: Leaving directory '/workspace/srcdir/odrpack95/build'
[15:43:02] [100%] Built target odrpack95
[15:43:02] make[1]: Leaving directory '/workspace/srcdir/odrpack95/build'
[15:43:02] /usr/bin/cmake -E cmake_progress_start /workspace/srcdir/odrpack95/build/CMakeFiles 0
[15:43:02]  ---> cmake --install .
[15:43:02] -- Install configuration: "Release"
[15:43:02] -- Installing: /workspace/destdir/lib/libodrpack95.dll.a
[15:43:02]  ---> source "$_script"
[15:43:02]  ---> source "$_script"
[15:43:02] Installing license file "/workspace/srcdir/odrpack95/LICENSE" to "/workspace/destdir/share/licenses/odrpack/LICENSE"...
[15:43:02] Child Process exited, exit code 0
[ Info: Beginning audit of /cache/build/yggy-amdci7-15/julialang/yggdrasil/O/odrpack/build/i686-w64-mingw32-libgfortran5/024meOyA/i686-w64-mingw32-libgfortran5-cxx11/destdir
[ Info: Normalising timestamps in import library /cache/build/yggy-amdci7-15/julialang/yggdrasil/O/odrpack/build/i686-w64-mingw32-libgfortran5/024meOyA/i686-w64-mingw32-libgfortran5-cxx11/destdir/lib/libodrpack95.dll.a
[ Info: Checking license file
[ Info: Found license file(s): LICENSE
[ Info: Found a valid dl path libatomic-1.dll while looking for libodrpack95
[ Info: Found a valid dl path libgcc_s_sjlj-1.dll while looking for libodrpack95
[ Info: Found a valid dl path libgfortran-5.dll while looking for libodrpack95
[ Info: Found a valid dl path libgomp-1.dll while looking for libodrpack95
[ Info: Found a valid dl path libopenblas.dll while looking for libodrpack95
[ Info: Found a valid dl path libquadmath-0.dll while looking for libodrpack95
[ Info: Found a valid dl path libssp-0.dll while looking for libodrpack95
[ Info: Found a valid dl path libstdc++-6.dll while looking for libodrpack95
[ Info: Found a valid dl path libwinpthread-1.dll while looking for libodrpack95
[ Info: Could not locate libodrpack95 inside ["/cache/build/yggy-amdci7-15/julialang/yggdrasil/O/odrpack/build/i686-w64-mingw32-libgfortran5/024meOyA/i686-w64-mingw32-libgfortran5-cxx11/destdir/bin"]
┌ Error: Built odrpack but libodrpack95 still unsatisfied:
└ @ BinaryBuilder /cache/julia-buildkite-plugin/depots/e2fd9734-29d8-45cd-b0eb-59f7104f3131/packages/BinaryBuilder/3eUfg/src/AutoBuild.jl:987
ERROR: LoadError: Cannot continue with unsatisfied build products!

Conversely, when I build using meson, the build succeeds for all platforms except macos, where I get the following linker error:

[17:14:50] DEPRECATION: "pkgconfig" entry is deprecated and should be replaced by "pkg-config"
[17:14:50] The Meson build system
[17:14:50] Version: 1.4.0
[17:14:50] Source dir: /workspace/srcdir/odrpack95
[17:14:50] Build dir: /workspace/srcdir/odrpack95/build
[17:14:50] Build type: cross build
[17:14:50] Project name: odrpack95
[17:14:50] Project version: 2.0.1
[17:14:50] Fortran compiler for the host machine: /opt/bin/x86_64-apple-darwin14-libgfortran5-cxx11/x86_64-apple-darwin14-gfortran (gcc 12.1.0 "GNU Fortran (GCC) 12.1.0")
[17:14:50] Fortran linker for the host machine: /opt/bin/x86_64-apple-darwin14-libgfortran5-cxx11/x86_64-apple-darwin14-gfortran ld64 530
[17:14:50] 
[17:14:50] ../meson.build:1:0: ERROR: Unable to detect linker for compiler `/opt/bin/x86_64-apple-darwin14-libgfortran5-cxx11/x86_64-apple-darwin14-clang -Wl,--version -L/workspace/destdir/lib -fuse-ld=/opt/bin/x86_64-apple-darwin14-libgfortran5-cxx11/x86_64-apple-darwin14-ld`
[17:14:50] stdout:
[17:14:50] stderr: ld: unknown option: --version
[17:14:50] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[17:14:50] 
[17:14:50] 
[17:14:50] A full log can be found at /workspace/srcdir/odrpack95/build/meson-logs/meson-log.txt
[17:14:50]  ---> meson setup .. --cross-file="${MESON_TARGET_TOOLCHAIN}" -Dbuild_shared=true
[17:14:50]  ---> meson setup .. --cross-file="${MESON_TARGET_TOOLCHAIN}" -Dbuild_shared=true
[17:14:50] Previous command exited with 1
[17:14:50] Child Process exited, exit code 1
ERROR: LoadError: Build for odrpack on x86_64-apple-darwin-libgfortran5 did not complete successfully

Can you please help me fix one of the two cases, so that I do not have to use a combination of the two build systems to cover all platforms? Thanks.

The only file being installed is the import library, which is fairly useless without the actual shared library. Without having looked at the code I’d say this is a bug in the build system of the package you’re trying to compile. Perhaps it can be fixed, but it’d require reading and understanding the CMake files.

Meson is somewhat nice, but also incredibly stupid and stubborn in many cases. It can’t use lld as linker when targeting macOS, so you have to pass clang_use_lld=false to the build_tarballs(...) function. You’ll note that most recipes on Yggdrasil using Meson have to do the same.

Thanks, @giordano. The suggestion you proposed for the meson build worked just fine!