Skip to content

(Partially) fix compilation for OpenBSD #101588

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MBCX
Copy link
Contributor

@MBCX MBCX commented Jan 15, 2025

This (partially) fixes #92130, implementing most of the recommended fixes. This touches a lot of systems and even critical engine code variant.h which that was a best-guess fix and probably not the best solution (so any help there would be great, not al all experienced touching core engine code).

The TLDR of the fixes:

  1. Simplified the bsd detection when needed (so that we don't have to specifically check for freebsd, or openbsd, or netbsd, etc.).
  2. Disables the raycast module.
  3. Mapped quick_exit to OpenBSD's _Exit where its used, see this comment.
  4. Directly included input-event-codes.h from the Linux kernel. The rationale is that this saves us the hassle of having to figure out if the file is in the BSD variant and where (what I had to do for FreeBSD). Should be safe since the Wayland platform code is the only bit that uses it in all of Godot. Can't include GPL-v2 code.
  5. Added missing platform detection for Jolt.
  6. Prevented OpenBSD's "ambiguous error" failure in variant.h using type_traits.

Also, I could only get the export templates to compile, the compiler would crash compiling the file editor/editor_translation.cpp with a out of memory error. Not sure why.

image

@AThousandShips
Copy link
Member

I'd say any fix should really be a complete one, especially if things depend on other, potentially controversial changes, or we risk going back and forth, at minimum the remaining fixes should have their own PR before this can be merged

@MBCX
Copy link
Contributor Author

MBCX commented Jan 15, 2025

Well, if that's the case, I can easily cherry-pick the commits from those branches and integrate them into this one.

I did it this way because as I said, I had to touch third party code and critical engine code, so I thought maybe having them separated would be better overall and more focused.

@AThousandShips
Copy link
Member

Keeping them as separate commits would be great! But it's hard to review an incomplete PR

@MBCX MBCX requested review from a team as code owners January 15, 2025 17:19
@MBCX MBCX changed the title (Partial) compilation fixes for OpenBSD - P1 (Partially) fix compilation for OpenBSD Jan 15, 2025
@MBCX
Copy link
Contributor Author

MBCX commented Jan 15, 2025

OK. I have merged all of the fixes into this branch for review.

Comment on lines +88 to 90
#elif defined(__OpenBSD__)
#define JPH_PLATFORM_OPENBSD
#elif defined(__APPLE__)
Copy link
Member

@fire fire Jan 15, 2025

Choose a reason for hiding this comment

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

At some point upstream these changes to jolt.

Copy link
Contributor

Choose a reason for hiding this comment

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


- Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
- Version: 5.15
- License: GPL-2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- License: GPL-2
- License: GPL-2

We can't include GPL-2 code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the header included has the GPL-2.0-only WITH Linux-syscall-note SPDX identifier. From what I can read that notes implies that system headers can be included with no issues and arguably, since these are all constants, this is permitted anyways. I do agree though that this entry could perhaps have some more clarification added.

https://spdx.org/licenses/Linux-syscall-note.html

NOTE! This copyright does not cover user programs that use kernel services by normal system calls - this is merely considered normal use of the kernel, and does not fall under the heading of "derived work". Also note that the GPL below is copyrighted by the Free Software Foundation, but the instance of code that it refers to (the Linux kernel) is copyrighted by me and others who actually wrote it.

Also note that the only valid version of the GPL as far as the kernel is concerned is this particular version of the license (ie v2, not v2.2 or v3.x or whatever), unless explicitly otherwise stated.

Linus Torvalds

@mihe mihe mentioned this pull request Mar 21, 2025
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.

OpenBSD build is broken due to compilation errors
5 participants