Page 1 of 1

[Linux] Can’t compile dxx-rebirth

Posted: Wed Oct 27, 2021 12:09 pm
by ducon
Hi,
I’m on Debian Sid (x86, yes, I know) and I try to compile dxx-rebirth (dxx-rebirth_20211021).
I installed the few missing packages needed for Ubuntu but scons still complains.
Here are its famous last words:

Code: Select all

2X-Rebirth.2: CXXFLAGS: ['-g', '-O2', '-ftabstop=4', '-Wall', '-Werror=extra', '-Werror=format=2', '-Werror=missing-braces', '-Werror=missing-include-dirs', '-Werror=uninitialized', '-Werror=undef', '-Werror=pointer-arith', '-Werror=cast-qual', '-Werror=missing-declarations', '-Werror=vla', '-pthread', '-funsigned-char', '-std=gnu++17', '-Werror=unused', '-Werror=useless-cast', '-Wno-implicit-fallthrough', '-fvisibility=hidden', '-Wduplicated-branches', '-Wduplicated-cond', '-Wsuggest-attribute=noreturn', '-Wlogical-op', '-Wold-style-cast', '-Wredundant-decls']
D2X-Rebirth.2: LIBS: ['png16', 'z', 'physfs', 'SDL_image', 'SDL_mixer', 'SDL', 'm', 'GL', 'GLU']
D2X-Rebirth.2: LINKFLAGS: []
D2X-Rebirth.2: $CCACHE_PREFIX: None
D2X-Rebirth.2: $DISTCC_HOSTS: None
scons: done reading SConscript files.
scons: Building targets ...
CXX dxx . common/arch/sdl/digi_mixer_music.cpp
In file included from common/include/args.h:29,
                 from common/arch/sdl/digi_mixer_music.cpp:20:
common/include/physfsx.h: In function ‘PHYSFS_sint64 dcx::PHYSFSX_check_read(PHYSFS_File*, std::array<_Tp, _Nm>&, PHYSFS_uint32, PHYSFS_uint32)’:
common/include/physfsx.h:48:73: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:53: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                     ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:52:12: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   52 |     (void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && (DXX_ALWAYS_ERROR_FUNCTION(dxx_trap_overwrite, "read size exceeds array size"), 0))
      |            ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:92:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE’
   92 |     DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE(S, C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:48:98: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:53: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                     ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:52:12: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   52 |     (void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && (DXX_ALWAYS_ERROR_FUNCTION(dxx_trap_overwrite, "read size exceeds array size"), 0))
      |            ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:92:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE’
   92 |     DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE(S, C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:48:73: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:61: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                             ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:52:12: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   52 |     (void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && (DXX_ALWAYS_ERROR_FUNCTION(dxx_trap_overwrite, "read size exceeds array size"), 0))
      |            ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:92:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE’
   92 |     DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE(S, C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:48:98: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:61: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                             ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:52:12: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   52 |     (void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && (DXX_ALWAYS_ERROR_FUNCTION(dxx_trap_overwrite, "read size exceeds array size"), 0))
      |            ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:92:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE’
   92 |     DXX_PHYSFS_CHECK_READ_SIZE_ARRAY_SIZE(S, C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h: In function ‘PHYSFS_sint64 dcx::PHYSFSX_check_write(PHYSFS_File*, const std::array<_Tp, _Nm>&, PHYSFS_uint32, PHYSFS_uint32)’:
common/include/physfsx.h:48:73: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:53: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                     ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:59:13: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   59 |     ((void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && \
      |             ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:71:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE’
   71 |     DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE(S,C), 0))    \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:123:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_CONSTANTS’
  123 |     DXX_PHYSFS_CHECK_WRITE_CONSTANTS(S,C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:48:98: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:53: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                     ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:59:13: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   59 |     ((void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && \
      |             ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:71:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE’
   71 |     DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE(S,C), 0))    \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:123:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_CONSTANTS’
  123 |     DXX_PHYSFS_CHECK_WRITE_CONSTANTS(S,C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:48:73: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:61: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                             ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:59:13: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   59 |     ((void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && \
      |             ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:71:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE’
   71 |     DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE(S,C), 0))    \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:123:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_CONSTANTS’
  123 |     DXX_PHYSFS_CHECK_WRITE_CONSTANTS(S,C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:48:98: error: useless cast to type ‘size_t’ {aka ‘unsigned int’} [-Werror=useless-cast]
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                                                                                  ^~~~~~~~~~~~~~~~~~~~~~
./dxxsconf.h:36:61: note: in definition of macro ‘DXX_CONSTANT_TRUE’
   36 | #define DXX_CONSTANT_TRUE(E) (__builtin_constant_p((E)) && (E))
      |                                                             ^
common/include/physfsx.h:48:41: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE_CONSTANT’
   48 | #define _DXX_PHYSFS_CHECK_SIZE(S,C,v)   _DXX_PHYSFS_CHECK_SIZE_CONSTANT(static_cast<size_t>(S) * static_cast<size_t>(C), v)
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:59:13: note: in expansion of macro ‘_DXX_PHYSFS_CHECK_SIZE’
   59 |     ((void)(_DXX_PHYSFS_CHECK_SIZE(S,C,sizeof(v)) && \
      |             ^~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:71:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE’
   71 |     DXX_PHYSFS_CHECK_WRITE_SIZE_ARRAY_SIZE(S,C), 0))    \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
common/include/physfsx.h:123:5: note: in expansion of macro ‘DXX_PHYSFS_CHECK_WRITE_CONSTANTS’
  123 |     DXX_PHYSFS_CHECK_WRITE_CONSTANTS(S,C);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
scons: *** [common/arch/sdl/digi_mixer_music.o] Error 1
scons: building terminated because of errors.
Failed target count: total=1; targets with enable_build_failure_summary=1: 1
Failed node list:
	common/arch/sdl/digi_mixer_music.o
Failed command list:
 g++ -c -g -O2 -ftabstop=4 -Wall -Werror=extra -Werror=format=2 -Werror=missing-braces -Werror=missing-include-dirs -Werror=uninitialized -Werror=undef -Werror=pointer-arith -Werror=cast-qual -Werror=missing-declarations -Werror=vla -pthread -funsigned-char -std=gnu++17 -Werror=unused -Werror=useless-cast -Wno-implicit-fallthrough -fvisibility=hidden -Wduplicated-branches -Wduplicated-cond -Wsuggest-attribute=noreturn -Wlogical-op -Wold-style-cast -Wredundant-decls -Wno-sign-compare -DPHYSFS_DEPRECATED= -DNDEBUG -DRELEASE -D_REENTRANT -Icommon/include -Icommon/main -I. -I/usr/include/libpng16 -I/usr/include/SDL "common/arch/sdl/digi_mixer_music.cpp" -o "common/arch/sdl/digi_mixer_music.o"
Does someone have an idea?
Thanks…

Re: [Linux] Can’t compile dxx-rebirth

Posted: Wed Oct 27, 2021 5:58 pm
by Parabolicus
Looks like a Rebirth bug - common/include/physfsx.h has a "useless cast" yet -Werror=useless-cast is in the compiler flags. I'd report it by making an issue over here.

The fact that size_t is unsigned int is a hint that your system is 32-bit - maybe that hasn't been tested after some change.