-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] Add -D _POSIX_C_SOURCE=200809L to CFLAGS #254
Comments
Hi @sanderboer, this part was changed just some days ago... Are you using develop branch? Maybe @RDR8 could give us some feedback, it was reviewed in PR #248 |
Hi @raysan5 , S |
Sorry for the hiccup. Since the master branch src/Makefile is using -std=c99, -D_DEFAULT_SOURCE is the flag you want, as when compiling PLATFORM=PLATFORM_DESKTOP on Linux. Equivalent to cc -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809 We need the _BSD_SOURCE for dr_flac audio. Using -std=c99 by itself is somewhat restrictive. Refer to feature_test_macros man page We could revert to |
No idea what is actually going on here. @sanderboer is right, master is broken but the changes made to the development branch src/Makefile at 44de97e are working for me "as is" on Linux. That is, without any _SOURCE type flags. Maybe --profilng CFLAG is the diff but I don't know why the lack of it would be a problem here. Proceeding to the examples on develop branch, most of the examples compile but I'm running into the same problem with time functions in physac as before with c99 on Linux. We probably do need -D_DEFAULT_SOURCE. |
@sanderboer If that code snippet above is in your makefile, check the syntax of -D_POSIX_C_SOURCE=200809L |
That code snippet is in my makefile, I added the -D_POSIX_C_SOURCE=200809L for it to compile. |
Wait, btw. I double checked. |
Hi! Sorry for the broken master! Just integrated develop branch into master, it should be ok now, tried compiling for Windows and PLATFORM_WEB using Notepad++ script and it worked ok. |
@sanderboer I understand about the platform. I only mention Linux because I encountered a similiar issue there and made changes to the Makefiles recently. I think this is more of a c99 vs gnu99 issue, with each needing relevant CFLAGS. I'll update the Makefiles with options in the comments if @raysan5 already hasn't I ask about the snippet because it has a typo. Just "no stone unturned' etc.. (^; Do use _DEFAULT_SOURCE instead of _POSIX_C_SOURCE_200809L. According to that man page, specifying the old options alongside the new ones is only needed for old compilers that don't recognize _DEFAULT_SOURCE. |
This may help. #260 |
Reviewed in commit 82c5444 |
Hi,
I'm just starting out with raylib, the emscripten layer is what interests me.
When building raylib, make fails on an implicit function declaration. I can't seem to be able to use nanosleep() (or usleep() ) without this error popping up.
Apparently, the _POSIX_C_SOURCE macro must be defined with an appropriate value for the POSIX extensions to be available:
ifeq ($(PLATFORM),PLATFORM_WEB) CFLAGS = -D _POSIX_C_SOURCE=200809L -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources #-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing #-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) endif
The text was updated successfully, but these errors were encountered: