godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.71k stars 20.12k forks source link

Cannot build for ppc64le #56448

Closed bkeys closed 1 year ago

bkeys commented 2 years ago

Godot version

3.4

System information

Fedora, ppc64le

Issue description

I tried to build godot on this platform, and I get the following error, I can replicate this on version 3.4.2 as well:

[bkeys@great-fox godot]$ scons use_llvm=yes target=release_debug p=linuxbsd
scons: Reading SConscript files ...
Platform "linuxbsd" is still called "x11" in Godot 3.x. Building for platform "x11".
Checking for C header file mntent.h... (cached) yes
scons: done reading SConscript files.
scons: Building targets ...
[ 29%] Compiling ==> thirdparty/embree/common/sys/sysinfo.cpp
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:17:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/mmintrin.h:31:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error                                                                         \
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:22:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:31:2: error: "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:22:
In file included from /usr/lib64/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:56:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/mmintrin.h:31:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error                                                                         \
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:27:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/emmintrin.h:32:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:27:
In file included from /usr/lib64/clang/13.0.0/include/ppc_wrappers/emmintrin.h:43:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:31:2: error: "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error "Please read comment above. Use -DNO_WARN_X86_INTRINSICS to disable this error."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:32:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/pmmintrin.h:35:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this warning."
#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this warning."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:32:
In file included from /usr/lib64/clang/13.0.0/include/ppc_wrappers/pmmintrin.h:44:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/emmintrin.h:32:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:37:
In file included from /usr/lib64/clang/13.0.0/include/ppc_wrappers/tmmintrin.h:33:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/pmmintrin.h:35:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this warning."
#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this warning."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:42:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/smmintrin.h:25:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error                                                                         \
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:42:
In file included from /usr/lib64/clang/13.0.0/include/ppc_wrappers/smmintrin.h:35:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/emmintrin.h:32:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:47:
In file included from /usr/lib64/clang/13.0.0/include/wmmintrin.h:13:
/usr/lib64/clang/13.0.0/include/ppc_wrappers/emmintrin.h:32:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#error "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
 ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:47:
In file included from /usr/lib64/clang/13.0.0/include/wmmintrin.h:15:
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:37:19: error: use of undeclared identifier '__builtin_ia32_aesenc128'
  return (__m128i)__builtin_ia32_aesenc128((__v2di)__V, (__v2di)__R);
                  ^
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:57:19: error: use of undeclared identifier '__builtin_ia32_aesenclast128'
  return (__m128i)__builtin_ia32_aesenclast128((__v2di)__V, (__v2di)__R);
                  ^
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:77:19: error: use of undeclared identifier '__builtin_ia32_aesdec128'
  return (__m128i)__builtin_ia32_aesdec128((__v2di)__V, (__v2di)__R);
                  ^
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:97:19: error: use of undeclared identifier '__builtin_ia32_aesdeclast128'
  return (__m128i)__builtin_ia32_aesdeclast128((__v2di)__V, (__v2di)__R);
                  ^
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:114:19: error: use of undeclared identifier '__builtin_ia32_aesimc128'; did you mean '__builtin_asinf128'?
  return (__m128i)__builtin_ia32_aesimc128((__v2di)__V);
                  ^
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:37:19: note: '__builtin_asinf128' declared here
  return (__m128i)__builtin_ia32_aesenc128((__v2di)__V, (__v2di)__R);
                  ^
/usr/lib64/clang/13.0.0/include/__wmmintrin_aes.h:114:44: error: cannot initialize a parameter of type '__float128' with an rvalue of type '__v2di' (vector of 2 'long long' values)
  return (__m128i)__builtin_ia32_aesimc128((__v2di)__V);
                                           ^~~~~~~~~~~
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:52:
/usr/lib64/clang/13.0.0/include/clflushoptintrin.h:22:3: error: use of undeclared identifier '__builtin_ia32_clflushopt'
  __builtin_ia32_clflushopt(__m);
  ^
In file included from thirdparty/embree/common/sys/sysinfo.cpp:5:
In file included from thirdparty/embree/common/sys/intrinsics.h:15:
In file included from /usr/lib64/clang/13.0.0/include/immintrin.h:57:
/usr/lib64/clang/13.0.0/include/clwbintrin.h:33:3: error: use of undeclared identifier '__builtin_ia32_clwb'
  __builtin_ia32_clwb(__p);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
