Skip to content

Conversation

@CoffeeFlux
Copy link
Contributor

@CoffeeFlux CoffeeFlux commented Feb 9, 2019

Opened the PR for feedback despite a few remaining things that need to be cleaned up. The biggest benefit of this over autotools is that it enables easy compilation with MSVC, avoiding the need for a manual solution file which is difficult to maintain.


Current PR Status

Not-CoffeeFlux here, since this PR went on for quite a while and GitHub likes to hide comments not near the start or very end, i’ve taken the liberty to edit details about the current status here for better discoverability *(mostly based on an updated version of this comment):

TODOs before merge

Nice-to-haves which can be added after merge

  • CI for muon + samurai, possibly including muon fmt and muon analyze
  • check meson builds work from tarballs in CI
  • automated libtool version upgrades read from configure.ac
  • drop macro defines for hard dependecies from both buildsystems
  • investigate replacing the python dep on Windows with muon’s script support (if we can gracefully fallback to Python for non-muon meson)

Missing features/deficiencies, which will not be added/resolved

  • x86 assembly is always forced into PIC mode
  • support for the compare utility
  • support for the fuzz utility
    • support for the special build required for OSS Fuzz
  • support for checkasm tests and benchmarks
  • built-in support for running the regression test collection

Missing due to meson deficiencies

Contained Workarounds for Meson bugs or missing features

(after the pre-merge TODOs are resolved)

