omcfadde / dante

idTech4 OpenGL ES2.0 | #dante (irc.freenode.net)
http://omcfadde.blogspot.fi
GNU General Public License v3.0
111 stars 30 forks source link

Compilation error on ARM/Linux #27

Closed Pix13 closed 12 years ago

Pix13 commented 12 years ago

I have a weird build error when trying to cross-compile dante on a glibc arm/linux target.

(i patched the scons file to remove the pentium3 hardcoded flag for the release build)

scons CC=${CHOST}-gcc CXX=${CHOST}-g++ BUILD="release" JOBS=1 BASEFLAGS=-I${ROOT}/usr/include\ -isystem\ ${ROOT}/usr/include ARCH=arm

CHOST=armv7-stlinux24-linux-gnu- (the cross compiler) ROOT=/usr/targets/albert-b2020/root/ (the ARM rootfs)

gcc version 4.6.3 20120301 (STMicroelectronics/Linux Base 4.6.3-109) (GCC)

the error:

armv7-stlinux24-linux-gnu-g++ -o build/release/d3xp/d3xp/ai/AI_pathing.os -c -fPIC -I/usr/targets/albert-b2020/root//usr/include -isystem /usr/targets/albert-b2020/root//usr/include -pipe -Wall -Wno-sign-compare -Wno-unknown-pragmas -Wno-psabi -fmessage-length=0 -fpermissive -fvisibility=hidden -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-strict-aliasing -D_D3XP -DCTF -DGAME_DLL d3xp/ai/AI_pathing.cpp In file included from d3xp/ai/../../idlib/../idlib/Lib.h:189:0, from d3xp/ai/../../idlib/precompiled.h:116, from d3xp/ai/AI_pathing.cpp:29: d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat2 idMat2::Inverse() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:347:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat2 idMat2::InverseFast() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:357:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat3 idMat3::Inverse() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:838:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat3 idMat3::InverseFast() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:848:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat4 idMat4::Inverse() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:1348:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat4 idMat4::InverseFast() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:1358:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat5 idMat5::Inverse() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:1755:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat5 idMat5::InverseFast() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:1765:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat6 idMat6::Inverse() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:2215:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat6 idMat6::InverseFast() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:2225:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMatX idMatX::Inverse() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:3175:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMatX idMatX::InverseFast() const’: d3xp/ai/../../idlib/../idlib/math/Matrix.h:3215:6: warning: unused variable ‘r’ [-Wunused-variable] d3xp/ai/AI_pathing.cpp: In function ‘pathNode_t* BuildPathTree(const obstaclet, int, const idBounds&, const idVec2&, const idVec2&, obstaclePath_t&)’: d3xp/ai/AI_pathing.cpp:659:51: error: ‘next’ was not declared in this scope d3xp/ai/AI_pathing.cpp:659:55: error: a function call cannot appear in a constant-expression d3xp/ai/AI_pathing.cpp:659:57: error: template argument 2 is invalid d3xp/ai/AI_pathing.cpp:659:72: error: invalid type in declaration before ‘,’ token d3xp/ai/AI_pathing.cpp:667:16: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:669:28: error: request for member ‘Get’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:669:116: error: request for member ‘Get’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:671:13: error: request for member ‘Add’ in ‘treeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:709:20: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:713:20: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:726:20: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/AI_pathing.cpp:751:19: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ d3xp/ai/../../idlib/../d3xp/Game_local.h: At global scope: d3xp/ai/../../idlib/../d3xp/Game_local.h:116:11: warning: ‘NUM_RENDER_PORTAL_BITS’ defined but not used [-Wunused-variable] d3xp/ai/../../idlib/../d3xp/Game_local.h:810:11: warning: ‘CINEMATIC_SKIP_DELAY’ defined but not used [-Wunused-variable] d3xp/ai/../../idlib/../d3xp/Player.h:73:11: warning: ‘ASYNC_PLAYER_INV_AMMO_BITS’ defined but not used [-Wunused-variable] d3xp/ai/AIpathing.cpp:1438:14: warning: ‘float HeightForTrajectory(const idVec3&, float, float)’ defined but not used [-Wunused-function] scons: ** [build/release/d3xp/d3xp/ai/AI_pathing.os] Error 1 scons: building terminated because of errors.

Pix13 commented 12 years ago

When trying with TARGET_D3XP=0, i have :

armv7-stlinux24-linux-gnu-g++ -o build/release/game/game/ai/AI_pathing.os -c -fPIC -I/usr/targets/albert-b2020/root//usr/include -isystem /usr/targets/albert-b2020/root//usr/include -pipe -Wall -Wno-sign-compare -Wno-unknown-pragmas -Wno-psabi -fmessage-length=0 -fpermissive -fvisibility=hidden -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -fno-strict-aliasing -DGAME_DLL game/ai/AI_pathing.cpp In file included from game/ai/../../idlib/../idlib/Lib.h:189:0, from game/ai/../../idlib/precompiled.h:116, from game/ai/AI_pathing.cpp:29: game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat2 idMat2::Inverse() const’: game/ai/../../idlib/../idlib/math/Matrix.h:347:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat2 idMat2::InverseFast() const’: game/ai/../../idlib/../idlib/math/Matrix.h:357:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat3 idMat3::Inverse() const’: game/ai/../../idlib/../idlib/math/Matrix.h:838:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat3 idMat3::InverseFast() const’: game/ai/../../idlib/../idlib/math/Matrix.h:848:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat4 idMat4::Inverse() const’: game/ai/../../idlib/../idlib/math/Matrix.h:1348:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat4 idMat4::InverseFast() const’: game/ai/../../idlib/../idlib/math/Matrix.h:1358:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat5 idMat5::Inverse() const’: game/ai/../../idlib/../idlib/math/Matrix.h:1755:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat5 idMat5::InverseFast() const’: game/ai/../../idlib/../idlib/math/Matrix.h:1765:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat6 idMat6::Inverse() const’: game/ai/../../idlib/../idlib/math/Matrix.h:2215:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMat6 idMat6::InverseFast() const’: game/ai/../../idlib/../idlib/math/Matrix.h:2225:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMatX idMatX::Inverse() const’: game/ai/../../idlib/../idlib/math/Matrix.h:3175:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/../../idlib/../idlib/math/Matrix.h: In member function ‘idMatX idMatX::InverseFast() const’: game/ai/../../idlib/../idlib/math/Matrix.h:3215:6: warning: unused variable ‘r’ [-Wunused-variable] game/ai/AI_pathing.cpp: In function ‘pathNode_t* BuildPathTree(const obstaclet, int, const idBounds&, const idVec2&, const idVec2&, obstaclePath_t&)’: game/ai/AI_pathing.cpp:659:51: error: ‘next’ was not declared in this scope game/ai/AI_pathing.cpp:659:55: error: a function call cannot appear in a constant-expression game/ai/AI_pathing.cpp:659:57: error: template argument 2 is invalid game/ai/AI_pathing.cpp:659:72: error: invalid type in declaration before ‘,’ token game/ai/AI_pathing.cpp:666:16: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:668:28: error: request for member ‘Get’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:668:116: error: request for member ‘Get’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:670:13: error: request for member ‘Add’ in ‘treeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:708:20: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:712:20: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:725:20: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/AI_pathing.cpp:750:19: error: request for member ‘Add’ in ‘pathNodeQueue’, which is of non-class type ‘int’ game/ai/../../idlib/../game/Game_local.h: At global scope: game/ai/../../idlib/../game/Game_local.h:116:11: warning: ‘NUM_RENDER_PORTAL_BITS’ defined but not used [-Wunused-variable] game/ai/../../idlib/../game/Game_local.h:720:11: warning: ‘CINEMATIC_SKIP_DELAY’ defined but not used [-Wunused-variable] game/ai/../../idlib/../game/Player.h:69:11: warning: ‘ASYNC_PLAYER_INV_AMMO_BITS’ defined but not used [-Wunused-variable] game/ai/AIpathing.cpp:1437:14: warning: ‘float HeightForTrajectory(const idVec3&, float, float)’ defined but not used [-Wunused-function] scons: ** [build/release/game/game/ai/AI_pathing.os] Error 1 scons: building terminated because of errors.

Pix13 commented 12 years ago

Thanks to support from havlenapetr and Dandel from #dante, adding:

include /* for offsetof */

to AI_pathing.cpp fixed the build.

Pix13 commented 12 years ago

Reopened to trigger main dev to "merge" the change in the main branch

Pix13 commented 12 years ago

Proposed patch:

diff -urN dante-0.old/neo/game/ai/AI_pathing.cpp dante-0/neo/game/ai/AI_pathing.cpp
--- dante-0.old/neo/game/ai/AI_pathing.cpp  2012-08-21 16:39:17.660220000 +0200
+++ dante-0/neo/game/ai/AI_pathing.cpp  2012-08-21 16:39:32.628976679 +0200
@@ -31,6 +31,8 @@

 #include "../Game_local.h"

+#include <stddef.h> /* for offsetof */
+
 /*
 ===============================================================================
omcfadde commented 12 years ago

Conceptually it looks fine, however I'll probably go ahead and move the #include <stddef.h> into Game_local.h or another include coming from there.

omcfadde commented 12 years ago

Oops, fumble fingers today. I'll check it during this week (I am on sickness leave today, therefore I'm not feeling great...)

Pix13 commented 12 years ago

I concur, i internally made an ugly patch that adds this include to all the files using offsetof (there is 4), it would be nicer to have this include in a common include. The list of files i patched:

neo/renderer/draw_common.cpp neo/renderer/draw_glsl.cpp neo/renderer/tr_backend.cpp neo/renderer/tr_render.cpp

omcfadde commented 12 years ago

Should be resolved by above commit.