OpenSubdiv icon indicating copy to clipboard operation
OpenSubdiv copied to clipboard

Error: type mismatch with clang10 and 32bit

Open sambler opened this issue 5 years ago • 4 comments
trafficstars

I am getting a build failure when using clang10 on a 32bit system. Test system is FreeBSD 12.1 i386

error: assigning to 'OpenSubdiv::v3_4_3::HbrMemStatFunction' (aka 'void (*)(unsigned int)') from incompatible type 'void (*)(unsigned long)': type mismatch at 1st parameter ('size_t' (aka 'unsigned int') vs 'unsigned long')

failed step is -

[64/313] /usr/local/bin/clang++10  -DGLFW_VERSION_3 -DOPENSUBDIV_HAS_GLSL_COMPUTE -DOPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK -DOPENSUBDIV_HAS_OPENGL -DOPENSUBDIV_HAS_PTEX -DOPENSUBDIV_HAS_TBB -DOPENSUBDIV_VERSION_STRING=\"3.4.3\" -DOSD_USES_INTERNAL_GLAPILOADER -DPTEX_STATIC -I/wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -Wall -Wextra -Wno-invalid-offsetof -Wno-strict-aliasing -Wno-overloaded-virtual -MD -MT regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o -MF regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o.d -o regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o -c /wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3/regression/far_regression/far_regression.cpp
FAILED: regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o 
/usr/local/bin/clang++10  -DGLFW_VERSION_3 -DOPENSUBDIV_HAS_GLSL_COMPUTE -DOPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK -DOPENSUBDIV_HAS_OPENGL -DOPENSUBDIV_HAS_PTEX -DOPENSUBDIV_HAS_TBB -DOPENSUBDIV_VERSION_STRING=\"3.4.3\" -DOSD_USES_INTERNAL_GLAPILOADER -DPTEX_STATIC -I/wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing  -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -Wall -Wextra -Wno-invalid-offsetof -Wno-strict-aliasing -Wno-overloaded-virtual -MD -MT regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o -MF regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o.d -o regression/far_regression/CMakeFiles/far_regression.dir/far_regression.cpp.o -c /wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3/regression/far_regression/far_regression.cpp
In file included from /wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3/regression/far_regression/far_regression.cpp:29:
In file included from /wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3/regression/far_regression/../../regression/common/hbr_utils.h:34:
/wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3/opensubdiv/hbr/../hbr/mesh.h:223:31: error: assigning to 'OpenSubdiv::v3_4_3::HbrMemStatFunction' (aka 'void (*)(unsigned int)') from incompatible type 'void (*)(unsigned long)': type mismatch at 1st parameter ('size_t' (aka 'unsigned int') vs 'unsigned long')
        s_memStatsIncrement = increment;
                              ^~~~~~~~~
/wrkdirs/usr/ports/graphics/opensubdiv/work/OpenSubdiv-3_4_3/opensubdiv/hbr/../hbr/mesh.h:224:31: error: assigning to 'OpenSubdiv::v3_4_3::HbrMemStatFunction' (aka 'void (*)(unsigned int)') from incompatible type 'void (*)(unsigned long)': type mismatch at 1st parameter ('size_t' (aka 'unsigned int') vs 'unsigned long')
        s_memStatsDecrement = decrement;

Full buid log is available here

sambler avatar Jun 20 '20 06:06 sambler

Thanks for pointing this out. I'm surprised other compilers are not generating similar errors/warnings on 32-bit systems.

These errors are coming from the Hbr branch of the library, which is not actively used in any of the core functionality (and has been discouraged since 3.0). It is still used in some old regression tests and tutorials, so you should be able to avoid these problems by building with -DNO_REGRESSION and -DNO_TUTORIALS.

If you do eventually make use of Hbr in your use of OpenSubdiv, though, you will run into this. Hbr can also generate a lot of warnings with newer, more stringent compilers. It's unclear how much future effort we'll put into dealing with issues coming from Hbr.

barfowl avatar Jun 29 '20 23:06 barfowl

Yes, only the regression, example and tutorials are failing.

More specifically, failing code using hbr can be found in :- examples/farViewer tutorials/hbr regression/hbr_regression regression/far_regression regression/osd_regression

sambler avatar Jun 30 '20 07:06 sambler

Filed as internal issue #OSD-327.

jtran56 avatar Jul 02 '20 20:07 jtran56

--- opensubdiv/hbr/mesh.h.orig
+++ opensubdiv/hbr/mesh.h
@@ -215,7 +215,7 @@ template <class T> class HbrMesh { (public)
     void SetFVarPropagateCorners(bool p) { fvarpropagatecorners = p; }

     // Register routines for keeping track of memory usage
-    void RegisterMemoryRoutines(void (*increment)(unsigned long bytes), void (*decrement)(unsigned long bytes)) {
+    void RegisterMemoryRoutines(void (*increment)(size_t bytes), void (*decrement)(size_t bytes)) {
         m_faceAllocator.SetMemStatsIncrement(increment);
         m_faceAllocator.SetMemStatsDecrement(decrement);
         m_vertexAllocator.SetMemStatsIncrement(increment);

VVD avatar Jun 02 '24 16:06 VVD