-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[WEB] Makefile: building with RAYLIB_LIBTYPE=SHARED silently creates STATIC library #4717
Comments
Emscripten does not really support shared libs anyway. https://emscripten.org/docs/compiling/Building-Projects.html See "Faux shared libraries" on this page. I'm wondering, what exactly is your use case? |
Din't you read the whole issue @Peter0x44 ? I linked to the same page as you did, and mentioned the same information:
I explained why current behavior is not right:
Analogy: If you ask a waitress for a specific dish in a restaurant and the restaurant does not serve it at the moment, shouldn't waitress tell you about it instead of silently bringing you an entirely different dish?
I have my own Makefile building the project. It queries raylib's Makefile in order to build raylib. I tested multiple raylib's configuration and noticed that this one does not work as expected. This is not a severe issue though. |
My bad, I missed that, not sure how. I am of the opinion "don't do this" as anyone relying on this probably has some fundamental misunderstanding of linking, but on the other hand I don't think an error is necessary either. |
That's why I want to have an error in said case. |
CMake emits this warning, and then proceeds to create a static library. So I think for the best consistency, the makefile should do the same, that is emit a warning and proceed to create a static library anyway. |
To be fair I would also patch it in Cmake since this is not exactly what you want either and |
When asking Makefile to create SHARED library for WEB $ make TARGET_PLATFORM=PLATFORM_WEB RAYLIB_LIBTYPE=SHARED it would instead silently create STATIC library thus not fulfilling the request as expected This commit adds an error in this case and stops further execution. This is not consistent with Cmake, because Cmake throws the warning and does not stop, but Cmake can easily recover from this case and people probably does not even notice it. However, Makefile is something that you have to handle yourself and you have to recover from any issues so having an error and aborting with exit code 1 is more expected. Otherwise people may spend a lot of time debugging Makefile in order to understand what's even going on. Fixes: raysan5#4717
When asking Makefile to create SHARED library for WEB $ make TARGET_PLATFORM=PLATFORM_WEB RAYLIB_LIBTYPE=SHARED it would instead silently create STATIC library thus not fulfilling the request as expected This commit adds an error in this case and stops further execution. This is not consistent with Cmake, because Cmake throws the warning and does not stop, but Cmake can easily recover from this case and people probably does not even notice it. However, Makefile is something that you have to handle yourself and you have to recover from any issues so having an error and aborting with exit code 1 is more expected. Otherwise people may spend a lot of time debugging Makefile in order to understand what's even going on. Fixes: raysan5#4717
I proposed PR and went with the error: #4718 (this is only touching Makefile, not Cmake) I think it is fine for Cmake to report warning and keep execution because Cmake can recover from this. However, with Makefile you have to recover yourself so error and exit code 1 is more expected. Otherwise people may spend time debuging Makefile. With Cmake they may not even notice any problem. |
#4718) When asking Makefile to create SHARED library for WEB $ make TARGET_PLATFORM=PLATFORM_WEB RAYLIB_LIBTYPE=SHARED it would instead silently create STATIC library thus not fulfilling the request as expected This commit adds an error in this case and stops further execution. This is not consistent with Cmake, because Cmake throws the warning and does not stop, but Cmake can easily recover from this case and people probably does not even notice it. However, Makefile is something that you have to handle yourself and you have to recover from any issues so having an error and aborting with exit code 1 is more expected. Otherwise people may spend a lot of time debugging Makefile in order to understand what's even going on. Fixes: #4717
If you build raylib with src/Makefile, with PLATFORM_WEB and RAYLIB_LIBTYPE=SHARED, it will silently create STATIC library, instead of creating shared library or throwing an error.
If I understand right, shared libraries are not really a thing with Emscripten (it's just a fake static lib imitating
.so
for portability reasons): https://emscripten.org/docs/compiling/Building-Projects.html#faux-dynamic-linkingHowever, Makefile should not silently create STATIC lib when explicitly asked for SHARED.
It should EITHER: throw an error and exit OR create fake
.so
as asked.I can easily patch it and propose PR, just tell me which behavior do you want (probably error would be better).
The code that dictates current behavior is here (it ignores
$(RAYLIB_LIBTYPE)
entirely):raylib/src/Makefile
Lines 664 to 670 in d48b8af
Environment
Code Example
The text was updated successfully, but these errors were encountered: