servo icon indicating copy to clipboard operation
servo copied to clipboard

Build fails on MacOS Sonoma 14.4.1

Open NwE0kmCE opened this issue 1 year ago • 2 comments

After following macOS install instructions and running ./mach bootstrap without any errors, ./mach build fails with this error:

error: failed to run custom build command for `gobject-sys v0.19.8`

Caused by:
  process didn't exit successfully: `/Users/august/projects/servo/target/debug/build/gobject-sys-cfb456df51227704/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=GOBJECT_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-apple-darwin
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_apple_darwin
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=
  pkg-config exited with status code 1
  > PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig/ PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags gobject-2.0 gobject-2.0 >= 2.56

  The system library `gobject-2.0` required by crate `gobject-sys` was not found.
  The file `gobject-2.0.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  PKG_CONFIG_PATH contains the following:
      - /opt/homebrew/lib/pkgconfig/

  HINT: you may need to install a package such as gobject-2.0, gobject-2.0-dev or gobject-2.0-devel

/opt/homebrew/lib/pkgconfig/ contains gobject-2.0.pc, so I'm not quite sure what the next steps to debug this are... I tried multiple shells in case the PKG_CONFIG_PATH variable gets used differently between them, and I tried looking through the pkg_config crate source for clues as to what's going wrong but couldn't find anything that could be fixed.

NwE0kmCE avatar Aug 27 '24 21:08 NwE0kmCE

Using ./mach build --media-stack dummy the build succeeds

NwE0kmCE avatar Aug 28 '24 04:08 NwE0kmCE

On Mac, we rely on the global GStreamer installation rather than the Homebrew version. Does /Library/Frameworks/GStreamer.framework/Versions/1.0 exist on your machine? It should be there if the bootstrap process completed correctly.

mukilan avatar Aug 28 '24 07:08 mukilan

I have the same issue but ./mach bootstrapfailed with

Downloading https://github.com/servo/servo-build-deps/releases/download/macOS/gstreamer-1.0-1.22.3-universal.pkg ...
Downloading GStreamer libraries: 100.0%
Downloading https://github.com/servo/servo-build-deps/releases/download/macOS/gstreamer-1.0-devel-1.22.3-universal.pkg ...
Downloading GStreamer development support:  21.6%
Installing GStreamer packages...
Password:
installer: Package name is GStreamer 1.0
installer: Installing at base path /
installer: The install was successful.
installer: Error - the package path specified was invalid: '/var/folders/5j/SOME_RANDOM_SUB_FOLDERS/gstreamer-1.0-devel-1.22.3-universal.pkg'.
Traceback (most recent call last):
  File "/Users/XXX/servo/./mach", line 48, in <module>
    main(sys.argv)
  File "/Users/XXX/servo/./mach", line 25, in main
    sys.exit(mach_bootstrap.bootstrap_command_only(topdir))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/servo/python/mach_bootstrap.py", line 204, in bootstrap_command_only
    servo.platform.get().bootstrap(force, skip_platform, skip_lints)
  File "/Users/XXX/servo/platform/base.py", line 62, in bootstrap
    installed_something |= self._platform_bootstrap(force)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/servo/python/servo/platform/macos.py", line 54, in _platform_bootstrap
    installed_something |= self._platform_bootstrap_gstreamer(target, False)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/XXX/servo/python/servo/platform/macos.py", line 73, in _platform_bootstrap_gstreamer
    subprocess.check_call(
  File "/opt/homebrew/Cellar/[email protected]/3.12.5/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', 'sh', '-c', "installer -pkg '/var/folders/5j/SOME_RANDOM_SUB_FOLDERS/gstreamer-1.0-1.22.3-universal.pkg' -target / &&installer -pkg '/var/folders/5j/SOME_RANDOM_SUB_FOLDERS/gstreamer-1.0-devel-1.22.3-universal.pkg' -target /"]' returned non-zero exit status 1.

The folder /Library/Frameworks/GStreamer.framework/Versions/1.0exists, though.

Any ideas?

sfleiter avatar Sep 05 '24 18:09 sfleiter

Try installing the two pkg files from the URLs at the top of the output manually and then running again. This looks a bit like a failed install that never completed.

mrobinson avatar Sep 05 '24 19:09 mrobinson

@mukilan /Library/Frameworks/GStreamer.framework/Versions/1.0 exists on my machine, but I'm still not sure where/if I should be setting the PKG_CONFIG_PATH to point to

NwE0kmCE avatar Sep 05 '24 19:09 NwE0kmCE

AFAIU we make sure that pkg-config binary from GStreamer installation is used, which ensures PKG_CONFIG_PATH is set to the required value for that GStreamer installation.

We used to explicitly set PKG_CONFIG_PATH but that was removed in d43adb1a92c419680be86e7335f3de84b75fb2ef based on the documentation in gstreamer-rs crate.

@augustkline Can you run the following command and share the output:

/Library/Frameworks/GStreamer.framework/Versions/1.0/bin/pkg-config --variable pc_path pkg-config

mukilan avatar Sep 06 '24 06:09 mukilan

@sfleiter can you try ./mach boostrap-gstreamer --force and see if that helps?

mukilan avatar Sep 06 '24 06:09 mukilan

@mukilan ./mach bootstrap-gstreamer --force worked. Thanks for your help!

Can it be that the download broke and that caused the issue? I am on a weak WiFi these days.

If that is the case maybe mach could try to retry the download or print the command to retry the broken step.

Simply running mach bootstrap again did nothing and thus only manual repair was left was possible if one does not know mach enough to find the specific mach command.

sfleiter avatar Sep 06 '24 07:09 sfleiter

@mukilan I get /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig:/Library/Frameworks/GStreamer.framework/Versions/1.0/share/pkgconfig, ./mach bootstrap-gstreamer --force also worked for me though!

NwE0kmCE avatar Sep 20 '24 16:09 NwE0kmCE