Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: type mismatch with clang10 and 32bit #1198

Open
sambler opened this issue Jun 20, 2020 · 4 comments
Open

Error: type mismatch with clang10 and 32bit #1198

sambler opened this issue Jun 20, 2020 · 4 comments

Comments

@sambler
Copy link

sambler commented Jun 20, 2020

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

@barfowl
Copy link
Collaborator

barfowl commented Jun 29, 2020

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.

@sambler
Copy link
Author

sambler commented Jun 30, 2020

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

@jtran56
Copy link

jtran56 commented Jul 2, 2020

Filed as internal issue #OSD-327.

@VVD
Copy link

VVD commented Jun 2, 2024

--- 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);

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jun 3, 2024
…32bit

- Remove unnecessary libs from USE_GL and add required.
- Fix build on 32bit ARCHS, upstream issue:
PixarAnimationStudios/OpenSubdiv#1198 (comment)
- Make options OPENMP (for supported ARCHS) and PTEX default.
- EXAMPLES and OPENCL can build together without errors.
- Remove NO_GL_TESTS - upstream removed it.
- Sort options and pet portclippy.

PR:		279472
Approved by:	Shane <[email protected]> (maintainer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants