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

Linux and GLFW fixes #5

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

Conversation

elmindreda
Copy link

@elmindreda elmindreda commented Dec 20, 2016

This has four parts:

  • Fix basic compilation on Linux
  • Disable the GLFW tests, examples and documentation targets that clutter up the build
  • Update GLFW sources to the latest stable release (3.2.1) and depend on its CMake library target
  • Move to GLFW timer as time source (from GetTickCount64 on Windows and zero (0) on Linux)

The changes have been tested on Linux (GCC) and Windows (VS2015).

@superphunthyme
Copy link

Thanks for the fix!

@aloiscochard
Copy link

Would be good to merge this at some point... I just repeated all those fixes in my local clone :-(

@nikolas
Copy link

nikolas commented Sep 1, 2018

This branch fixes the build process for me on Debian testing/buster, gcc 8.2.0. @johnkslang @grahamsellers, can you take a look and merge this?

@johnkslang
Copy link
Contributor

It seems most of the changes are to port from C++ to C?

@sethk
Copy link

sethk commented Sep 30, 2018

It seems most of the changes are to port from C++ to C?

Well, since that source file is 99% C, and it uses goto for error cleanup instead of RAII, it would make sense to compile it as C.

@elmindreda elmindreda mentioned this pull request Oct 27, 2018
@mapulse
Copy link

mapulse commented Jun 17, 2019

I have some problem with 12 particle sim. how to compile it? It is buggy. look at 113 . It is a macro but not closed the paren. and inclusive function not closed.
and compile error :
~/.../examples/src/12-particlesimulator/12-particlesimulator.cpp:114:13: error: ‘std140’ was not declared in this scope
layout (std140, binding = 0) uniform attractor_block
^~~~~~

@xfry
Copy link

xfry commented Aug 9, 2019

Hi @elmindreda I'm having alike issue but I receive this messaje when I execute the next step by steps:

Clone the repository
Then I move to the build directory: cd build
As you suggest I run cmake with test disabled: cmake -DGLFW_BUILD_TESTS=OFF .
it works without erros.
Then I run make and here is when troubles come, the make process compiles glfw very well

[ 10%] Building C object lib/glfw/src/CMakeFiles/glfw.dir/posix_time.c.o
[ 11%] Building C object lib/glfw/src/CMakeFiles/glfw.dir/posix_tls.c.o
[ 12%] Building C object lib/glfw/src/CMakeFiles/glfw.dir/glx_context.c.o
[ 13%] Linking C static library ../../libglfw3.a
[ 13%] Built target glfw

But it fails when start to run vermilion, and this is the error message:

[ 17%] Building CXX object CMakeFiles/vermilion.dir/lib/vdds.cpp.o
lib/vdds.cpp: In function ‘void vglLoadDDS(const char*, vglImageData*)’:
lib/vdds.cpp:645:1: error: jump to label ‘done_close_file’ [-fpermissive]
 done_close_file:

Can you help me with some guidance on how to solve vermilion make error?

@elmindreda
Copy link
Author

@xfry Try adding the -fpermissive flag.

cmake -DCMAKE_C_FLAGS=-fpermissive -DGLFW_BUILD_TESTS=OFF .

robotchaoX added a commit to robotchaoX/examples that referenced this pull request Mar 29, 2022
On Linux, <sys/time.h> must be included to make struct timeval known.
string.h must be included to use memset().
A jump to a label (done_close_file) must not cross local declarations. The corresponding code has been encapsulated in a block.
The use of the STRINGIZE macro leads to an error where the compiler sees the #version 430 sequence as an invalid preprocessor directive.
Move add_subdirectory(lib/glfw) before examples compile in CmakeList.txt to avoid build dependence error.
Reference:
	jhannemann openglredbook#3
	elmindreda openglredbook#5
robotchaoX added a commit to robotchaoX/examples that referenced this pull request Mar 29, 2022
On Linux, <sys/time.h> must be included to make struct timeval known.
string.h must be included to use memset().
A jump to a label (done_close_file) must not cross local declarations. The corresponding code has been encapsulated in a block.
The use of the STRINGIZE macro leads to an error where the compiler sees the #version 430 sequence as an invalid preprocessor directive.
Move add_subdirectory(lib/glfw) before examples compile in CmakeList.txt to avoid build dependence error.
Reference:
	jhannemann openglredbook#3
	elmindreda openglredbook#5
robotchaoX added a commit to robotchaoX/examples that referenced this pull request Mar 29, 2022
On Linux, <sys/time.h> must be included to make struct timeval known.
string.h must be included to use memset().
A jump to a label (done_close_file) must not cross local declarations. The corresponding code has been encapsulated in a block.
The use of the STRINGIZE macro leads to an error where the compiler sees the #version 430 sequence as an invalid preprocessor directive.
Move add_subdirectory(lib/glfw) before examples compile in CmakeList.txt to avoid build dependence error.
Reference:
	jhannemann openglredbook#3
	elmindreda openglredbook#5
@ghost
Copy link

ghost commented Jul 9, 2023

I had compilation errors about done_close_file using the books official code on Ubuntu 22.04 lts. This fork fixed it for me. Thank you for your work elminreda <3

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

Successfully merging this pull request may close these issues.

8 participants