Page MenuHome

cmake/deps: Update mesa to 20.3.4
ClosedPublic

Authored by Sybren A. Stüvel (sybren) on Feb 2 2021, 12:11 AM.

Details

Summary

This resolves build error with Py3.9x, use meson build system
since autoconf/automake are no longer supported.

This adds ninja & meson as dependencies for Linux.


Needed to run mesa utilities with Python 3.9, see: https://cgit.freedesktop.org/mesa/mesa/commit/?id=6a841dbf4e4f0cb33bc36a8ba880a9bd6f6e7941

Edit: since running into this error on my first build, I'm no longer able to reproduce the Python failure, although Mesa-18.3.1 still contains the Python calls which are unsupported.

Now I'm running into a different linking error (below) which is resolved by updating to 20.3.4,
either way updating to a newer mesa allows make deps to build for me.

/usr/bin/ld: ../../../../src/gallium/auxiliary/.libs/libgallium.a(u_debug_symbol.o):(.bss+0x0): multiple definition of `symbols_hash'; ../../../../src/gallium/auxiliary/.libs/libgallium.a(u_debug_stack.o):(.bss+0x0): first defined here

Diff Detail

Repository
rB Blender
Branch
TEMP-PY39-CONFIG-API (branched from master)
Build Status
Buildable 12780
Build 12780: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Feb 2 2021, 12:11 AM

Write to the temp directory, since "${BUILD_DIR}/mesa/src/external_mesa" doesn't exist on first build.

Campbell Barton (campbellbarton) retitled this revision from cmake/deps: Update mesa to 20.3.4 (resolves build error w/ Py3.9x, use meson build system) to cmake/deps: Update mesa to 20.3.4.Feb 2 2021, 8:08 AM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)

Not maintaining the build_environment thing, so removing myself from reviewers. Changes make sense to me though.

build_files/build_environment/cmake/check_software.cmake should be updated to include meson and ninja.

Beyond that, if running ./blender-softwaregl works, looks good to me.

Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Add ninja & meson to check_software.cmake
  • Correct macOS/Debian commands (were swapped)
build_files/build_environment/cmake/check_software.cmake
31–32 ↗(On Diff #33529)

These are not needed on macOS.

Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
  • Remove ninja for mesa dependency for macOS
This revision is now accepted and ready to land.Feb 6 2021, 4:49 PM

Remove extra slash (cleaned up in master)

Sybren A. Stüvel (sybren) requested changes to this revision.Feb 9 2021, 5:03 PM

Building mesa is failing on my CentOS VM:

Program python3 found: YES (/usr/bin/python3)

meson.build:881:2: ERROR: Problem encountered: Python (3.x) mako module >= 0.8.0 required to build mesa.

So there are two issues:

  1. the wrong python3 executable is used, and
  2. the mako module isn't available.

From the mesa documentation I couldn't figure out whether the requirements (Python+Mako) are build-time or run-time requirements.

To make Meson (the build system) find the right Python, this can be added to native-files.ini-generator-script:

python = '${LIBDIR}/python/bin/python3'"

To work around the missing mako and keeping it separate from the rest of the system, I made a virtualenv, installed mako there, and pointed to it in the native-files.ini. This works, but then make external_mesa stops with this error:

Build-time dependency wayland-scanner found: NO (tried pkgconfig and cmake)

meson.build:1696:2: ERROR: Dependency "wayland-scanner" not found, tried pkgconfig and cmake

I could work around this by adding -Dplatforms=x11 to MESA_EXTRA_FLAGS, but of course this should only be done on Linux.

@Campbell Barton (campbellbarton) do you want to look into this, or shall I take over the patch?

build_files/build_environment/cmake/mesa.cmake
59 ↗(On Diff #33737)

What's the reason that .../external_mesa/build is used, instead of the common .../external_mesa-build?

This revision now requires changes to proceed.Feb 9 2021, 5:03 PM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)
This comment was removed by Campbell Barton (campbellbarton).

Accidentally updated wrong diff, correcting.

  • Use conventional build path ${BUILD_DIR}/mesa/src/external_mesa-build

@Sybren A. Stüvel (sybren)

  • I'd assume python3+mako are build-time only requirements since they're used for code-generation.
  • Setting python in the native-files.ini file seems fine.
  • -Dplatforms=x11 seems OK for now too, although we will eventually want to support wayland, note that mesa is only build on non-macOS Unix so I don't think that's a problem.
  • I wasn't aware of the *-build/ convention, updated.

Would you mind taking the patch from here? I could do this but I'd need to setup a centOS VM.

build_files/build_environment/cmake/mesa.cmake
59 ↗(On Diff #33737)

I wasn't aware this was the convention, +1

Campbell Barton (campbellbarton) marked an inline comment as done and an inline comment as not done.Feb 10 2021, 6:56 AM

Would you mind taking the patch from here? I could do this but I'd need to setup a centOS VM.

Sure.

This revision is now accepted and ready to land.Feb 11 2021, 2:13 PM

Setting python in the native-files.ini file seems fine.

After further investigation, this doesn't seem necessary. The CentOS VM setup script I inherited from Sergey already installed the python-mako package locally for Mesa. I guess the Mesa upgrade now causes it to find python 3 by default, and the CentOS mako package is only available for 2.7. Since using a local Python is fine, I'll just locally install Mako for py3 and leave it at that. That'll avoid "polluting" our own Python with a package Blender doesn't need.