Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a script to install Linux/*BSD dependencies for building #43377

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Nov 7, 2020

This closes godotengine/godot-proposals#1614.

The list of commands is taken from Compiling for Linux/*BSD, but with Wayland packages added and unattended CLI arguments (such as -y) added.

For Alpine, libexecinfo-dev has been removed from the package list due to DataDog/dd-trace-php#1824. See also #91817.

godotengine/godot-docs#9357 updates the commands in the documentation to be a perfect match for the ones in this script.

Command to test on a fresh system:

# Install `curl` using the distribution's package manager, then run:
curl -LO https://github.com/Calinou/godot/archive/add-linux-dependencies-install-script.tar.gz && tar xf add-linux-dependencies-install-script.tar.gz && cd godot-add-linux-dependencies-install-script && misc/scripts/install_linuxbsd_deps.sh && scons
# (triple-click to select the whole line)

All systems listed below are fresh Docker containers.

Successfully tested on

  • Alpine 3.19.1
    • Script is now written in POSIX sh to work out of the box on Alpine, which doesn't ship with Bash.
  • Debian 11 (oldstable), 12 (stable), 13 (testing)
  • Fedora 39, 40
  • Ubuntu 20.04, 22.04, 24.04
  • Arch Linux (May 2024)
  • Mageia 9
  • openSUSE Leap, Tumbleweed
  • Solus 4.5

Not tested on

Please test on these platforms if you can!

  • Gentoo
  • FreeBSD
  • OpenBSD
  • NetBSD

@Calinou Calinou force-pushed the add-linux-dependencies-install-script branch from c68d5c5 to 62468c6 Compare November 7, 2020 13:26
@Calinou Calinou added this to the 4.0 milestone Nov 7, 2020
@Calinou Calinou added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Nov 7, 2020
@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Sep 8, 2022
@Calinou Calinou force-pushed the add-linux-dependencies-install-script branch 10 times, most recently from 1b050b4 to 35be826 Compare May 10, 2024 17:54
@fire
Copy link
Member

fire commented May 10, 2024

What is missing to get this approved and merged?

@Calinou Calinou force-pushed the add-linux-dependencies-install-script branch 7 times, most recently from 4d7f2be to 9971578 Compare May 10, 2024 21:54
@Calinou Calinou marked this pull request as ready for review May 10, 2024 21:54
@Calinou Calinou requested a review from a team as a code owner May 10, 2024 21:54
@Calinou Calinou force-pushed the add-linux-dependencies-install-script branch from 9971578 to aa8782c Compare May 10, 2024 21:54
@Calinou
Copy link
Member Author

Calinou commented May 10, 2024

What is missing to get this approved and merged?

This should be ready to merge, but testing on the various BSDs would be appreciated. I haven't had much luck installing any of them in VirtualBox.

If someone knows their way around Gentoo, they could also test this PR.

@Calinou Calinou removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label May 10, 2024
@Calinou Calinou changed the title Add a script to install Linux dependencies for building Add a script to install Linux/*BSD dependencies for building May 12, 2024
@Calinou Calinou force-pushed the add-linux-dependencies-install-script branch from aa8782c to 20a6e82 Compare May 16, 2024 18:37
@kdiduk
Copy link
Contributor

kdiduk commented May 16, 2024

OpenBSD build is broken.

I've tried to build it on freshly installed OpenBSD in QEMU (in VirtualBox I couldn't install it) using the command in the description, and the build is broken. I've found 2 main problems:

  1. With the default scons build command it fails because it can't find the definition of quick_exit function in the file platform/linuxbsd/x11/detect_prime_x11.cpp, although the header <stdlib.h> is included.
  2. If I build with OpenGL disabled with scons opengl3=no (that way the source file above won't be included in the build), in fails with another error: it can't find the header file #include <linux/input-event-codes.h> (which is included in platform/linuxbsd/wayland/wayland_thread.cpp.

Maybe it would make sense to create a separate ticket (GitHib issue) for fixing the build in OpenBSD?

@Calinou
Copy link
Member Author

Calinou commented May 18, 2024

Maybe it would make sense to create a separate ticket (GitHib issue) for fixing the build in OpenBSD?

Yes, I suggest creating a separate issue.

Ideally, we should have some kind of CI for BSD (Cirrus CI can do it for instance), so that the build doesn't break again in the future. The issue is that we'd have to use another CI service than GitHub Actions specifically for this, as GitHub Actions doesn't have BSD instances.

@kdiduk
Copy link
Contributor

kdiduk commented May 19, 2024

Yes, I suggest creating a separate issue.

I've created #92130 to fix the build on OpenBSD

By the way, the script itself, to install the dependencies, seems working well in OpenBSD 🙂 I tried it in OpenBSD 7.5 amd64

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

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

Seems like there's a lot of people successfully testing this dependency installer.

There's one review comment that needs to be resolved regarding the sudo message but looks good to me.

@fire
Copy link
Member

fire commented May 22, 2024

The issue is that we'd have to use another CI service than GitHub Actions specifically for this, as GitHub Actions doesn't have BSD instances.

I found a cursed github action for freebsd https://github.com/marketplace/actions/freebsd-vm

@Calinou Calinou force-pushed the add-linux-dependencies-install-script branch from 20a6e82 to c311c58 Compare May 22, 2024 15:40
@akien-mga
Copy link
Member

akien-mga commented May 23, 2024

In general, adding such a script seems fine to me.

But the list of dependencies is actually outdated, most of the libs listed are now dlopen'd and we don't need their development packages installed to compile Godot.

From the Fedora list:

dnf install -y \
		scons \
		pkgconfig \
		libX11-devel \
		libXcursor-devel \
		libXrandr-devel \
		libXinerama-devel \
		libXi-devel \
		wayland-devel \
		mesa-libGL-devel \
		mesa-libGLU-devel \
		alsa-lib-devel \
		pulseaudio-libs-devel \
		libudev-devel \
		gcc-c++ \
		libstdc++-static \
		libatomic-static

The actual dependencies I have installed locally on Fedora 40 to compile Godot:

scons
pkgconfig
wayland-devel
gcc-c++
libstdc++-static

And if I want to use use_llvm, I would have to add:

clang
libatomic-static

So I think we should review the list and remove what's not actually needed anymore to compile Godot.

@leandro-benedet-garcia
Copy link

leandro-benedet-garcia commented May 26, 2024

The command inlined above, if executed without root in Gentoo I have this output:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 39.4M    0 39.4M    0     0  3286k      0 --:--:--  0:00:12 --:--:-- 3047k
Detected Linux/*BSD distribution: Gentoo
Installing dependencies...
This action requires portage group access...
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.

Would you like to add --pretend to options? [Yes/No] y
emerge: The 'sync' action does not support '--pretend'.

You normally shouldn't put a sync in gentoo because sync command tends to take a bit, more than other distros, so I would recommend not syncinc and just outright going for the install, just make sure that the --ask parameter is included in the emerge command.

@Calinou
Copy link
Member Author

Calinou commented May 26, 2024

just make sure that the --ask parameter is included in the emerge command.

I would prefer the script to be able to work in an unattended manner regardless of the distribution currently being used. This is important for CI use cases and the like.

This could be done by adding a -y argument to the script, but it's quite a bit of added code just to handle this for all distributions.

Ideally, package managers would stop asking for confirmation for safe operations (those that don't remove or downgrade any packages), but I'm not holding my breath for it 🙂

@leandro-benedet-garcia
Copy link

I would prefer the script to be able to work in an unattended manner regardless of the distribution currently being used. This is important for CI use cases and the like.

Oh boy, CI with gentoo? I think they would just make a ebuild based off the script instead. And a couple hundred cached things... But I can only shiver at the complexity.

I think what you could do instead, which I think would be better then, is having an argument like --package-manager-arguments="--ask".

But again, to be fair now that I can think about it, you can alias very easily in portage for the command to always have --ask included.

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

Successfully merging this pull request may close these issues.

Include a script in the Godot repository to install build dependencies for Linux/BSD
6 participants