Build: It doesn't compile on Linux
spacepluk opened this issue · comments
Hi there, I'm trying to compile the engine on Arch Linux with GCC 5.3.0.
Right now, I'm stuck on this error after hacking my way like this. Any idea?
👍, getting this instead, though (also on Arch)
[rob@Archie][~/dev/Torque6/build/gmake]% make
==== Building assimp (release32) ====
==== Building bgfx (release32) ====
==== Building bullet (release32) ====
==== Building ljpeg (release32) ====
==== Building lpng (release32) ====
==== Building zlib (release32) ====
==== Building Torque6 (release32) ====
crc.cc
In file included from ../../src/platform/platform.h:35:0,
from ../../src/algorithm/crc.cc:23:
../../src/platform/event.h:152:49: error: 'data' was not declared in this scope
const U32 PacketReceiveEventHeaderSize = Offset(data,PacketReceiveEvent);
^
../../src/platform/event.h:152:72: error: expected primary-expression before ')' token
const U32 PacketReceiveEventHeaderSize = Offset(data,PacketReceiveEvent);
^
../../src/platform/event.h:152:72: error: 'Offset' was not declared in this scope
../../src/platform/event.h:154:52: error: 'data' was not declared in this scope
const U32 ConnectedReceiveEventHeaderSize = Offset(data,ConnectedReceiveEvent);
^
../../src/platform/event.h:154:78: error: expected primary-expression before ')' token
const U32 ConnectedReceiveEventHeaderSize = Offset(data,ConnectedReceiveEvent);
^
../../src/platform/event.h:154:78: error: 'Offset' was not declared in this scope
../../src/platform/event.h:156:43: error: 'data' was not declared in this scope
const U32 ConsoleEventHeaderSize = Offset(data,ConsoleEvent);
^
../../src/platform/event.h:156:60: error: expected primary-expression before ')' token
const U32 ConsoleEventHeaderSize = Offset(data,ConsoleEvent);
^
../../src/platform/event.h:156:60: error: 'Offset' was not declared in this scope
Torque6.make:1775: recipe for target 'obj/x32/Release/Torque6/src/algorithm/crc.o' failed
make[1]: *** [obj/x32/Release/Torque6/src/algorithm/crc.o] Error 1
Makefile:20: recipe for target 'Torque6' failed
make: *** [Torque6] Error 2
@callmeStriking what version of GCC?
@andr3wmac 5.3.0.
@callmeStriking Try latest. I think this should fix your issues: 8e37aff
Now something different happens...
(edit: simplified the trace)
==== Building assimp (release32) ====
==== Building bgfx (release32) ====
==== Building bullet (release32) ====
==== Building ljpeg (release32) ====
==== Building lpng (release32) ====
==== Building zlib (release32) ====
==== Building Torque6 (release32) ====
RemoteCommandEvent.cc
In file included from ../../src/network/RemoteCommandEvent.cc:31:0:
../../src/game/gameConnection.h:30:24: fatal error: GameObject.h: No such file or directory
compilation terminated.
Torque6.make:1795: recipe for target 'obj/x32/Release/Torque6/src/network/RemoteCommandEvent.o' failed
make[1]: *** [obj/x32/Release/Torque6/src/network/RemoteCommandEvent.o] Error 1
Makefile:20: recipe for target 'Torque6' failed
make: *** [Torque6] Error 2
@callmeStriking @spacepluk I've fixed a lot of the easy ones here 35f395c but there's still an issue with the inclusion unordered_map in GCC that is actually kind of stumping me. I've asked around and no one really knows why it's happening. @callmeStriking I'd be interested to know if you run into this issue with GCC 5.
I do indeed run into an issue with unordered_map
.
[rob@Archie][~/dev/Torque6/build/gmake]% CXX="gcc -std=c++11" make
==== Building assimp (release32) ====
==== Building bgfx (release32) ====
==== Building bullet (release32) ====
==== Building ljpeg (release32) ====
==== Building lpng (release32) ====
==== Building zlib (release32) ====
==== Building Torque6 (release32) ====
sysgui.cc
In file included from /usr/include/c++/5.3.0/unordered_map:35:0,
from ../../lib/bgfx/3rdparty/ocornut-imgui/imgui_wm.h:27,
from ../../lib/bgfx/common/imgui/imgui.h:31,
from ../../src/sysgui/sysgui.cc:37:
/usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11
compiler options.
#error This file requires compiler and library support for the \
^
In file included from /usr/include/dlfcn.h:24:0,
from ../../src/platform/platformLibrary.h:57,
from ../../src/platform/platformMemory.h:27,
from ../../src/platform/event.h:35,
from ../../src/platform/platform.h:35,
from ../../src/collection/vector.h:28,
from ../../src/sim/simBase.h:27,
from ../../src/console/consoleBaseType.h:27,
from ../../src/console/consoleTypes.h:27,
from ../../src/sysgui/sysgui.cc:23:
../../src/platform/event.h:152:54: warning: offsetof within non-standard-layout type 'PacketReceiveEvent' is undefined [-Winvalid-offsetof]
const U32 PacketReceiveEventHeaderSize = Offset(data,PacketReceiveEvent);
^
../../src/platform/event.h:152:42: note: in expansion of macro 'Offset'
const U32 PacketReceiveEventHeaderSize = Offset(data,PacketReceiveEvent);
^
../../src/platform/event.h:154:57: warning: offsetof within non-standard-layout type 'ConnectedReceiveEvent' is undefined [-Winvalid-offsetof]
const U32 ConnectedReceiveEventHeaderSize = Offset(data,ConnectedReceiveEvent);
^
../../src/platform/event.h:154:45: note: in expansion of macro 'Offset'
const U32 ConnectedReceiveEventHeaderSize = Offset(data,ConnectedReceiveEvent);
^
../../src/platform/event.h:156:48: warning: offsetof within non-standard-layout type 'ConsoleEvent' is undefined [-Winvalid-offsetof]
const U32 ConsoleEventHeaderSize = Offset(data,ConsoleEvent);
^
../../src/platform/event.h:156:36: note: in expansion of macro 'Offset'
const U32 ConsoleEventHeaderSize = Offset(data,ConsoleEvent);
^
Torque6.make:1887: recipe for target 'obj/x32/Release/Torque6/src/sysgui/sysgui.o' failed
make[1]: *** [obj/x32/Release/Torque6/src/sysgui/sysgui.o] Error 1
Makefile:20: recipe for target 'Torque6' failed
make: *** [Torque6] Error 2
You may need to tell your build system to pass -std=c++11
to gcc.
@callmeStriking Yeah, I've tried c++11 and c++0x in GCC 4 and while I don't get the error you get, I get a large collection of compile errors from including unordered_map.
If you want you can go here:
https://github.com/andr3wmac/Torque6/blob/master/build/scripts/Torque6.lua#L131
And change --std=c++0x to --std=c++11 to see if that fixes your issues on GCC 5.
Switching to -std=c++11 makes it explode: http://sprunge.us/HJej
That is still better than it failing to an error because of the wrong C++ version.
@callmeStriking The first half of the log is fixable, it's because types.gcc.h is not seeing linux as a define even though it should. I can fix that easily, but the second half of the log, the massive spam about errors from within unordered_map.h is puzzling. Might take me a bit to figure out what's going on there.
I've fixed those issues. Just need to clean up the old GL code that has references that have all been removed and it should be good to go. I'll finish that up tomorrow.
@spacepluk @callmeStriking should build fine now. It won't run for me in the VM but neither will other GL things like bgfx samples so I can't say its tested and working, but it builds. I'll install linux as dual boot sometime in the near future so I can properly test it. Let me know how it goes.
It's not complaining about unordered_map anymore, at least. But I'm afraid the build is still broken.
It seems to be complaining about endian-ness and CPU setting, though. I have no experience with Genie, so I don't think I'd know how to fix it. But it seems this won't be nearly as bad.
@callmeStriking Pull the latest, regen with genie, let me know if it works. If it doesn't: what processor are you on and what flavor of linux? If it's 64-bit you should try building release64 instead of release32.
Perhaps I'm using the build system incorrectly. I'm running
cd build
genie gmake
cd gmake
make -j64
(I omit the -j64
when trying to capture a log.)
Even running genie gmake --platform=x64 --os=linux
rather than genie gmake
doesn't fix it.
Running Arch Linux 4.4.0-3 x86_64 (testing repositories enabled) on an Intel i5 6600K (Skylake).
And I'm missing the part where you select release64/32. Never had to?
@callmeStriking try:
make config=release64
And now for something entirely different. http://sprunge.us/bVSX
The build now fails in a different area, but no longer due to CPU/OS/endian-ness.
Deferred shading?
@callmeStriking I forgot to push that file after updating to latest bgfx. Try again :D
Fonts! http://sprunge.us/YVPQ
@callmeStriking I'll take a look at it in a few hours. This experience has made it clear I need to setup Travis CI so I can be notified of build issues across the various platforms after I push rather than when someone decides to try it haha. Lesson learned.
@callmeStriking Give the latest a try.
So close.
==== Building assimp (release64) ====
==== Building bgfx (release64) ====
==== Building bullet (release64) ====
==== Building ljpeg (release64) ====
==== Building lpng (release64) ====
==== Building zlib (release64) ====
==== Building Torque6 (release64) ====
==== Building Torque6App (release64) ====
Linking Torque6App
../bin/libTorque6.so: undefined reference to `createPlatformFont(char const*, unsigned int, unsigned int)'
collect2: error: ld returned 1 exit status
Torque6App.make:159: recipe for target '../bin/Torque6App' failed
make[1]: *** [../bin/Torque6App] Error 1
Makefile:16: recipe for target 'Torque6App' failed
make: *** [Torque6App] Error 2
Still fonts.
@callmeStriking Damn old unused platform font code. Try again :)
It builds!
Unfortunately, now when I try to run the binary (/build/bin/Torque6App) it fails with the message Failed to load libTorque6.so
. It's in the same folder, so it should be able to load it...
(Should this be in a separate issue?)
@callmeStriking just create a link to this lib in your system library directory (dunno where it is in Arch 😅 )
@TheWilfen that's a valid workaround but its actually failing due to a flaw in the code at the moment. Will fix this afternoon.
@callmeStriking : Try the latest. Keep in mind if you aren't using an IDE where you can set the working directory you'll have to take libTorque6 and Torque6App and drop them in the root directory of which ever example project you wish to run.
It builds and runs! Well, except it doesn't work when trying to open projects.
[rob@Archie][~/dev/Torque6]% cp build/bin/{libTorque6.so,Torque6App} projects/01-AnimatedMesh
cp: 'build/bin/libTorque6.so' and 'projects/01-AnimatedMesh/libTorque6.so' are the same file
cp: 'build/bin/Torque6App' and 'projects/01-AnimatedMesh/Torque6App' are the same file
[rob@Archie][~/dev/Torque6]% cd projects/01-AnimatedMesh
[rob@Archie][~/dev/Torque6/projects/01-AnimatedMesh]% ./Torque6App
./Torque6App: error while loading shared libraries: ../bin/libTorque6.so: cannot open shared object file: No such file or directory
It's correct, that file and directory don't exist. I tried it with simple symlinks between the objects in the bin folder into the project folder I wanted it to open (hence "the same file" above). Tried it from a bunch of different cwds but it seems like I'd have to rename the project directory to "bin" for it to work right.
@callmeStriking Good to hear it builds. I've also got Travis CI setup doing builds on linux now so hopefully this won't happen again. I'm going to close this issue but please open another for it not running on linux and I'll get it fixed up as soon as possible. Also, thanks for your patience.