vsg-dev / vsgXchange

Utility library for converting data+materials to/from VulkanSceneGraph
MIT License
65 stars 40 forks source link

add missing header #150

Closed nim65s closed 1 year ago

nim65s commented 1 year ago

Hi,

Trying to compile this on Archlinux, I get the following issues:

[1/3] Building CXX object src/CMakeFiles/vsgXchange.dir/openexr/openexr.cpp.o
FAILED: src/CMakeFiles/vsgXchange.dir/openexr/openexr.cpp.o 
sccache /usr/bin/g++ -DASSIMP_VERSION_MAJOR=5 -DASSIMP_VERSION_MINOR=2 -DASSIMP_VERSION_PATCH=4 -DBASISD_SUPPORT_FXT1=0 -DBASISU_NO_ITERATOR_DEBUG_LEVEL -DEXRVERSION3 -DKHRONOS_STATIC -DKTX_FEATURE_KTX1 -DKTX_FEATURE_KTX2 -DLIBKTX -DUSE_FREETYPE -DUSE_GDAL -I/home/nim/aur/vsgxchange/src/vsgXchange-1.0.3/include -I/home/nim/aur/vsgxchange/src/build-1.0.3/include -I/usr/include/freetype2 -I/home/nim/aur/vsgxchange/src/vsgXchange-1.0.3/src/ktx/libktx -isystem /usr/include/OpenEXR -isystem /usr/include/Imath -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -O2 -g -DNDEBUG -std=gnu++17 -fPIC -fdiagnostics-color=always -Wall -Wparentheses -Wno-long-long -Wno-import -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wmaybe-uninitialized -Wshadow -Wunused -Wno-misleading-indentation -Wextra -MD -MT src/CMakeFiles/vsgXchange.dir/openexr/openexr.cpp.o -MF src/CMakeFiles/vsgXchange.dir/openexr/openexr.cpp.o.d -o src/CMakeFiles/vsgXchange.dir/openexr/openexr.cpp.o -c /home/nim/aur/vsgxchange/src/vsgXchange-1.0.3/src/openexr/openexr.cpp
In file included from /usr/include/vsg/maths/vec3.h:26,
                 from /usr/include/vsg/maths/box.h:15,
                 from /usr/include/vsg/io/stream.h:18,
                 from /home/nim/aur/vsgxchange/src/vsgXchange-1.0.3/src/openexr/openexr.cpp:14:
/usr/include/vsg/maths/vec2.h:139:31: error: 'int8_t' is not a member of 'std'; did you mean 'wint_t'?
  139 |     using bvec2 = t_vec2<std::int8_t>;    // signed 8 bit integer 2D vector
      |                               ^~~~~~
      |                               wint_t
/usr/include/vsg/maths/vec2.h:139:37: error: template argument 1 is invalid
  139 |     using bvec2 = t_vec2<std::int8_t>;    // signed 8 bit integer 2D vector
      |                                     ^
/usr/include/vsg/maths/vec2.h:140:31: error: 'int16_t' is not a member of 'std'; did you mean 'int16_t'?
  140 |     using svec2 = t_vec2<std::int16_t>;   //  signed 16 bit integer 2D vector
      |                               ^~~~~~~

I guess it's because std::int8_t is declared in cstdint: https://en.cppreference.com/w/cpp/types/integer

vsg-dev commented 1 year ago

I'm using Kubuntu 22.04 & gcc 11.3 and haven't see this error. What platform and compiler version are you using?

nim65s commented 1 year ago

This is g++ (GCC) 13.1.1 20230429 on x86_64

vsg-dev commented 1 year ago

OK, that's a lot newer gcc than I'm using so I'd guess that they've changed the standard library includes to be a little more focused. I think the solution will be to modify the core VSG rather vsgXchange. Perhaps just change to int16_t rather than std::int16_t etc. would be line of least resistance,

nim65s commented 1 year ago

This single added line is enough in my case to build VSG v1.0.6 and vsgXchange v1.0.3.

But yes, if you prefer to fix the root of the issue instead of just a symptom, that's totally fine for me :)

robertosfield commented 1 year ago

Sorry for the slow return around, now back at my dev system. I 've tweaked the core VSG to address this issue, removing the unneccessary std:: prefix:

https://github.com/vsg-dev/VulkanSceneGraph/commit/b3c2939141affcae2929c2b7821925214781d6fd

Could you try this change out on your system?

robertosfield commented 1 year ago

@nim65s I'm going to close this PR as I think the changes I made to the core VSG should me it unnecessary. Please let me know if the problem persists.

nim65s commented 1 year ago

@robertosfield : I can confirm that this issue is fixed for me by removing the std namespace in vsg, and this PR can be closed :)

Thanks !