sphair / ClanLib

ClanLib is a cross platform C++ toolkit library.
Other
343 stars 78 forks source link

Clanlib fails to build on aarch64 #116

Open ggardet opened 3 years ago

ggardet commented 3 years ago

Clanlib 4.1.0 fails to build on aarch64. Error log:

[  183s] System/detect_cpu_ext.cpp: In function 'detect_cpu_extension':
[  183s] System/detect_cpu_ext.cpp:81:4: error: impossible constraint in 'asm'
[  183s]    81 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:86:4: error: impossible constraint in 'asm'
[  183s]    86 |    __cpuid((int*)cpuinfo, 0x80000000);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:90:4: error: impossible constraint in 'asm'
[  183s]    90 |    __cpuid((int*)cpuinfo, 0x80000001);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:95:4: error: impossible constraint in 'asm'
[  183s]    95 |    __cpuid((int*)cpuinfo, 0x80000000);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:99:4: error: impossible constraint in 'asm'
[  183s]    99 |    __cpuid((int*)cpuinfo, 0x80000001);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:104:4: error: impossible constraint in 'asm'
[  183s]   104 |    __cpuid((int*)cpuinfo, 0x80000000);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:108:4: error: impossible constraint in 'asm'
[  183s]   108 |    __cpuid((int*)cpuinfo, 0x80000001);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:113:4: error: impossible constraint in 'asm'
[  183s]   113 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:118:4: error: impossible constraint in 'asm'
[  183s]   118 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:123:4: error: impossible constraint in 'asm'
[  183s]   123 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:128:4: error: impossible constraint in 'asm'
[  183s]   128 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:134:4: error: impossible constraint in 'asm'
[  183s]   134 |    __cpuid((int*)cpuinfo, 0x80000000);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:138:4: error: impossible constraint in 'asm'
[  183s]   138 |    __cpuid((int*)cpuinfo, 0x80000001);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:143:4: error: impossible constraint in 'asm'
[  183s]   143 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:148:4: error: impossible constraint in 'asm'
[  183s]   148 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:153:4: error: impossible constraint in 'asm'
[  183s]   153 |    __cpuid((int*)cpuinfo, 0x80000000);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:157:4: error: impossible constraint in 'asm'
[  183s]   157 |    __cpuid((int*)cpuinfo, 0x80000001);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:162:4: error: impossible constraint in 'asm'
[  183s]   162 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:167:4: error: impossible constraint in 'asm'
[  183s]   167 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:172:4: error: impossible constraint in 'asm'
[  183s]   172 |    __cpuid((int*)cpuinfo, 0x1);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:177:4: error: impossible constraint in 'asm'
[  183s]   177 |    __cpuid((int*)cpuinfo, 0x80000000);
[  183s]       |    ^
[  183s] System/detect_cpu_ext.cpp:181:4: error: impossible constraint in 'asm'
[  183s]   181 |    __cpuid((int*)cpuinfo, 0x80000001);
[  183s]       |    ^
ggardet commented 3 years ago

A quick workaround is:

--- ClanLib-4.1.0/configure.ac.orig 2021-06-16 14:04:48.744184558 +0200
+++ ClanLib-4.1.0/configure.ac  2021-06-16 14:09:15.738679727 +0200
@@ -118,6 +118,10 @@ case $target in
        CXXFLAGS="$CXXFLAGS -DARM_PLATFORM"
        CFLAGS="$CXXFLAGS -DARM_PLATFORM"
        ;;
+   aarch64* )
+       CXXFLAGS="$CXXFLAGS -DARM_PLATFORM"
+       CFLAGS="$CXXFLAGS -DARM_PLATFORM"
+       ;;
 esac

 dnl Extra flags that are needed to compile (for pkg-config)
rombust commented 3 years ago

I applied this workaround. Thanks