AcademySoftwareFoundation / OpenShadingLanguage

Advanced shading language for production GI renderers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

32bit x86 arch compiling ends with type error

ghibo opened this issue · comments

While compiling OSL 1.13.8.0 on a 32bit x86 architecture, the compilation ends up with error about a size_t not being able to be overloaded with a uint32_t, e.g:

src/include/OSL/llvm_util.h:706:21: error: 'llvm::Constant* OSL_v1_13::pvt::LLVM_Util::constant(size_t)' cannot be overloaded with 'llvm::Constant* OSL_v1_13::pvt::LLVM_Util::constant(uint32_t)'

e.g. of the whole offending command:

/usr/bin/g++ -DOIIO_DISABLE_DEPRECATED=1 -DOIIO_HIDE_FORMAT=1 -DOSL_FAST_MATH=1 -DOSL_INTERNAL=1 -DOSL_LLVM_FULL_VERSION=\"17.0.6\" -DOSL_LLVM_NEW_PASS_MANAGER -DOSL_LLVM_OPAQUE_POINTERS -DOSL_LLVM_VERSION=170 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -Doslquery_EXPORTS -Dosoparse=OSL_v1_13_osoparse -I/disk/devel/OpenShadingLanguage-1.13.8.0/build/include -I/disk/devel/OpenShadingLanguage-1.13.8.0/build/src/include -I/disk/devel/OpenShadingLanguage-1.13.8.0/src/include -I/disk/devel/OpenShadingLanguage-1.13.8.0/ext/dist/include -I/disk/devel/OpenShadingLanguage-1.13.8.0/src/liboslquery -I/disk/devel/OpenShadingLanguage-1.13.8.0/src/liboslquery/../liboslexec -isystem /usr/include/opencv4 -isystem /usr/include/Imath -O2 -g -pipe -Wformat -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fomit-frame-pointer -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -std=c++17 -fPIC -fvisibility=hidden -Wall -Wno-error=strict-overflow -Wno-unused-local-typedefs -Wno-unused-result -Wno-error=misleading-indentation -fno-math-errno -MD -MT src/liboslquery/CMakeFiles/oslquery.dir/__/liboslexec/typespec.cpp.o -MF src/liboslquery/CMakeFiles/oslquery.dir/__/liboslexec/typespec.cpp.o.d -o src/liboslquery/CMakeFiles/oslquery.dir/__/liboslexec/typespec.cpp.o -c /disk/devel/OpenShadingLanguage-1.13.8.0/src/liboslexec/typespec.cpp
In file included from /disk/devel/OpenShadingLanguage-1.13.8.0/src/liboslexec/oslexec_pvt.h:40,
                 from /disk/devel/OpenShadingLanguage-1.13.8.0/src/liboslexec/typespec.cpp:13:
/disk/devel/OpenShadingLanguage-1.13.8.0/src/include/OSL/llvm_util.h:706:21: error: 'llvm::Constant* OSL_v1_13::pvt::LLVM_Util::constant(size_t)' cannot be overloaded with 'llvm::Constant* OSL_v1_13::pvt::LLVM_Util::constant(uint32_t)'
  706 |     llvm::Constant* constant(size_t i);
      |                     ^~~~~~~~
/disk/devel/OpenShadingLanguage-1.13.8.0/src/include/OSL/llvm_util.h:691:21: note: previous declaration 'llvm::Constant* OSL_v1_13::pvt::LLVM_Util::constant(uint32_t)'
  691 |     llvm::Constant* constant(uint32_t i);
      |                     ^~~~~~~~
In file included from /disk/devel/OpenShadingLanguage-1.13.8.0/src/include/OSL/rendererservices.h:8,
                 from /disk/devel/OpenShadingLanguage-1.13.8.0/src/liboslexec/oslexec_pvt.h:44:
/disk/devel/OpenShadingLanguage-1.13.8.0/src/include/OSL/encodedtypes.h:61:47: error: static assertion failed: unexpected
   61 |     static_assert(size_of_encoded_type(value) == sizeof(DataType),
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/disk/devel/OpenShadingLanguage-1.13.8.0/src/include/OSL/encodedtypes.h:61:47: note: the comparison reduces to '(8 == 4)'
/disk/devel/OpenShadingLanguage-1.13.8.0/src/include/OSL/encodedtypes.h:69:47: error: static assertion failed: unexpected
   69 |     static_assert(size_of_encoded_type(value) == sizeof(DataType),
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
  • OSL branch/version: 1.13.8.0
  • OS: Mageia Linux (cauldron or 9)
  • C++ compiler: gcc 14 (snapshot 2024-03-17) or gcc-12.3.0
  • LLVM version: 17.0.6 or 15.0.6
  • OIIO version: 2.5.9.0 or 2.4.10.0

I don't believe OSL has tried to support 32 bit architectures for some time now.

That said, if you want to make a PR that would make it build cleanly for 32 bit -- and it doesn't disadvantage 64 bit performance or make code too cluttered -- we would be happy to accept and merge it.

OK, thanks for your answer. Just to know it's not officially supported anymore. Maybe a note in the README or a test in the code, just to inform it's not supported anymore could help. I thought the 1.13 branch was still supporting 32bit arch (as 1.11.x was still compiling on it). I tried a quick fix forcing a casting, but things are much more complicated than that.

I'll make it more clear in the docs.

I don't remember at what point exactly we stopped supporting 32 bit builds, but I know we've discussed it in several PRs over the last few years ("does this patch work on 32 bits?" "Do we even claim to support 32 bits?" "No, we already decided that" conversation has already happened a few times, by my recollection).

Closing since our current development no longer officially supports 32 bit platforms.