scons: *** [thirdparty/embree/common/sys/sysinfo.x11.opt.tools.64.llvm.o] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:00:10.933]

It looks like it is trying to use x86 specific instructions.

Steps to reproduce

clone the godot repo, and check into the 3.4 branch, run the following command: scons use_llvm=yes target=release_debug p=linuxbsd

Minimal reproduction project

No response

Calinou commented 2 years ago

Related to https://github.com/godotengine/godot/issues/49225 and https://github.com/godotengine/godot/issues/55192.

This happens because the version of Embree, OpenImageDenoise and WebM used in Godot are x86-only. Adding module_embree_enabled=no module_raycast_enabled=no module_webm_enabled=no to the SCons command line should make it possible to build Godot on ARM and PowerPC.

bkeys commented 2 years ago

Now the build is successful, but the linker fails with: /usr/bin/ld: drivers/libdrivers.x11.opt.tools.64.llvm.a(pngrutil.x11.opt.tools.64.llvm.o): in function `png_init_filter_functions': /home/bkeys/Devel/Software/godot/thirdparty/libpng/pngrutil.c:4304: undefined reference to `png_init_filter_functions_vsx' At which point I question if that is a ppc64le/arm specific issue

aaronfranke commented 2 years ago

@bkeys Did you try adding arch=ppc64 in the scons command?

It should auto-detect the architecture from this list but since your filename contains .64. then it looks like it's not detecting it. What is the output of import platform then platform.machine() in Python on your system?

bkeys commented 2 years ago

Yes I did a clean build and scons gave me the same linker error from before. As for python, it gave me the output of 'ppc64le'

aaronfranke commented 2 years ago

@bkeys Sorry for sending you on a wild goose chase, I've figured out the problem. It's in 3.5 but not 3.4.

bkeys commented 2 years ago

Well I have tried to build on master and I still get the error about the undefined reference to libpng, so what are the next steps for me to try to build Godot?

aaronfranke commented 2 years ago

@q66

q66 commented 2 years ago

if you want a patch for stable releases: https://github.com/void-linux/void-packages/blob/master/srcpkgs/godot/patches/ppc.patch

the current workaround for libpng issues is to build with system libpng, another workaround is to get -DPNG_POWERPC_VSX_OPT=0 into your compiler flags

actual out of box solution would be to import the vsx intrinsics sources from https://github.com/glennrp/libpng/tree/libpng16/powerpc into the bundled libpng and add them into the build

bkeys commented 2 years ago

How do I go about using the system libpng?

q66 commented 2 years ago

builtin_libpng=false?

bkeys commented 2 years ago

I get the same linker error, I even went into SConstruct and changed it, the error persists

akien-mga commented 2 years ago

You should do a clean build (or at least remove .o and .a files in drivers/png and thirdparty/libpng). Note that freetype depends on libpng so if you use system libpng, it's advised to also use system freetype (and system zlib).

bkeys commented 2 years ago

@akien-mga I removed the .a and .o files in those directories and I got the same linker error.

bkeys commented 2 years ago

I did a complete rebuild making png, zlib, and freetype all system and I got a successful build.

aaronfranke commented 2 years ago

@bkeys Is this resolved then? If so, we can close this issue.

bkeys commented 2 years ago

I tried a fresh build with the current alpha and got the following error

[100%] Linking Program bin/godot.linuxbsd.opt.tools.ppc64.llvm ...
platform/linuxbsd/libudev-so_wrap.linuxbsd.opt.tools.ppc64.llvm.o: file not recognized: file format not recognized
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)

Not sure if you wanna keep this issue open or not.

bkeys commented 1 year ago

This issue has resurfaced into the 4.0 version of Godot. Any advice on getting it built with ppc64le?

aaronfranke commented 1 year ago

@bkeys @q66 What are you using to run Godot on PowerPC? Physical hardware? VMs? If VM, what software, Qemu? What's the correct setup to get graphics support in Qemu PPC? If hardware, is it something cheap I could buy?

bkeys commented 1 year ago

@aaronfranke I am using a Talos workstation available from raptorcs. Unfortunately it is not cheap hardware at all. I have an amdgpu in here, with a mainline Fedora installation. It's nothing too special other than the fact it's ppc64le.

akien-mga commented 1 year ago

Fixed by #78325.