Compiling raylib with tcc (Tiny C Compiler), emmintrin.h not found #2994
Replies: 2 comments 7 replies
-
The correct solution to this is not to copy a header for the intrinsics (that doesn't make them work), but instead to define MSF_GIF_NO_SSE2. Maybe there are further problems - I think TCC hasn't been tested in a while. |
Beta Was this translation helpful? Give feedback.
-
I don't believe this is a problem with MinGW or with TCC's distribution specific to Windows,
I believe this might be an issue with raylib/src/external/stb_image_resize2.h Lines 392 to 396 in 0275d13 This header is in fact not portable and it holds compiler specific code. Not sure if anything can be done on TCC side here, maybe it can emulate this functionality. I'll try to mess with this a bit and forward this issue to either STB repo or TCC-devel mailing list. In the meantime, the quick'n'dirty workaround is checking for TCC with diff --git a/src/external/stb_image_resize2.h b/src/external/stb_image_resize2.h
index 2f26274..6a3ebc5 100644
--- a/src/external/stb_image_resize2.h
+++ b/src/external/stb_image_resize2.h
@@ -390,6 +390,8 @@ typedef uint64_t stbir_uint64;
#endif
#endif
+#ifndef __TINYC__
+
#if defined(_x86_64) || defined( __x86_64__ ) || defined( _M_X64 ) || defined(__x86_64) || defined(_M_AMD64) || defined(__SSE2__) || defined(STBIR_SSE) || defined(STBIR_SSE2)
#ifndef STBIR_SSE2
#define STBIR_SSE2
@@ -438,6 +440,8 @@ typedef uint64_t stbir_uint64;
#endif
#endif
+#endif // __TINYC__
+
#ifndef STBIRDEF
#ifdef STB_IMAGE_RESIZE_STATIC
#define STBIRDEF static Not sure if it works though. It compiles Raylib just fine but it may cause some linking errors when building the game or some issues with the library itself. A similar issue from different project - linux-test-project/ltp#980 - they solved it with checking for |
Beta Was this translation helpful? Give feedback.
-
PROBLEM:
I am attempting to compile raylib using tcc but I'm encountering the following error:
D:/raylib-4.5.0/src/external/msf_gif.h:249: error: include file 'emmintrin.h' not found
ATTEMPTED SOLUTION:
I copied 'emmintrin.h' from my MinGW64 installation to tcc's include directory. This caused another 'not found' file error for 'xmmintrin.h'. After copying xmmintrin.h in to tcc's include folder, I had the same error with the file 'mmintrin.h'. Now all 3 files have been copied in, I receive this error: 'tcc/include/mmintrin.h:66: error: implicit declaration of function '__builtin_ia32_emms''.
POTENTIAL ISSUES:
Once I get raylib compiled with tcc, what known issues are there? I have read that there may be audio problems.
MY SETUP:
tcc version: 0.9.27
OS: Windows 11 x64
CONCLUSION:
Since MinGW's headers are not right for this solution and if there are audio problems like I have read about online. What about compiling a dll shared library using MinGW gcc and importing the dll in to a tcc def file using the compiler flag -impdef?
Beta Was this translation helpful? Give feedback.
All reactions