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

OpenBSD build is broken due to compilation errors #92130

Open
kdiduk opened this issue May 19, 2024 · 3 comments
Open

OpenBSD build is broken due to compilation errors #92130

kdiduk opened this issue May 19, 2024 · 3 comments

Comments

@kdiduk
Copy link
Contributor

kdiduk commented May 19, 2024

Tested versions

Reproducible with the 4.3 beta (commit [daa81bb]) and with the 4.3 dev 6 (commit [64520fe])

System information

OpenBSD 7.5 GENERIC amd64 (running on QEMU)

Issue description

OpenBSD build is broken.

I've tried to build it on freshly installed OpenBSD 7.5 in QEMU, and the build is broken due to compilation errors. I've found the following problems:

  1. With the default scons build command it fails because the definition of quick_exit standard function cannot be found when compiling 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), it sill 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). Note: it's linux-specific header, although it's available in FreeBSD, but not in OpenBSD.
  3. Problem with Variant class: calls to vformat with long and unsigned long parameters make compiler fail to resolve Variant class constructor, because there is no constructor with either long or unsigned long and in this environment neither of intX_t/uintX_t is typedefed with long/unsigled long.
  4. Definition of the function secure_getenv(name) can't be found in thirdparty/openxr/scr/common/platform_utils.hpp (line 98).
  5. Error: unknown type name cpu_set_t in thirtparty/embree/common/sys/sysinfo.cpp, line 672.

And most likely there are other errors.

Steps to reproduce

  1. Checkout Godot source code, master branch
  2. Install build dependencies: pkg_add python scons llvm
  3. Run scons or scons opengl3=no

Minimal reproduction project (MRP)

N/A

@AThousandShips
Copy link
Member

Just to confirm, it still happens on a recent build? That commit is 3 weeks old

@kdiduk
Copy link
Contributor Author

kdiduk commented May 20, 2024

Just to confirm, it still happens on a recent build? That commit is 3 weeks old

I've just tried to build the latest master branch and the results are the same. I have updated the ticket description.

@kdiduk
Copy link
Contributor Author

kdiduk commented May 23, 2024

Here is a brief summary on how each issue can be fixed.

  1. The first one can be fixed by using _Exit function instead of quick_exit. The only difference is that quick_exit will run functions registered with at_quick_exit, but since there are no any of them, it should be totally OK to use _Exit, given that it's the only source file where this function call is used.
  2. The header file linux/input-event-codes.h is Linux-specific, but it's also present in FreeBSD (here), which seems to be just cloned from the Linux kernel. We can either include that file in the Godot source tree, or make a small abstraction over it (actually redefine the key constant that we use for OpenBSD/NetBSD). Since it's the only place where this file used, there should be no problem with that. Another option is to install libinput as a build dependency (which is available in OpenBSD ports, e.g. see here). However, it will install this header in /usr/local/include/ and clang in OpenBSD doesn't search headers in that directory (see here).
  3. The problem with the overloaded constructors of Variant class with POD types, the issue is exactly the same as discussed in this StackOverflow question: https://stackoverflow.com/questions/10579544/ambiguous-overload-between-int32-t-or-int64-t-parameters-when-passing-long The best solution would be to use a template with integer only types (i.e. with std::enable_if and std::is_integral<T>).
  4. The issue with secure_getenv also present for FreeBSD build, see the issue FreeBSD build failure: HAVE_SECURE_GETENV erroneously set for openxr dependency #67838 One way to fix this (which is mentioned in that ticket), is to not define HAVE_SECURE_GETENV in the corresponding SCons file for BSD platforms.
  5. Still in progress 🙂 Re-using FreeBSD-specific code doesn't work: OpenBSD doesn't have sys/cpuset.h header.

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

No branches or pull requests

2 participants