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

Build issues on Linux #28

Open
TSnake41 opened this issue Sep 12, 2020 · 3 comments
Open

Build issues on Linux #28

TSnake41 opened this issue Sep 12, 2020 · 3 comments

Comments

@TSnake41
Copy link

TSnake41 commented Sep 12, 2020

First, rayfork refuses to compile with sokol because glad is imported after sokol, which includes it's own GL, which makes glad refusing to compile, as OpenGL is already imported.
To fix it, you need to include glad before sokol in `https://github.com/SasLuca/rayfork/blob/rayfork-0.9/tests/platform-independent-tests/platform-layers/sokol/sokol-main.c#L8

Another issue is missing symbols (as required by e.g sokol).

  • math stuff is missing (you mostly want it, doesn't affect musl targets) : libm needs to be imported target_link_libraries(m), this affect directly rayfork.h
  • Xorg stuff (only with X11 target) : target_link_libraries(X11 Xi Xcursor)
  • dlopen/dlclose/... : target_link_libraries(dl)
  • pthread (or crash at launch) : target_link_libraries(pthread)
    All of them gives target_link_libraries(m dl pthread X11 Xi Xcursor)
@SasLuca
Copy link
Owner

SasLuca commented Sep 13, 2020

Hi,
I have indeed not test rayfork on linux yet, as it's still in development and I am not a linux user primarily.

Xorg, dl, pthread are all probably required because of sokol. libc's math is indeed required by rayfork, not sure if there would be a better way to handle math functions (maybe we could include a built-in set of math functions that don't rely on libc).

Thanks for the help though, I will add those libraries to the sokol template on linux.

@truedat101
Copy link

I'll try testing this on Linux later on. BTW probably in 2024 some people are looking for Wayland and not X11 since "this is the way".

@truedat101
Copy link

My quick look at this, gcc is incredibly picky

[  4%] Building C object CMakeFiles/rayfork-dev.dir/source/rayfork.c.o
In file included from /fubar/rayfork/source/gfx/rayfork-gfx.h:5,
                 from /fubar/rayfork/source/rayfork.h:11,
                 from /fubar/rayfork/source/rayfork.c:1:
/fubar/rayfork/source/gfx/rayfork-camera.h:7:1: error: expected identifier or ‘(’ before ‘typedef’
    7 | typedef enum rf_camera_type
      | ^~~~~~~
/fubar/rayfork/source/gfx/rayfork-camera.h:11:3: warning: data definition has no type or storage class
   11 | } rf_camera_type;
      |   ^~~~~~~~~~~~~~
/fubar/rayfork/source/gfx/rayfork-camera.h:11:3: warning: type defaults to ‘int’ in declaration of ‘rf_camera_type’ [-Wimplicit-int]
/fubar/rayfork/source/gfx/rayfork-camera.h:23:5: error: expected specifier-qualifier-list before ‘rf_camera_type’
   23 |     rf_camera_type type;     // Camera type, defines projection types: RF_CAMERA_PERSPECTIVE or RF_CAMERA_ORTHOGRAPHIC

There are about 50 of these before it stops compilation. I haven't done the dive into the specifics. Will investigate. I would really want this able to build on an RPi4-5 eventually.

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

No branches or pull requests

3 participants