OGRECave / ogre-next

aka ogre v2 - scene-oriented, flexible 3D C++ engine
https://ogrecave.github.io/ogre-next/api/latest
Other
1.08k stars 233 forks source link

compiling on a Raspberry Pi 5 #451

Closed arohrbacher closed 4 months ago

arohrbacher commented 4 months ago

Hi, I am attempting to compile Stuntrally3 (which depends on ogre-next) on a Raspberry Pi 5 (4 GB Ram, Raspberry Pi OS Bookworm, 4 kByte page size, Wayland) using the procedure outlined here, using the instructions in docs/Building.md, i.e. using the Python script build-sr3-Linux.py. Before running the script I successfully installed all dependencies (as explained in docs/Building.md). When running the script it clones the repositories, creates the build files and then starts to compile. However, after a while an error is thrown: ninja: build stopped: subcommand failed. Attached a file containing the output just before the error occurs - there are some errors mentioned that I don't know how to deal with: sr_compile_error.txt

I opened this issue in the Stuntrally3 repo; the maintainer suggests to report this compilation issue here as he thinks it is a low level error from OgreNext... I am not enough of a programmer to understand what the errors mean; can anybody help? Thanks!

darksylinc commented 4 months ago

Hi!

GCC is a lot less lenient than Clang in how we use ARM SIMD intrinsics.

You have two choices:

  1. Build with Clang.
  2. Disable SIMD optimizations.

Option 1: Build with Clang

Install clang and tell that to CMake, assuming you have installed Clang 17 in /usr/bin/:

    ret = os.system('cmake -D OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS=1 '+
                    '-D CMAKE_CXX_COMPILER=/usr/bin/clang++-17 -D CMAKE_C_COMPILER=/usr/bin/clang-17 '+
                    '-D OGRE_CONFIG_THREAD_PROVIDER=0 -D OGRE_CONFIG_THREADS=0 '+
                    #'-D OGRE_BUILD_COMPONENT_SCENE_FORMAT=1 '+
                    #'-D OGRE_BUILD_SAMPLES2=1 -D OGRE_BUILD_TESTS=1 '+
                    '-D OGRE_BUILD_SAMPLES2=1 -D OGRE_BUILD_TESTS=0 '+
                    '-D CMAKE_BUILD_TYPE="'+Config+'"  -G Ninja ../..')

Alternatively instead of modifying the Python script you could try using compiling everything with Clang using environment variables:

export CC=/usr/bin/clang-17
export CXX=/usr/bin/clang++-17
python build-sr3-Linux.py

If you don't know where clang is you can try:

whereis clang++
whereis clang++-17
# List installed Clang
apt list --installed | grep clang-
# List available Clang
apt list | grep clang-

Option 2: Disable SIMD optimizations

Modify the Python script to disable SIMD:

    ret = os.system('cmake -D OGRE_BUILD_COMPONENT_PLANAR_REFLECTIONS=1 '+
                    '-D OGRE_SIMD_NEON=0 '+
                    '-D OGRE_CONFIG_THREAD_PROVIDER=0 -D OGRE_CONFIG_THREADS=0 '+
                    #'-D OGRE_BUILD_COMPONENT_SCENE_FORMAT=1 '+
                    #'-D OGRE_BUILD_SAMPLES2=1 -D OGRE_BUILD_TESTS=1 '+
                    '-D OGRE_BUILD_SAMPLES2=1 -D OGRE_BUILD_TESTS=0 '+
                    '-D CMAKE_BUILD_TYPE="'+Config+'"  -G Ninja ../..')

Question for you

Btw are you compiling inside your rpi4 or cross compiling from an x86 machine? If the latter I would love to hear about your setup.

Thanks. Cheers

arohrbacher commented 4 months ago

Hi,

many thanks for the quick reply. I used your option 2, but I had to additionally pass the following to cmake for the Ogre-build to succeed: '-D OGRE_SIMD_SSE2=0 '+

However, the actual Stuntrally3 build then failed - I have go back to the Stuntrally3 maintainer for help, I guess...

As for your question: I am building directly on my Raspberry Pi 5, so no cross-compiling.

Best regards!

darksylinc commented 4 months ago

Ok I'm closing it for now then!