raylib-go icon indicating copy to clipboard operation
raylib-go copied to clipboard

Support OpenBSD?

Open refacto opened this issue 6 years ago • 6 comments

Hi, it doesn't seem that OpenBSD is supported. (Note that in core.c, it notes that OpenBSD is supported by raylib) Running

go get -v -u github.com/gen2brain/raylib-go/raylib

on OpenBSD -current (as of today) returns:

github.com/gen2brain/raylib-go (download)
github.com/gen2brain/raylib-go/raylib
# github.com/gen2brain/raylib-go/raylib
core.c:736:1: warning: control reaches end of non-void function [-Wreturn-type]
core.c:1360:1: warning: control reaches end of non-void function [-Wreturn-type]
core.c:1917:37: error: use of undeclared identifier 'gamepadReady'
core.c:1931:9: error: use of undeclared identifier 'gamepadReady'; did you mean 'gamepadName'?
core.c:1929:17: note: 'gamepadName' declared here
core.c:1970:37: error: use of undeclared identifier 'gamepadReady'
core.c:1970:97: error: use of undeclared identifier 'gamepadAxisState'
core.c:1982:37: error: use of undeclared identifier 'gamepadReady'
core.c:1983:10: error: use of undeclared identifier 'currentGamepadState'
core.c:1983:50: error: use of undeclared identifier 'previousGamepadState'
core.c:1984:10: error: use of undeclared identifier 'currentGamepadState'
core.c:1996:37: error: use of undeclared identifier 'gamepadReady'
core.c:1997:10: error: use of undeclared identifier 'currentGamepadState'
core.c:2009:37: error: use of undeclared identifier 'gamepadReady'
core.c:2010:10: error: use of undeclared identifier 'currentGamepadState'
core.c:2010:50: error: use of undeclared identifier 'previousGamepadState'
core.c:2011:10: error: use of undeclared identifier 'currentGamepadState'
core.c:2023:37: error: use of undeclared identifier 'gamepadReady'
core.c:2024:10: error: use of undeclared identifier 'currentGamepadState'
core.c:2045:10: error: use of undeclared identifier 'currentMouseState'; did you mean 'currentKeyState'?
core.c:320:13: note: 'currentKeyState' declared here
core.c:2045:39: error: use of undeclared identifier 'previousMouseState'; did you mean 'previousKeyState'?
core.c:319:13: note: 'previousKeyState' declared here
core.c:2045:71: error: use of undeclared identifier 'currentMouseState'; did you mean 'currentKeyState'?
core.c:320:13: note: 'currentKeyState' declared here
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Is there anything I'm missing? Most of the requirements (Xlib and such) are in the base system.

Thanks for looking into this.

refacto avatar Feb 04 '19 23:02 refacto

Here's also the output of cc core.c (which resembles the above but with more info):

core.c:736:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
core.c:1360:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

core.c:1917:37: error: use of undeclared identifier 'gamepadReady'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad]) result = true;
                                    ^
core.c:1931:9: error: use of undeclared identifier 'gamepadReady'; did you mean 'gamepadName'?
    if (gamepadReady[gamepad]) gamepadName = GetGamepadName(gamepad);
        ^~~~~~~~~~~~
        gamepadName
core.c:1929:17: note: 'gamepadName' declared here
    const char *gamepadName = NULL;
                ^
core.c:1970:37: error: use of undeclared identifier 'gamepadReady'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad] && (axis < MAX_GAMEPAD_AXIS)) value = gamepadAxisState[gamepad][axis];
                                    ^
core.c:1970:97: error: use of undeclared identifier 'gamepadAxisState'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad] && (axis < MAX_GAMEPAD_AXIS)) value = gamepadAxisState[gamepad][axis];
                                                                                                ^
core.c:1982:37: error: use of undeclared identifier 'gamepadReady'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
                                    ^
core.c:1983:10: error: use of undeclared identifier 'currentGamepadState'
        (currentGamepadState[gamepad][button] != previousGamepadState[gamepad][button]) &&
         ^
core.c:1983:50: error: use of undeclared identifier 'previousGamepadState'
        (currentGamepadState[gamepad][button] != previousGamepadState[gamepad][button]) &&
                                                 ^
