zenorogue / hyperrogue

A SDL roguelike in a non-euclidean world
GNU General Public License v2.0
569 stars 72 forks source link

12.0f fails to build on musl #285

Closed sdsddsd1 closed 3 years ago

sdsddsd1 commented 3 years ago

Hello, the 12.0f release fails to build on my musl box with the following:

Clang 12.0.1

clang++ -O0 -std=c++11 -DLINUX -march=native -fPIC -W -Wall -Wextra -Wsuggest-override -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option -Wno-invalid-offsetof -DCAP_GLEW=1 -DCAP_PNG=1  -DFHS -I/usr/include/SDL -DHYPERPATH='"/usr/share/hyperrogue/"' -DRESOURCEDESTDIR='"/usr/share/hyperrogue/"'  langen.cpp    -o langen
clang++ -O2 makeh.cpp -o makeh
clang++ -O2 -std=c++11 -DLINUX -march=native -fPIC -W -Wall -Wextra -Wsuggest-override -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option -Wno-invalid-offsetof -DCAP_GLEW=1 -DCAP_PNG=1  -DFHS -I/usr/include/SDL -DHYPERPATH='"/usr/share/hyperrogue/"' -DRESOURCEDESTDIR='"/usr/share/hyperrogue/"' -c savepng.cpp -o savepng.o
./langen > language-data.cpp
./makeh classes.cpp locations.cpp colors.cpp hyperpoint.cpp geometry.cpp goldberg.cpp init.cpp floorshapes.cpp cell.cpp multi.cpp shmup.cpp pattern2.cpp mapeditor.cpp graph.cpp textures.cpp hprint.cpp language.cpp util.cpp complex.cpp *.cpp > autohdr.h
clang++ -O2 -std=c++11 -DLINUX -march=native -fPIC -W -Wall -Wextra -Wsuggest-override -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -Wno-unknown-warning-option -Wno-invalid-offsetof -DCAP_GLEW=1 -DCAP_PNG=1  -DFHS -I/usr/include/SDL -DHYPERPATH='"/usr/share/hyperrogue/"' -DRESOURCEDESTDIR='"/usr/share/hyperrogue/"'  -c hyper.cpp -o hyper.o
In file included from hyper.cpp:45:
./fake.cpp:86:24: error: 'get_corner' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    virtual hyperpoint get_corner(cell *c, int cid, ld cf=3) { 
                       ^
cell.cpp:61:22: note: overridden virtual function is here
  virtual hyperpoint get_corner(cell *c, int cid, ld cf=3) { return C0; }
                     ^
1 error generated.
make: *** [Makefile:145: hyper.o] Error 1

GCC 11.2.0

c++ -O0 -std=c++11 -DLINUX -march=native -fPIC -W -Wall -Wextra -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -DCAP_GLEW=1 -DCAP_PNG=1  -DFHS -I/usr/include/SDL -DHYPERPATH='"/usr/share/hyperrogue/"' -DRESOURCEDESTDIR='"/usr/share/hyperrogue/"'  langen.cpp    -o langen
c++ -O2 makeh.cpp -o makeh
c++ -O2 -std=c++11 -DLINUX -march=native -fPIC -W -Wall -Wextra -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -DCAP_GLEW=1 -DCAP_PNG=1  -DFHS -I/usr/include/SDL -DHYPERPATH='"/usr/share/hyperrogue/"' -DRESOURCEDESTDIR='"/usr/share/hyperrogue/"' -c savepng.cpp -o savepng.o
./langen > language-data.cpp
./makeh classes.cpp locations.cpp colors.cpp hyperpoint.cpp geometry.cpp goldberg.cpp init.cpp floorshapes.cpp cell.cpp multi.cpp shmup.cpp pattern2.cpp mapeditor.cpp graph.cpp textures.cpp hprint.cpp language.cpp util.cpp complex.cpp *.cpp > autohdr.h
c++ -O2 -std=c++11 -DLINUX -march=native -fPIC -W -Wall -Wextra -Werror -pedantic -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-maybe-uninitialized -DCAP_GLEW=1 -DCAP_PNG=1  -DFHS -I/usr/include/SDL -DHYPERPATH='"/usr/share/hyperrogue/"' -DRESOURCEDESTDIR='"/usr/share/hyperrogue/"'  -c hyper.cpp -o hyper.o
In file included from /usr/include/c++/11.2.0/cstddef:50,
                 from /usr/include/GL/glew.h:224,
                 from sysconfig.h:472,
                 from hyper.h:19,
                 from hyper.cpp:23:
locations.cpp: In instantiation of 'T* hr::tailored_alloc(int) [with T = hr::heptagon]':
heptagon.cpp:81:42:   required from here
locations.cpp:183:20: error: 'offsetof' within non-standard-layout type 'hr::heptagon' is conditionally-supported [-Werror=invalid-offsetof]
  183 |   int b = offsetof(T, c) + offsetof(connection_table<T>, move_table) + sizeof(T*) * degree + degree;
      |                    ^
locations.cpp: In instantiation of 'T* hr::tailored_alloc(int) [with T = hr::cell]':
cell.cpp:215:34:   required from here
locations.cpp:183:20: error: 'offsetof' within non-standard-layout type 'hr::cell' is conditionally-supported [-Werror=invalid-offsetof]
locations.cpp: In instantiation of 'T* hr::connection_table<T>::full() [with T = hr::heptagon]':
locations.cpp:149:35:   required from 'int hr::connection_table<T>::fix(int) [with T = hr::heptagon]'
locations.cpp:357:60:   required from here
locations.cpp:137:50: error: 'offsetof' within non-standard-layout type 'hr::heptagon' is conditionally-supported [-Werror=invalid-offsetof]
  137 |   T* full() { return (T*)((char*)this - offsetof(T, c)); }
      |                                                  ^
locations.cpp: In instantiation of 'T* hr::connection_table<T>::full() [with T = hr::cell]':
locations.cpp:149:35:   required from 'int hr::connection_table<T>::fix(int) [with T = hr::cell]'
locations.cpp:378:55:   required from here
locations.cpp:137:50: error: 'offsetof' within non-standard-layout type 'hr::cell' is conditionally-supported [-Werror=invalid-offsetof]
cc1plus: all warnings being treated as errors
make: *** [Makefile:145: hyper.o] Error 1
Quuxplusone commented 3 years ago

FYI, the fixes are:

zenorogue commented 3 years ago

Added these changes, thanks! (Presumably mingw would need -Wno-invalid-offsetof too)

sdsddsd1 commented 3 years ago

This works for me. Thanks for the fix!