Other noteworthy things

  • FreeType Wrap force-disables HarfBuzz to avoid issues in case both are built as subprojects. I don't really expect Meson to transparently handle circular dependencies like this, but it means HarfBuzz is still force-disabled even if only (a newer version of) FreeType is built as a wrap and a suitable HarfBuzz is already present on the system.
  • Same for the HarfBuzz wrap force-disabling FreeType support
  • the checked symbol for CoreText detection differs, but (now that we actually support even the oldest CoreText version) this shouldn’t be an issue
  • On Windows the build requires Python (even with muon+samurai or similar) for generating the symbol file (for good reason: we don't want to maintain the basically same symbol list twice; a proper platform-independent symbol export control in meson would also resolve this)
  • The library version is now duplicated from libass/Makefile_library.am to libass/meson.build and we’ll need to remember to always bump both and keep them in sync. Since we probably want to avoid requiring Python on more platforms this is acceptable I guess
  • In case anyone relying on this default reads this: when building both static and dynamic library on systems which do not generally require/enforce PIC, libtool will build the static lib without and the dynamic with PIC by default. Meson will by default build both with PIC (reusing the same object files for both). This can be changed with the b_staticpic user option or the pic argument in which case sources will be compiled twice. (but ofc the most perf-critical part, the assembly, is always built with PIC in this Meson setup regardless)

muon

(possibly a bit outdated, recheck; originally for muon 5e2b27d446cd)

  • muon fails to find iconv with the new logic (despite claiming compatibility with meson 1.1.99); see https://todo.sr.ht/~lattis/muon/105
  • but otherwise builds this PRs setup just fine
  • it apparently internally treats C and assembly as different languages and as a result has a bug atm of not adding c_args to the assembler (https://todo.sr.ht/~lattis/muon/99) (ironically this closer to what we’d ideally like to have, but it’s incompatible with meson and no way to specifically set AS_FLAGS was exposed anyway)

@jesec
Copy link

jesec commented Feb 12, 2019

Solution and VC project files are not difficult IMO. Actually I think they are quite simple. Check #331. It is also important to note that to include libass in other MSVC projects. We do need a vcproj file or we have to compile the lib manually and include them which could be PITA. Using standard MSVC project can also enable the use of Visual Studio which can greatly ease the development on Windows platform. I do not oppose meson, though. I just want to state that meson doesn't make MSVC worthless.

@CoffeeFlux
Copy link
Contributor Author

CoffeeFlux commented Feb 12, 2019 via email

@astiob
Copy link
Member

astiob commented Feb 12, 2019

I just want to add that we actually have an official MSVC project: libass/libass-msvc; but nobody from the core team works on it.

Do I understand correctly that the Meson build is supposed to replace the Autotools build?

Is there a particular reason Meson specifically is chosen for this (rather than, say, CMake, Waf as used by mpv, gyp, or any of the other myriad of new build systems—note that I have no serious experience using any of them, so the specific examples I’m listing are just the first names that come to mind), or is it just because you want to get rid of Autotools and this is the alternative that you know best? I’m not familiar with Meson yet, but I see GNOME and systemd reportedly use it exclusively now and several other big projects are adding it as an alternative build system. This shows its popularity and suggests that users may become more familiar with it in the future, which is good, although I’m still curious why specifically Meson achieved this.

What could be the downsides to this switch? The first thing I see is that the user will seem to need to install Python, Meson and Ninja before they can build. There is also something about FreeType versioning mentioned in the files added in this PR. Could there be any other issues or lost capabilities?

@CoffeeFlux
Copy link
Contributor Author

CoffeeFlux commented Feb 12, 2019

For this PR, I've intended the Meson port as an autotools alternative that will allow easier compatibility with Windows. There is intentionally no commit removing the autotools system—this is intended as purely supplementary for now. The build files are plain text and the syntax fairly simple and readable, so I think it's much easier to maintain than a manual solution file while still allowing for MSVC support.

If you ultimately decide Meson/MSVC support isn't something you're interested in maintaining, I can always submit this to wrapdb instead. However, given that this should have feature-parity with the autotools system once I resolve the remaining issues I thought it was worth PRing to see if you want to officially support it and potentially migrate to it over time once it's been more thoroughly tested. I understand that a lot of projects get lazily PR'd with a Meson port that only works on their platform of choice, but I've made some effort to ensure that's not the case and will happily resolve remaining concerns in that department.

The biggest downside is definitely the Python requirement to build. There's not really any way around that, unfortunately, and projects switching fully to Meson appear to have been able to sort it out in older distros. The Freetype versioning thing is something I need to look into more and potentially fix upstream in wrapdb, which is why I noted it down. It appears the library has two totally separate versions for the release and the library, and the Meson port is using the former when it should be using the latter. The only big hack is this: c1da6f3#diff-b1946738041655e145a678c01b7ef7c7, which is done to properly expose the headers while building as a subproject. The topic has an issue open in the Meson repo and if it's not resolved soon I may fix it myself, but it's pretty annoying and the workaround is ugly. Additionally, the Harfbuzz subproject does not currently point at the main repo since a Meson port has only been PR'd, but the maintainers have expressed their interest in switching fully to it and I expect it will be merged: harfbuzz/harfbuzz#1437. There may also be compatibility issues on weird platform/OS pairs, and I have no way to test that or try and ensure functionality thereof. The port in its current form may also not support very old versions of OSX or Apple watches since I think they changed up the modules needed for CoreText, but that's something I can fix if it's a concern, I just again have no way to test it since I don't own a Mac and trying to run OSX in a VM is nightmarish.

I have three main reasons for choosing Meson. As far as modern C++ build systems go, I'm only familiar with CMake and Meson, and of the two I find Meson to be far easier to read and use – it supports all the features I'd hope for in a modern build system but is actually readable. It's also the direction a lot of open-source projects are taking in general, as you mentioned, and the adoption rate seems to be increasing rather than the other way around since it really is pleasant to work in. Finally, once the harfbuzz port is merged in, all of libass's dependencies will either have direct Meson support or be properly supported by the Meson project in the wrapdb. This means that even if none of the dependencies are installed on the system (think Windows), they are grabbed, built, and linked automatically. This can of course be enabled or disabled for any individual dependency – see the feature options. This in turn makes libass to use as a dependency, and so for other Meson projects using it (gstreamer, soon to be my Aegisub fork) you just make a wrap file specifying the git repository and everything Just Works with any build configuration/flags the other subprojects support. There are undoubtedly numerous other points of comparison between all the various modern build systems, but again I'm only familiar with CMake and Meson and as far as I'm concerned Meson wins that comparison pretty handily.

@CoffeeFlux
Copy link
Contributor Author

Solution and VC project files are not difficult IMO. Actually I think they are quite simple.

The format is not properly specified and is definitely not intended to be edited by hand. Unless one of the maintainers actually uses Visual Studio, I fully expect any other solution file to go the way of the current official one. If some maintainer wants to offer to be responsible for it, that changes things, but I highly doubt that is the case. Meson works on other platforms and is easy to integrate with CI, so it strikes me as a much more viable option for ensuring MSVC compatibility long-term. I'm also willing to maintain it since I'll have a project making use of it, for whatever that's worth.

@vadosnaprimer
Copy link

Just a note, there is a project dedicated to adding MSVC support to a whole bunch of tools like libass, and its libass fork is active since 2013:
https://github.com/ShiftMediaProject/libass
https://github.com/ShiftMediaProject/libass/tree/master/SMP

It has all libass dependencies submoduled and provided MSVC support as well, and I'm using it to step through it all in VS2017 right this moment. But it's true that the MSVC projects are supported manually there, so switching this whole suite to automatic support would be cool.

@CoffeeFlux
Copy link
Contributor Author

I think this is mostly ready for review. The harfbuzz and fontconfig meson ports are still being PR'd and the submodules will need to be updated once they're merged, but otherwise I think it seems to be functional.

@CoffeeFlux
Copy link
Contributor Author

CoffeeFlux commented Sep 26, 2019

Quick update:

Harfbuzz appears to have been PR'd and received positively but not received a full review, and thus hasn't been merged. Seems it's easy to continually rebase, so hopefully behdad will get around to it eventually. See harfbuzz/harfbuzz#1437

Last I checked this built on Windows, Arch, and my MBP, though if other platforms are a concern I can try to get a device to test. The harfbuzz meson port not yet merged upstream isn't a blocker in my eyes, since this will default to system dependencies if available (which is usually the case on OSX/Linux) and still builds with a reasonably recent version on Windows. Additionally, happy to rebase whenever @astiob has time to review this, I just don't want to do so repeatedly for no reason.

@CoffeeFlux CoffeeFlux changed the title WIP: port of the build system to meson Port of the build system to meson Oct 5, 2019
@Luni-4
Copy link
Contributor

Luni-4 commented May 31, 2020

@CoffeeFlux

Is there any update for this PR? harfbuzz/harfbuzz#1437 has been merged.

@CoffeeFlux
Copy link
Contributor Author

Unfortunately I think this PR is also going to require some updating when rebasing, so I'm still holding off until I hear from @astiob that someone might look at it. At whatever point there's interest, I'll update the dependencies and rebase.

@CoffeeFlux
Copy link
Contributor Author

Fixing up a couple additional things and then I'll rebase. This should still be in reasonably good shape.

@CoffeeFlux
Copy link
Contributor Author

This PR is no longer feature-complete with the autotools build system, since I haven't implemented the regression testing bits from 46f4495. They shouldn't be particularly difficult, but I'd rather deal with that in a followup unless it's a blocker.

@CoffeeFlux
Copy link
Contributor Author

CoffeeFlux commented Oct 29, 2020

For what it's worth, this seems to work for building Aegisub via meson. That process uncovered a couple issues which have been fixed, and some of the other recent commits are bumping dependencies and reflecting the fact upstream harfbuzz switch to meson. Should be ready for review once again, or for inclusion in wrapdb if there's no interest upstream. @astiob

@astiob
Copy link
Member

astiob commented Nov 1, 2020

OK; finally reviewed the code. Thanks for bearing with us.

First, the best thing: the code does look pretty clear, and I can imagine us being able to maintain the Meson build without much extra effort, regardless of whether we keep maintaining the autotools build at the same time.

Speaking of feature parity with the autotools build, there are still some omissions: e. g. x32 assembler support on Linux.

I’m worried by the Python requirement, if we were to make Meson the only build system available. Looking at the Meson manual, it says it needs not just any old Python but Python 3.5. Of course, on a fully up-to-date OS this poses no problem, but I don’t like the prospect of making libass fail to build on mildly outdated systems simply due to incompatibility of the build system. (pyenv may help one install a newer Python—I know it’s helped me on a Linux box that still has Python 3.4 in the system repo—but I don’t know how universally applicable it is, and it’s still an extra hoop to jump through.)

Personally, I also still don’t see how Meson achieves its promise of being more user-friendly when it e. g. requires a separate build directory and defaults to a debuggable nonoptimized build. (The only time I ever want a nonoptimized build is when I’m stuck debugging someone else’s code or an elusive bug in my own and I resort to attaching an actual interactive debugger. And even then I may try -Og first. This seems like a pretty bad default to me.) Its behaviour of configuring once and doing nothing when invoked again also adds yet another couple of extra hoops for OSS-Fuzz builds to jump through to clear the build directory before starting the build, but I can see how that may be a beneficial feature when a human is using it interactively; then again, it’s gonna be a pain when I switch branches and bisect.

The HarfBuzz PR linked earlier also mentions a desire for a make distcheck equivalent, which I think went unanswered in that thread. FWIW, ninja dist in Meson 0.41 seems to be an equivalent that should work for us that I found with a very quick Google search.

My overall impression is:

  • I think I wouldn’t mind having autotools and Meson in our main tree because our build configs are simple and look to be only simpler in Meson (although we should ensure full feature parity);
  • I’m not yet convinced that we should/can safely drop autotools;
  • I’m not yet convinced that I should start using Meson myself;
  • our immediate gains from gaining a Meson build would be:
    1. easier Visual Studio builds (although I have no idea how easily they’re integrated into larger solutions),
    2. easier builds with full dependencies (no more “FriBidi/HarfBuzz is so hard to build, please make them optional”, as Meson can do it all by itself);
  • I imagine it’s better for the society if we maintain a Meson build directly in our main repository rather than in wrapdb where it may become outdated;
  • I’m slightly annoyed by Meson’s apparent contagiousness that’s one of the causes for this discussion and seemingly an important reason for Meson being the build system candidate.

The Freetype versioning thing is something I need to look into more and potentially fix upstream in wrapdb, which is why I noted it down. It appears the library has two totally separate versions for the release and the library, and the Meson port is using the former when it should be using the latter.

If the wrapdb module uses FreeType’s public release number, I believe the minimum we want is 2.2.1.

@CoffeeFlux
Copy link
Contributor Author

Thanks for taking a look! Some additional context for points below:

Speaking of feature parity with the autotools build, there are still some omissions: e. g. x32 assembler support on Linux.

Happy to remedy that, though I might not get to it until next weekend.

requires a separate build directory

For what it's worth, most of the modern build systems push a separate build directory, and I personally consider mandating out of tree builds to be a feature rather than a limitation. YMMV.

and defaults to a debuggable nonoptimized build

You can change this as part of the project call at the top of the main file. I'll update this PR to debugoptimized.

easier Visual Studio builds (although I have no idea how easily they’re integrated into larger solutions),

I believe you can just import the generated project files into a larger solution wholesale, but I have admittedly not tried it myself.

I’m slightly annoyed by Meson’s apparent contagiousness that’s one of the causes for this discussion and seemingly an important reason for Meson being the build system candidate.

I do agree here, though it's worth noting it's far more compatible with something like CMake than it is autotools since they have more common assumptions. Using a CMake subproject is fairly easy, and autotools is at least possible (though still not preferable) under certain requirements, one of which is supporting out of tree builds. I personally like meson more than CMake regardless of the contagiousness, and I think some other people in the ecosystem have come to a similar conclusion. Again, YMMV.

If the wrapdb module uses FreeType’s public release number, I believe the minimum we want is 2.2.1.

Ah, great. Will update.

@TheOneric TheOneric added the build label Nov 6, 2020
@CoffeeFlux
Copy link
Contributor Author

It appears freetype got an upstream meson port merged in a couple weeks ago, so I need to update the wrapfile to reflect that. I'll hopefully get to it this week, or next weekend at the latest.

@CoffeeFlux
Copy link
Contributor Author

CoffeeFlux commented Nov 15, 2020

Updating the port and I'm getting a ton of warnings like this on OSX:

../libass/x86/blur.asm:994: warning: dropping trailing empty parameter in call to multi-line macro `DEFINE_ARGS_INTERNAL' [-w+macro-params-legacy]
../libass/x86/blur.asm:919: ... from macro `BLUR_VERT' defined here
/Users/ryan/git/libass/libass/x86/utils.asm:736: ... from macro `cglobal' defined here
/Users/ryan/git/libass/libass/x86/utils.asm:771: ... from macro `cglobal_internal' defined here
/Users/ryan/git/libass/libass/x86/utils.asm:589: ... from macro `PROLOGUE' defined here

Any idea if those are genuine or an issue on my end?

@CoffeeFlux CoffeeFlux marked this pull request as draft November 19, 2020 17:34
@CoffeeFlux CoffeeFlux marked this pull request as ready for review January 9, 2021 10:13
@CoffeeFlux
Copy link
Contributor Author

CoffeeFlux commented Jan 10, 2021

Should be ready for another look.

I'm consuming this for GH actions CI builds on Windows, Mac, and Linux with build types debugoptimized and release, and haven't really tested any other configurations since my latest batch of changes.

As mentioned above, this doesn't support the regression testing functionality added since the initial PR and implementing that isn't a big priority for me unless it's blocking a merge.

Copy link
Member

@TheOneric TheOneric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's start with the worst part: It doesn't build for me on Debian Sid.
Configuration "works" (with some caveats mentioned in further comments) but on invoking ninja build fails with the compiler being unable to find some unspecified file. When running sequentially ass_strtod.c is the first file to fail for me (yes ../libass/ass_strtod.c does exists).
Nonetheless, below are some comments about problems in configuration etc as well
as some questions.

Although this is probably to blame on our old configure.ac being unsorted, I think the main meson.build file could become more readable by reordering everything a bit; but apart from the ASM logic, which is really displaced, this is more a nitpick; feel free to leave it as is. Otherwise here's how configure.ac is sorted now, if you want to follow that:

  • general build system and compiler setup
  • header and function checks
  • system libs
  • all other libs with font providers being last
  • ASM stuff
  • finalising the output

More generally most of those commits should be squashed before a possible merge (probably everything except the gnu99 to c99 change).
I'm also a bit concerned about having to maintain and update versions and build properties for all of our dependencies — which can differ depending on target platform. See the relative high rate of "fix dependency flags"-type commits in this pr.

Copy link
Member

@TheOneric TheOneric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it’s getting really close now, most comments are just cosmetic nits :)

Apart from the few commented things ASM logic is now also looking good after the final final change

This thread is also still open btw

I probably asked this before but just to make sure is it correct that source files do not list any headers?
I’m asking (again) because i noticed touching a header, e.g. libass/x86/cpuid.h, or source file, e.g. libass/ass.c, causes seemingly all files to be rebuilt rather than just those actually changed or depending on the changed ones.

@eli-schwartz
Copy link

I probably asked this before but just to make sure is it correct that source files do not list any headers? I’m asking (again) because i noticed touching a header, e.g. libass/x86/cpuid.h, or source file, e.g. libass/ass.c, causes seemingly all files to be rebuilt rather than just those actually changed or depending on the changed ones.

Autotools works fine without headers listed, except that:

  • generated files won't be ordered properly for first time use
  • headers will be "forgotten" when running make distcheck, leading to failure when testing the produced dist tarball.

Meson uses a different approach for including files in the dist, so the main reason to list headers is not relevant.

It's possible that the includes are indirect. I've never seen touching a .c file causing other .c files to suddenly require rebuilding though. Either way, it doesn't make sense for underspecified header dependencies to cause more files to be rebuilt rather than fewer.

@torque
Copy link
Collaborator

torque commented Apr 14, 2024

touching a header, e.g. libass/x86/cpuid.h, or source file, e.g. libass/ass.c, causes seemingly all files to be rebuilt rather than just those actually changed or depending on the changed ones.

I can't reproduce this behavior locally. If I touch libass/ass.c, the only thing that happens is recompiling that specific file and then re-linking the libraries, which is what I would expect. Touching a common header like libass/ass.h does cause all files that include it to get rebuilt, as expected, but this is still not rebuilding the entire source tree for me (25 commands instead of 31 as used for a full rebuild).

@arch1t3cht
Copy link
Contributor

touching a header, e.g. libass/x86/cpuid.h, or source file, e.g. libass/ass.c, causes seemingly all files to be rebuilt rather than just those actually changed or depending on the changed ones.

I can't reproduce this behavior locally.

A possible reason for this is that touching a file can cause the git describe call to add -dirty even if there are no actual modifications. (I'm not sure if this is intended behavior in git or not. Running git status causes future git describe calls to no longer output -dirty when there are no modifications.) This changes config.h which is included almost everywhere.

@TheOneric
Copy link
Member

A possible reason for this is that touching a file can cause the git describe call to add -dirty even if there are no actual modifications. (I'm not sure if this is intended behavior in git or not. Running git status causes future git describe calls to no longer output -dirty when there are no modifications.) This changes config.h which is included almost everywhere.

Yep, good find, that’s it. I can reproduce the -dirty state and running git status after touch results in only actually affected files being rebuilt

@TheOneric
Copy link
Member

With that said, using muon setup -Ddefault_library=shared muon-build/ also fails for me with ninja: error: stat(libass/libass.dylib): Too many levels of symbolic links.

fwiw, building default_library=shared or both with muon works fine for me on Linux (sans iconv, x32 NASM and general issues with this shared setup)

Copy link
Member

@TheOneric TheOneric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took a while, but this seems basically all fine to me now ^^

I’ll leave it open for a bit more in case other maintainers want to chime in (e.g. about this)or someone has an idea for a sensible workaround for the git -dirty quirk. If nothing comes up i’ll take a final look to recheck and merge

@torque can you toggle the “Allow edits by maintainers” setting off and on again? maybe this will fix it so i can push the squash and docs for a clean merge later
(if you don’t want to squash yet or at all in this branch let me know)

@torque
Copy link
Collaborator

torque commented Apr 14, 2024

@TheOneric looks like it might be an issue with github and the fact that the fork is from an organization: https://github.com/orgs/community/discussions/5634. However, I can get you write access to the PR branch.

@CoffeeFlux
Copy link
Contributor Author

@TheOneric I've given you write perms for the tstools fork of the repo. Let me know if that doesn't work.

@TheOneric TheOneric force-pushed the meson-pr branch 2 times, most recently from 0887920 to 08d3967 Compare April 15, 2024 00:04
@TheOneric
Copy link
Member

Added short docs to README.md and squashed. I had to put Reviewed-by tags before Co-Authored-by for GitHub to pick up the latter.

Please check docs, commit message and if everyone involved is attributed

For reference, this is the full patch history before squashing: 6b895b4...011c223

@TheOneric TheOneric added this to the 0.18.0 milestone Apr 15, 2024
This will bring back a first-party buildsystem for MSVC
after the previous solution https://github.com/libass/libass-msvc
was retired and make it easier to use libass as a subproject
in other meson projects.

It does not currently support all of our utilities nor testing
and fuzzing infrastructure and x86_32 assembly is always built in
PIC mode.
Due to meson deficiencies shared libraries lack symbol export control
and it is not possible to build x32 assembly.

However, for packaging and downstream use it is feature complete on
Windows and static-only builds are sufficient for subproject use on any
platform, so it brings a net positive and keeping this level of support
up alongside autotools is expected to be barely any effort.
And ofc future meson versions and patches
to this build setup might improve it further.

The port was initially brought up by Ryan Lucia (CoffeeFlux)
and later further adapted and polished for merge
by arch1t3cht and torque, but several more people
contributed bits and pieces. They are listed in the following.

Reviewed-by: Eli Schwartz <eschwartz93@gmail.com>
Reviewed-by: Oneric <oneric@oneric.stub>

Co-authored-by: arch1t3cht <arch1t3cht@gmail.com>
Co-authored-by: torque <torque@users.noreply.github.com>
Co-authored-by: Luni-4 <luni-4@hotmail.it>
Co-authored-by: Funami580 <Funami580@users.noreply.github.com>
Co-authored-by: woclass <5158738+inkydragon@users.noreply.github.com>
Co-authored-by: line0 <line0@inbox.lv>
Co-authored-by: Myaamori <myaamori1993@gmail.com>
Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
@TheOneric
Copy link
Member

All set ready for merge with some minor modifications since squashing:

  • meson build files are now included in tarballs
  • fake_headers are now added to libass_dep rather than libass itself
  • tiny tweak of the build documentation in README.md

@TheOneric TheOneric merged commit 342a0d2 into libass:master Apr 20, 2024
@nanake
Copy link

nanake commented Apr 20, 2024

meson unable to find nasm for me in cross build.

[root@280846b49fc7 build]# meson setup --prefix="$FFBUILD_PREFIX" --buildtype=release -Ddefault_library=static --cross-file=/cross.meson ..
The Meson build system
Version: 1.3.2
Source dir: /stage/ass
Build dir: /stage/ass/build
Build type: cross build
Project name: libass
Project version: 0.17.1
C compiler for the host machine: x86_64-w64-mingw32ucrt-gcc (gcc 14.0.1 "x86_64-w64-mingw32ucrt-gcc (GCC) 14.0.1 20240127 (Fedora MinGW 14.0.1-1.fc40)")
C linker for the host machine: x86_64-w64-mingw32ucrt-gcc ld.bfd 2.42-1
C compiler for the build machine: cc (gcc 14.0.1 "cc (GCC) 14.0.1 20240410 (Red Hat 14.0.1-0)")
C linker for the build machine: cc ld.bfd 2.42.50.20240318
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
Compiler for C supports arguments -Wno-sign-compare: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Compiler for C supports arguments -Werror-implicit-function-declaration: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -D_POSIX_C_SOURCE=200809L: YES
Checking for function "strdup" : YES
Header "string.h" has symbol "strdup" : YES
Checking for function "strndup" : YES
Header "string.h" has symbol "strndup" : NO
Checking for function "fstat" : YES
Header "sys/stat.h" has symbol "fstat" : YES
Library m found: YES
Run-time dependency iconv found: YES
Found pkg-config: YES (/usr/bin/pkg-config) 2.1.0
Run-time dependency freetype2 found: YES 26.1.20
Run-time dependency fribidi found: YES 1.0.13
Run-time dependency harfbuzz found: YES 8.4.0
Run-time dependency libunibreak found: YES 6.1
Run-time dependency fontconfig found: YES 2.15.0
Run-time dependency appleframeworks found: NO (tried framework)
Run-time dependency appleframeworks found: NO (tried framework)
Has header "windows.h" : YES
Library gdi32 found: YES
Compiler for language nasm for the host machine not found.
../meson.build:263: WARNING: nasm was not found; ASM functions are disabled. Install nasm >= 2.10 for a significantly faster libass build.
Configuring config.h.in.in using configuration
Program ../gen_defs.py found: YES (/usr/bin/python3 /stage/ass/libass/../gen_defs.py)
Build targets in project: 6

libass 0.17.1

    Font providers   : Fontconfig
                       DirectWrite and GDI (Win32)
    ASM optimizations: NO

  User defined options
    Cross files      : /cross.meson
    buildtype        : release
    default_library  : static
    prefix           : /opt/ffbuild

Found ninja-1.11.1 at /usr/bin/ninja

nasm already installed

[root@280846b49fc7 build]# nasm --version
NASM version 2.16.02 compiled on Apr  6 2024

it works with legacy build

#92 13.14 checking for nasm... yes
#92 13.14 checking if nasm supports vpmovzxwd... yes

@vtorri
Copy link
Contributor

vtorri commented Apr 20, 2024

look in build/meson-logs/meson-log.txt to have more informations about the detection

@vtorri
Copy link
Contributor

vtorri commented Apr 20, 2024

also give the cross.meson file. No problem without cross-compilation here (win10+msys2), nasm is correctly detected

@nanake
Copy link

nanake commented Apr 20, 2024

nothing useful there

[root@6af008b4ea88 build]# cat meson-logs/meson-log.txt

-----------
Command line: `x86_64-w64-mingw32ucrt-gcc -L/opt/ffbuild/lib -I/opt/ffbuild/include /stage/libass/build/meson-private/tmpj92_cxtm/testfile.c -o /stage/libass/build/meson-private/tmpj92_cxtm/output.exe -static-libgcc -static-libstdc++ -O2 -pipe -D_FORTIFY_SOURCE=3 -fstack-protector-strong -D_FILE_OFFSET_BITS=64 -O0 -Wl,--start-group -lgdi32 -Wl,--end-group -Wl,--allow-shlib-undefined` -> 0
Library gdi32 found: YES
Compiler for language nasm for the host machine not found.
../meson.build:263: WARNING: nasm was not found; ASM functions are disabled. Install nasm >= 2.10 for a significantly faster libass build.
Configuring config.h.in.in using configuration
Program ../gen_defs.py found: YES (/usr/bin/python3 /stage/libass/libass/../gen_defs.py)
Build targets in project: 6

libass 0.17.1

    Font providers   : Fontconfig
                       DirectWrite and GDI (Win32)
    ASM optimizations: NO

  User defined options
    Cross files      : /cross.meson
    buildtype        : release
    default_library  : static
    prefix           : /opt/ffbuild

Found ninja-1.11.1 at /usr/bin/ninja

cross.meson:

[root@6af008b4ea88 build]# cat /cross.meson
[constants]
arch = 'x86_64-w64-mingw32ucrt'

[binaries]
c = arch + '-gcc'
cpp = arch + '-g++'
ar = arch + '-gcc-ar'
ranlib = arch + '-gcc-ranlib'
strip = arch + '-strip'
windres = arch + '-windres'
dlltool = arch + '-dlltool'
exe_wrapper = ['wine']

[properties]
needs_exe_wrapper = true

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

@arch1t3cht
Copy link
Contributor

You don't have nasm defined in your cross file.

@nanake
Copy link

nanake commented Apr 20, 2024

nasm is not a mandate in a crossfile. it works fine with other project that use meson to build, for example Netflix/vmaf.

@nanake
Copy link

nanake commented Apr 20, 2024

FWIW, netflix/vmaf, videolan/dav1d use find_program('nasm') to detect nasm.

@vtorri
Copy link
Contributor

vtorri commented Apr 20, 2024

but on win10 + msys2, doing cross-compilation, same problem : nasm not found.

There is this warning Compiler for language nasm for the host machine not found.

If I add in cross.meson

nasm = 'nasm'

it works:

Nasm compiler for the host machine: nasm (nasm 2.16.01)
Nasm linker for the host machine: x86_64-w64-mingw32-gcc ld.bfd 2.42

@xclaesse
Copy link
Contributor

I fixed that a while ago but the PR did not get merged: mesonbuild/meson#11855

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.