core.c:1984:10: error: use of undeclared identifier 'currentGamepadState'
        (currentGamepadState[gamepad][button] == 1)) pressed = true;
         ^
core.c:1996:37: error: use of undeclared identifier 'gamepadReady'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
                                    ^
core.c:1997:10: error: use of undeclared identifier 'currentGamepadState'
        (currentGamepadState[gamepad][button] == 1)) result = true;
         ^
core.c:2009:37: error: use of undeclared identifier 'gamepadReady'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
                                    ^
core.c:2010:10: error: use of undeclared identifier 'currentGamepadState'
        (currentGamepadState[gamepad][button] != previousGamepadState[gamepad][button]) &&
         ^
core.c:2010:50: error: use of undeclared identifier 'previousGamepadState'
        (currentGamepadState[gamepad][button] != previousGamepadState[gamepad][button]) &&
                                                 ^
core.c:2011:10: error: use of undeclared identifier 'currentGamepadState'
        (currentGamepadState[gamepad][button] == 0)) released = true;
         ^
core.c:2023:37: error: use of undeclared identifier 'gamepadReady'
    if ((gamepad < MAX_GAMEPADS) && gamepadReady[gamepad] && (button < MAX_GAMEPAD_BUTTONS) &&
                                    ^
core.c:2024:10: error: use of undeclared identifier 'currentGamepadState'
        (currentGamepadState[gamepad][button] == 0)) result = true;
         ^
core.c:2045:10: error: use of undeclared identifier 'currentMouseState'; did you mean 'currentKeyState'?
    if ((currentMouseState[button] != previousMouseState[button]) && (currentMouseState[button] == 1)) pressed = true;
         ^~~~~~~~~~~~~~~~~
         currentKeyState
core.c:320:13: note: 'currentKeyState' declared here
static char currentKeyState[512] = { 0 };       // Registers current frame key state
            ^
core.c:2045:39: error: use of undeclared identifier 'previousMouseState'; did you mean 'previousKeyState'?
    if ((currentMouseState[button] != previousMouseState[button]) && (currentMouseState[button] == 1)) pressed = true;
                                      ^~~~~~~~~~~~~~~~~~
                                      previousKeyState
core.c:319:13: note: 'previousKeyState' declared here
static char previousKeyState[512] = { 0 };      // Registers previous frame key state
            ^
core.c:2045:71: error: use of undeclared identifier 'currentMouseState'; did you mean 'currentKeyState'?
    if ((currentMouseState[button] != previousMouseState[button]) && (currentMouseState[button] == 1)) pressed = true;
                                                                      ^~~~~~~~~~~~~~~~~
                                                                      currentKeyState
core.c:320:13: note: 'currentKeyState' declared here
static char currentKeyState[512] = { 0 };       // Registers current frame key state
            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.

refacto avatar Feb 05 '19 09:02 refacto

Aha! Found out, that running cc -lm -DPLATFORM_DESKTOP -I/home/<name>/go/src/github.com/gen2brain/raylib-go/raylib/external/glfw/include core.c, compiles, but gives me linker errors: https://ptpb.pw/0oKf

refacto avatar Feb 05 '19 09:02 refacto

Got core.c to compile with the following: cc -lm -fPIC -shared -DPLATFORM_DESKTOP -I/home/<name>/go/src/github.com/gen2brain/raylib-go/raylib/external/glfw/include core.c, for what it's worth.

refacto avatar Feb 05 '19 09:02 refacto

@refacto what linker errors you have? maybe some missing library on linkage?

raysan5 avatar Feb 05 '19 09:02 raysan5

@raysan5 Hi, thanks for taking a look. I'm currently cooking up a cgo_openbsd.go file so I can properly make it work on OpenBSD

refacto avatar Feb 05 '19 09:02 refacto

@raysan5 Okay, got it to build! Crashes upon startup though... Here if you want to take a look: c1b6308596d3cb18dad7397fe73a5d4e4b9743e1

refacto avatar Feb 05 '19 10:02 refacto

Support is added.

gen2brain avatar Nov 26 '22 18:11 gen2brain