Compliation errors on mips, mipsel and mips64el

Everything about development and the OpenMW source code.
Post Reply
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Compliation errors on mips, mipsel and mips64el

Post by psi29a »

https://buildd.debian.org/status/fetch. ... 8800&raw=0
https://buildd.debian.org/status/fetch. ... 9547&raw=0
https://buildd.debian.org/status/fetch. ... 8773&raw=0

Specifically:

Code: Select all

components/nif/data.hpp:118:14: error: expected unqualified-id before numeric constant
     int bpp, mips;
              ^

Code: Select all

[  3%] Building CXX object components/CMakeFiles/components.dir/resource/imagemanager.cpp.o
cd /<<PKGBUILDDIR>>/build/components && /usr/bin/c++  -DBOOST_NO_CXX11_SCOPED_ENUMS=ON -DGLOBAL_CONFIG_PATH=\"/etc\" -DGLOBAL_DATA_PATH=\"/usr/share/games\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DTIXML_USE_STL -D__STDC_CONSTANT_MACROS -I/<<PKGBUILDDIR>>/. -isystem /usr/include/SDL2 -isystem /usr/include/MYGUI -isystem /usr/include/AL -isystem /usr/include/bullet -I/<<PKGBUILDDIR>>/build/components -isystem /usr/include/mipsel-linux-gnu/qt5 -isystem /usr/include/mipsel-linux-gnu/qt5/QtWidgets -isystem /usr/include/mipsel-linux-gnu/qt5/QtGui -isystem /usr/include/mipsel-linux-gnu/qt5/QtCore -isystem /usr/lib/mipsel-linux-gnu/qt5/mkspecs/linux-g++  -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long -Wno-unused-but-set-parameter -O2 -g -DNDEBUG   -fPIC -std=gnu++11 -o CMakeFiles/components.dir/resource/imagemanager.cpp.o -c /<<PKGBUILDDIR>>/components/resource/imagemanager.cpp
/<<PKGBUILDDIR>>/./components/nif/data.hpp:118:14: error: expected unqualified-id before numeric constant
     int bpp, mips;
              ^
[  4%] Building CXX object components/CMakeFiles/components.dir/resource/bulletshapemanager.cpp.o
cd /<<PKGBUILDDIR>>/build/components && /usr/bin/c++  -DBOOST_NO_CXX11_SCOPED_ENUMS=ON -DGLOBAL_CONFIG_PATH=\"/etc\" -DGLOBAL_DATA_PATH=\"/usr/share/games\" -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DTIXML_USE_STL -D__STDC_CONSTANT_MACROS -I/<<PKGBUILDDIR>>/. -isystem /usr/include/SDL2 -isystem /usr/include/MYGUI -isystem /usr/include/AL -isystem /usr/include/bullet -I/<<PKGBUILDDIR>>/build/components -isystem /usr/include/mipsel-linux-gnu/qt5 -isystem /usr/include/mipsel-linux-gnu/qt5/QtWidgets -isystem /usr/include/mipsel-linux-gnu/qt5/QtGui -isystem /usr/include/mipsel-linux-gnu/qt5/QtCore -isystem /usr/lib/mipsel-linux-gnu/qt5/mkspecs/linux-g++  -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long -Wno-unused-but-set-parameter -O2 -g -DNDEBUG   -fPIC -std=gnu++11 -o CMakeFiles/components.dir/resource/bulletshapemanager.cpp.o -c /<<PKGBUILDDIR>>/components/resource/bulletshapemanager.cpp
/<<PKGBUILDDIR>>/./components/nif/data.hpp:118:14: error: expected unqualified-id before numeric constant
     int bpp, mips;
              ^
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Compliation errors on mips, mipsel and mips64el

Post by psi29a »

Could it be possible that that 'mips' is already set somewhere in a macro? On these systems, which are all MIPS environment, that could cause a collision? Anyway we can work around this?

For example, if someone did something crazy like this?

Code: Select all

 /«PKGBUILDDIR»/zypp/Arch.cc:215:3: note: in expansion of macro 'DEF_BUILTIN'
>    DEF_BUILTIN( mips );
This is because, for historical reasons, the mips toolchain defines
"mips = 1" and "_mips = 1". Either "-Umips -U_mips" need to be added to
the CFLAGS on MIPS or the code in Arch.cc needs to be changed to avoid
the use of the "mips" and "_mips" identifiers.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Compliation errors on mips, mipsel and mips64el

Post by Chris »

Makes some sense that 'mips' would be defined on those platforms. Simplest solution would be to rename the variable (something like 'mipmaps' if I got that bit of code right).
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Compliation errors on mips, mipsel and mips64el

Post by psi29a »

Apparently there is already a datamember with the name mipmaps, just a few lines down:

Code: Select all

std::vector<Mipmap> mipmaps;
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Compliation errors on mips, mipsel and mips64el

Post by psi29a »

It seems to only be used internally for the number_of_mipmaps so that is what I renamed it to.
https://github.com/OpenMW/openmw/pull/1593

Honestly, we shouldn't be laconic with variable names. :)
User avatar
AnyOldName3
Posts: 2667
Joined: 26 Nov 2015, 03:25

Re: Compliation errors on mips, mipsel and mips64el

Post by AnyOldName3 »

I wouldn't exactly call it laconic. :P It's a perfectly decent self-documenting identifier as anyone who'd be able to understand what the code surrounding it was supposed to be doing would be able to recognise what the variable was for without really investigating the surrounding code. It could be more clear, but that wouldn't have been enough of an excuse to change it on its own.

Either way, the developer reference for OpenMW on our wiki says we're a camel case project, and you've changed it to snake case!
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Compliation errors on mips, mipsel and mips64el

Post by psi29a »

AnyOldName3 wrote: 01 Jan 2018, 15:45 I wouldn't exactly call it laconic. :P It's a perfectly decent self-documenting identifier as anyone who'd be able to understand what the code surrounding it was supposed to be doing would be able to recognise what the variable was for without really investigating the surrounding code. It could be more clear, but that wouldn't have been enough of an excuse to change it on its own.

Either way, the developer reference for OpenMW on our wiki says we're a camel case project, and you've changed it to snake case!
Yes because mips means something? I could understand it if someone called it mipmaps (already used as a std::vector), then I could hazard a better guess as to its purpose without having to look at the code. I still think it is more important to be as readable as possible. :)

As for Python standard-operating-procedure...

:roll: :oops:

camel case it is... PR updated.
Post Reply