c++0x, SDL, std::vector problem on ppc64el
Hi,
I'm trying to solve the build failure of my package vcmi on ppc64el:
https://buildd.debian.org/status/fetch.php?pkg=vcmi&arch=ppc64el&ver=0.97%2Bdfsg-2&stamp=1416356066
The relevant first error message is:
[ 68%] Building CXX object AI/StupidAI/CMakeFiles/StupidAI.dir/main.cpp.o
cd /«BUILDDIR»/vcmi-0.97+dfsg/build/AI/StupidAI && /usr/bin/c++ -DFL_CPP11 -DM_BIN_DIR=\"/usr/games\" -DM_DATA_DIR=\"/usr/share/vcmi\" -DM_LIB_DIR=\"/usr/lib/powerpc64le-linux-gnu/vcmi\" -DStupidAI_EXPORTS -DUSE_SYSTEM_MINIZIP -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual -Wno-type-limits -fvisibility=hidden -O2 -g -DNDEBUG -fPIC -I/«BUILDDIR»/vcmi-0.97+dfsg -I/«BUILDDIR»/vcmi-0.97+dfsg/AI/StupidAI -I/«BUILDDIR»/vcmi-0.97+dfsg/lib -Winvalid-pch -include "/«BUILDDIR»/vcmi-0.97+dfsg/build/AI/StupidAI/cotire/StupidAI_CXX_prefix.hxx" -o CMakeFiles/StupidAI.dir/main.cpp.o -c /«BUILDDIR»/vcmi-0.97+dfsg/AI/StupidAI/main.cpp
/«BUILDDIR»/vcmi-0.97+dfsg/client/mapHandler.h:32:7: error: expected unqualified-id before '__attribute__'
std::vector < std::pair<const CGObjectInstance*,SDL_Rect> > objects; //pointers to objects being on this tile with rects to be easier to blit this tile on screen
^
This only happens on ppc64el. I was able to track this issue down to a
combination of including SDL.h, using std::vector and compiling with
-std=c++0x. In the following I will post some code and how I compile it and
the results on ppc64el (on the left) and amd64 (on the right).
Test 1
======
$ cat test.cc
#include "SDL.h"
#include <vector>
std::vector<int> foo;
$ c++ -I/usr/include/SDL2 -c test.cc
ppc64el | amd64
---------------------------------------|---------------------------------------
success | success
Test 2
======
$ cat test.cc
#include "SDL.h"
#include <vector>
std::vector<int> foo;
$ c++ -std=c++0x -I/usr/include/SDL2 -c test.cc
ppc64el | amd64
---------------------------------------|---------------------------------------
http://mister-muffin.de/p/R1iq.txt | success
Test 3
======
$ cat test.cc
#include "SDL.h"
std::vector<int> foo;
$ c++ -std=c++0x -I/usr/include/SDL2 -c test.cc
ppc64el | amd64
---------------------------------------|---------------------------------------
test.cc:4:6: error: expected | test.cc:4:6: error: ‘vector’ in
unqualified-id before ‘__attribute__’ | namespace ‘std’ does not name a
std::vector<int> foo; | template type
^ |
The last error in test 3 is what I see on ppc64el in the build log entry above.
But as you can see, even if I "#include <vector>" I get an error as you can see
in test 2. It only seems to compile fine on ppc64el if I do not pass
-std=c++0x. But the upstream project requires that. So why is there this
difference between ppc64el and all other architectures?
This test has been done with c++ 4.9.2-2.
Please CC me as I'm not subscribed.
Also CC-ing my sponsor and Bret Curtis because openmw throws the same error
message only on ppc64el and also uses SDL:
https://buildd.debian.org/status/fetch.php?pkg=openmw&arch=ppc64el&ver=0.33.0-3&stamp=1415829020
Thank you!
cheers, josch
Reply to: