pinterf / masktools

MaskTools v2 fork
Other
48 stars 11 forks source link

Include stdint.h in functions.cpp #24

Closed jan-krieg closed 6 months ago

jan-krieg commented 6 months ago

Building on Linux (gcc 13.2.1, glibc 2.38, Linux-6.6.21-gentoo-x86_64) with the default 16bit branch, it errors out as follows:

user@hostname ~/masktools $ cmake -B build -S .                                                                      
-- The CXX compiler identification is GNU 13.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detected target processor as: x86_64
constraints/constraints.cpp;constraints/constraints.h;functions/functions.cpp;parser/parser.cpp;parser/symbol.cpp
../common/clip/clip.h;../common/utils/utils.h;avs2x/wrapper.cpp;common/base/filter.h;common/clip/inputconfig.cpp;common/clip/inputconfig.h;common/params/params.h;filters/binarize/binarize.cpp;filters/binarize/binarize.h;filters/binarize/binarize16.cpp;filters/binarize/binarize32.cpp;filters/binarize/binarize_avx2.cpp;filters/blur/mappedblur.cpp;filters/blur/mappedblur.h;filters/blur/mappedblur16.cpp;filters/blur/mappedblur32.cpp;filters/convolution/convolution.cpp;filters/convolution/convolution.h;filters/gradient/gradient.cpp;filters/gradient/gradient.h;filters/invert/invert.cpp;filters/invert/invert.h;filters/logic/logic.cpp;filters/logic/logic.h;filters/logic/logic16.cpp;filters/logic/logic16_avx2.cpp;filters/logic/logic32.cpp;filters/logic/logic32_avx.cpp;filters/logic/logic_avx2.cpp;filters/lut/functions.h;filters/lut/lut/lut.cpp;filters/lut/lut/lut.h;filters/lut/lut/lut16.cpp;filters/lut/lutf/lutf.cpp;filters/lut/lutf/lutf.h;filters/lut/luts/luts.cpp;filters/lut/luts/luts.h;filters/lut/lutspa/lutspa.h;filters/lut/lutsx/lutsx.cpp;filters/lut/lutsx/lutsx.h;filters/lut/lutxy/lutxy.cpp;filters/lut/lutxy/lutxy.h;filters/lut/lutxyz/lutxyz.cpp;filters/lut/lutxyz/lutxyz.h;filters/lut/lutxyza/lutxyza.cpp;filters/lut/lutxyza/lutxyza.h;filters/mask/edge/edgemask.cpp;filters/mask/edge/edgemask16.cpp;filters/mask/edge/edgemask16_avx2.cpp;filters/mask/edge/edgemask32.cpp;filters/mask/edge/edgemask32_avx.cpp;filters/mask/edge/edgemask_avx2.cpp;filters/mask/functions.h;filters/mask/functions16.h;filters/mask/functions16_avx2.h;filters/mask/functions32.h;filters/mask/functions32_avx.h;filters/mask/functions_avx2.h;filters/mask/hysteresis/hysteresis.cpp;filters/mask/hysteresis/hysteresis.h;filters/mask/motion/motionmask.cpp;filters/mask/motion/motionmask.h;filters/mask/motion/motionmask16.cpp;filters/mask/motion/motionmask32.cpp;filters/merge/merge.cpp;filters/merge/merge.h;filters/merge/merge16.cpp;filters/merge/merge16.h;filters/merge/merge16_avx2.cpp;filters/merge/merge32.cpp;filters/merge/merge32_avx2.cpp;filters/merge/merge_avx2.cpp;filters/morphologic/deflate/deflate.cpp;filters/morphologic/deflate/deflate.h;filters/morphologic/deflate/deflate16.cpp;filters/morphologic/deflate/deflate32.cpp;filters/morphologic/expand/expand.cpp;filters/morphologic/expand/expand.h;filters/morphologic/expand/expand16.cpp;filters/morphologic/expand/expand16_avx2.cpp;filters/morphologic/expand/expand32.cpp;filters/morphologic/functions.h;filters/morphologic/functions16.h;filters/morphologic/functions16_avx2.h;filters/morphologic/functions32.h;filters/morphologic/inflate/inflate.cpp;filters/morphologic/inflate/inflate.h;filters/morphologic/inflate/inflate16.cpp;filters/morphologic/inflate/inflate32.cpp;filters/morphologic/inpand/inpand.cpp;filters/morphologic/inpand/inpand.h;filters/morphologic/inpand/inpand16.cpp;filters/morphologic/inpand/inpand16_avx2.cpp;filters/morphologic/inpand/inpand32.cpp;filters/morphologic/morphologic.h;filters/morphologic/morphologic16.h;filters/support/adddiff/adddiff.cpp;filters/support/adddiff/adddiff.h;filters/support/adddiff16/adddiff16.cpp;filters/support/average/average.cpp;filters/support/average/average.h;filters/support/average16/average16.cpp;filters/support/clamp/clamp.cpp;filters/support/clamp/clamp.h;filters/support/clamp16/clamp16.cpp;filters/support/makediff/makediff.cpp;filters/support/makediff/makediff.h;filters/support/makediff16/makediff16.cpp;helpers/avs2x/helpers_avs2x.cpp;helpers/avs2x/helpers_avs2x.h;helpers/forms/forms.cpp;helpers/forms/forms.h;helpers/parser/spirit.cpp;helpers/parser/spirit.h
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/user/masktools/build
user@hostname ~/masktools $ cmake --build build                                                                                                                                                                                                       
[  1%] Building CXX object common/CMakeFiles/common.dir/constraints/constraints.cpp.o
[  2%] Building CXX object common/CMakeFiles/common.dir/functions/functions.cpp.o
/home/user/masktools/common/functions/functions.cpp: In function 'void Filtering::Functions::memset_plane_16(Filtering::Byte*, ptrdiff_t, int, int, Filtering::Word)':
/home/user/masktools/common/functions/functions.cpp:22:39: error: 'uint16_t' was not declared in this scope
   22 |   if ((size_t)pitch == width * sizeof(uint16_t)) {
      |                                       ^~~~~~~~
/home/user/masktools/common/functions/functions.cpp:4:1: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    3 | #include <cstring>
  +++ |+#include <cstdint>
    4 | // #include <stdint.h>
gmake[2]: *** [common/CMakeFiles/common.dir/build.make:90: common/CMakeFiles/common.dir/functions/functions.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:143: common/CMakeFiles/common.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Including stdint.h in functions.cpp allows the build process to finish successfully, generating a working libmasktools2.so (as far as I can tell, only needed mt_edge for now). Not sure whether this is the correct way to fix the issue; maybe some preprocessor logic which should automatically include stdint.h (or cstdint) does not work correctly with my system? If so, happy to provide additional info on the environment.