Blender fails to build for 32bit archs (with sufficient strict compiler flags)


just an FYI, building 3.0 (and later versions, I guess) on 32bit archs fails with:

[  884s] /home/abuild/rpmbuild/BUILD/blender-3.0.0/source/blender/blenlib/intern/string_cursor_utf8.c: In function 'BLI_str_cursor_step_utf8':
[  884s] /home/abuild/rpmbuild/BUILD/blender-3.0.0/source/blender/blenlib/intern/string_cursor_utf8.c:202:66: error: conversion to 'int' from 'unsigned int' may change the sign of the result [-Werror=sign-conversion]
[  884s]   202 |               (delim_type != cursor_delim_type_utf8(str, maxlen, (size_t)*pos))) {
[  884s]       |                                                                  ^~~~~~~~~~~~
[  884s] cc1: some warnings being treated as errors
[  884s] make[2]: *** [source/blender/blenlib/CMakeFiles/bf_blenlib.dir/build.make:1339: source/blender/blenlib/CMakeFiles/bf_blenlib.dir/intern/string_cursor_utf8.c.o] Error 1
[  884s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/blender-3.0.0/build'

I know, using Blender as 32bit build somewhat contradicts its purpose, and currently dependent packages like OpenShadingLanguage does fail as well:

[  121s] /home/abuild/rpmbuild/BUILD/OpenShadingLanguage- In member function 'virtual int OSL_v1_11::RendererServices::pointcloud_search(OSL_v1_11::ShaderGlobals*, OpenImageIO_v2_2::ustring, const Vec3&, float, int, bool, size_t*, float*, int)':
[  121s] /home/abuild/rpmbuild/BUILD/OpenShadingLanguage- error: static assertion failed: Partio ParticleIndex should be the size of a size_t
[  121s]   247 |     static_assert (sizeof(size_t) == sizeof(Partio::ParticleIndex),
[  121s]       |                    ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  121s] /home/abuild/rpmbuild/BUILD/OpenShadingLanguage- In member function 'virtual int OSL_v1_11::RendererServices::pointcloud_get(OSL_v1_11::ShaderGlobals*, OpenImageIO_v2_2::ustring, size_t*, int, OpenImageIO_v2_2::ustring, OpenImageIO_v2_2::TypeDesc, void*)':
[  121s] /home/abuild/rpmbuild/BUILD/OpenShadingLanguage- error: static assertion failed: Partio ParticleIndex should be the size of a size_t
[  121s]   365 |     static_assert (sizeof(size_t) == sizeof(Partio::ParticleIndex),
[  121s]       |                    ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  121s] make[2]: *** [src/liboslexec/CMakeFiles/oslexec.dir/build.make:380: src/liboslexec/CMakeFiles/oslexec.dir/pointcloud.cpp.o] Error 1

Therefor, it’s probably time to give up on it (finally…).

32 bit is not supported anymore for 3.0.

Fixed in rB978a930d9cf6.

@Baardaap while we do not ship/test/CI on 32 bit anymore ever since 2.8, if there’s small changes we can do to the code to make the life of downstream users easier we do generally help out. Same goes for accepting small patches for such architectures.


Thanks, @LazyDodo, nice fix!

Woops, sorry.

I thought I had read someone on the chat who said he couldn’t get it to build for 32bit at all. Should have been a bit less sure :wink:

Kinda depends on the situation, someone going “i can’t get it to build on unsupported arch X”, yeah… likely on their own, someone going “hey distro X, arch Y needs this small set of changes” regardless if it’s a patch ( like D12194 ) of just pointing out a troublesome cast like @frispete did, happy to lend a helping hand.