Skip to content
New issue

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

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

Already on GitHub? # to your account

OS.has_feature("linux") returns false on linux #76990

Closed
bend-n opened this issue May 12, 2023 · 13 comments · Fixed by #76974
Closed

OS.has_feature("linux") returns false on linux #76990

bend-n opened this issue May 12, 2023 · 13 comments · Fixed by #76974

Comments

@bend-n
Copy link
Contributor

bend-n commented May 12, 2023

Godot version

c80a2b4

System information

ArchLinux x11

Issue description

OS.has_feature("linux")

returns false.
This is a problem because:

  • its a regression
  • documentation tells you it works
  • it works on other platforms
  • it breaks gdextension, where you specify libs with feature tags: linux.release.x86_64 = "res://lib.so"

Regression introduced somewhere between bd1bc68..6980b2b
Causes gdext#270

@bruvzg
Copy link
Member

bruvzg commented May 12, 2023

In 4.x it's linuxbsd not linux.

@bend-n
Copy link
Contributor Author

bend-n commented May 12, 2023

Thats not what the docs say:
image

@bend-n
Copy link
Contributor Author

bend-n commented May 12, 2023

Also, this hasnt been the behaviour of 4.x until recently, when did it change?

@bruvzg
Copy link
Member

bruvzg commented May 12, 2023

Also, this hasnt been the behaviour of 4.x until recently, when did it change?

Seems like you are right, it is a recent and probably unintentional breaking change from #76540.

linuxbsd was always a valid option for 4.0, but it was accepting OS name as well.

@bend-n
Copy link
Contributor Author

bend-n commented May 12, 2023

Seems to be fixed by #76974

@bend-n bend-n changed the title OS.has_feature("linux") returns false on linux (regression) OS.has_feature("linux") returns false on linux May 12, 2023
@aaronfranke
Copy link
Member

To be clear, Linux and BSD libraries/executables/etc are not automatically compatible. They are just similar platforms so they can be compiled from mostly the same codebase (thus the name LinuxBSD). It is necessary for OS.has_feature() to support distinguishing between Linux and BSD (and probably also between the different BSDs). So the behavior that #76974 is restoring is necessary to support this.

@dalexeev
Copy link
Member

Does this mean we should also add freebsd, netbsd, openbsd, and bsd feature tags (or at least just bsd)?

@aaronfranke
Copy link
Member

@dalexeev
Copy link
Member

I mean

this list

@akien-mga
Copy link
Member

akien-mga commented May 12, 2023

I don't think we need to, BSD platforms are second class citizens as we don't provide official export templates for them. Users who compile their own export templates for one or more BSD platform can add the relevant feature tags manually which should Just Work™. If they're not aware that the various *bsd feature tags exist and work, they can also add custom ones in their export presets for those platforms.

@dalexeev
Copy link
Member

Okay, although I would add linuxbsd and bsd to the list (without the *bsd sub-options). But bsd must include all BSDs, not just others than the 3 main ones.

I think it makes sense to refresh the page because it doesn't mention *bsd sub-options.

By the way, the list of platforms is using the wrong name, I guess it should be Linux/BSD.

@akien-mga
Copy link
Member

Okay, although I would add linuxbsd and bsd to the list (without the *bsd sub-options). But bsd must include all BSDs, not just others than the 3 main ones.

That's right, I thought that's what it did, but after #76974 it's not the case. Should be extended further to also accept the bsd feature tag for FreeBSD, OpenBSD and NetBSD.

By the way, the list of platforms is using the wrong name, I guess it should be Linux/BSD.

It's tricky because technically the export templates it will use by default are for Linux (X11, but hopefully soon Wayland too so indeed the /X11 part could be removed). But indeed if you want to target say FreeBSD, you'd likely start by adding a "Linux/X11" preset and then customize it to use custom export templates.

@dalexeev
Copy link
Member

dalexeev commented May 12, 2023

Should be extended further to also accept the bsd feature tag for FreeBSD, OpenBSD and NetBSD.

I think the solution is to add the following code to OS_LinuxBSD::_check_internal_feature_support():

#ifndef __linux__
    if (p_feature == "bsd") {
        return true;
    }
#endif

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

Successfully merging a pull request may close this issue.

7 participants