Teeworlds: Build fails to build on non-x86 (because of immintrin.h)

Created on 15 Dec 2018  ·  5Comments  ·  Source: teeworlds/teeworlds

../src/engine/client/client.cpp:5:10: fatal error: immintrin.h: No such file or directory
 #include <immintrin.h> //_mm_pause
          ^~~~~~~~~~~~~
bug build system

Most helpful comment

Copied from https://github.com/teeworlds/teeworlds/issues/1844#issuecomment-446756342:

Note that this will still fail to compile for architectures other than Intel (and AMD) ones. The code in question is quite unportable:

https://github.com/teeworlds/teeworlds/blob/dff453d377e56a1389ca4313767b4f05f61b7985/src/engine/client/client.cpp#L5

https://github.com/teeworlds/teeworlds/blob/dff453d377e56a1389ca4313767b4f05f61b7985/src/engine/client/client.cpp#L1779

I suggest to remove it until a portable solution is found. Teeworlds code (especially outside src/base/system.c) should not rely on such compiler- and architecture-specific functions without fallback.

To elaborate: There are CPU architectures besides Intel, and we shouldn't rely on a specific one. If we do, we should do it in src/base/system.c but not make compilation fail on unknown architectures.

All 5 comments

The fix was not ported to CMake, I believe.
On 64bit, you can simply comment out the #include <immintrin.h>.
If it doesn't work, can you try to add the compilation flag -msse2? It should fix it afaik.

1844

@Dune-jr I don't think that -msse2 will work on ppc64le or s390x or arm, because it is x86-specific.

Right.
Since you're on 64-bit, it should simply work without #include <immintrin.h>

@Dune-jr there is also 32bit arm ;)

Copied from https://github.com/teeworlds/teeworlds/issues/1844#issuecomment-446756342:

Note that this will still fail to compile for architectures other than Intel (and AMD) ones. The code in question is quite unportable:

https://github.com/teeworlds/teeworlds/blob/dff453d377e56a1389ca4313767b4f05f61b7985/src/engine/client/client.cpp#L5

https://github.com/teeworlds/teeworlds/blob/dff453d377e56a1389ca4313767b4f05f61b7985/src/engine/client/client.cpp#L1779

I suggest to remove it until a portable solution is found. Teeworlds code (especially outside src/base/system.c) should not rely on such compiler- and architecture-specific functions without fallback.

To elaborate: There are CPU architectures besides Intel, and we shouldn't rely on a specific one. If we do, we should do it in src/base/system.c but not make compilation fail on unknown architectures.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oy picture oy  ·  5Comments

fokkonaut picture fokkonaut  ·  5Comments

axblk picture axblk  ·  3Comments

Dune-jr picture Dune-jr  ·  5Comments

AmonBune picture AmonBune  ·  4Comments