SizzlingStats / demboyz

we dem boyz
MIT License
44 stars 13 forks source link

Linux Build Dependency Error #6

Closed stensonowen closed 8 years ago

stensonowen commented 8 years ago

When attempting to build, vagrant up and vagrant provision complain that

==> default: In file included from ../../external/rapidjson-1.0.2/include/rapidjson/rapidjson.h:39:0,
==> default:                  from ../../external/rapidjson-1.0.2/include/rapidjson/filewritestream.h:18,
==> default:                  from ../../demboyz/base/jsonfile.h:4,
==> default:                  from ../../demboyz/base/jsonfile.cpp:2:
==> default: /usr/include/c++/4.8/cstdlib:41:28: fatal error: bits/c++config.h: No such file or directory
==> default:  #include <bits/c++config.h>
==> default:                             ^
==> default: compilation terminated.
==> default: make[1]:
==> default: *** [obj/x32/Debug/jsonfile.o] Error 1
==> default: make:
==> default: *** [demboyz] Error 2

The vagrant instance starts successfully, but demboyz.make throws the same error about #include <bits/c++config.h>.

Attempts to fix:

Running locate c++config.h (which requires sudo updatedb first) yields /usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h (presumably the one we're interested in, as g++ is version 4.8.5). Adding -I/usr/include/x86_64-linux-gnu/c++/4.8 to line 19 of premake/gmake/demboyz.make causes the new issue that /usr/include/c++/4.8/bits/random.h:106:26: error: expected unqualified-id before ‘__int128’ { typedef unsigned __int128 type; };, apparently because __int128 only works well on 64-bit builds.
Indeed, building for 64-bit (changing -m32 to -m64 in lines 23 and 28) builds successfully, but the resulting binary segfaults. I re-built on a Windows machine with MSVS 2013 and it ran fine on the same demos.

I dunno if any of this is helpful. I enjoyed poking around your code, so I figured I'd point this out.

Yepoleb commented 8 years ago

The Vagrant script installs the 4.9 version of the compiler, but your system uses 4.8. If only the 64-bit build fails, you're probably missing the multilib packages. Try installing gcc-4.8-multilib and g++-4.8-multilib or switching the compiler version.

stensonowen commented 8 years ago

g++-4.8-multilib did the trick (I thought I'd checked it, but I guess that was g++-4.9-multilib :/). Thanks.

I'm not super familiar with vagrant, but I hadn't touched anything that would affect which version of g++ is used. A clean clone of the repo and build of the vagrant environment gives the same error, so it looks like the issue is with the box, not my instance specifically. g++ -v on a fresh vagrant env (using vagrant.sh) shows it's version 4.8.5. Should vagrant.sh be modified to include g++-4.8-multilib? Or should it/demboyz.make be modified to use g++ 4.9?

SizzlingCalamari commented 8 years ago

Hi @stensonowen, sorry it didn't compile first try for you.

After taking a look at the vagrant script, it looks like it can be reduced to just sudo apt-get install -y build-essential g++-4.8 g++-4.8-multilib

There's no hard requirement for g++-4.9, and g++-4.8 seems to work for me. The clang setup was left over from when we were originally building with clang.

See if that works for you.

stensonowen commented 8 years ago

Yep, that fixes it. Replacing lines 15-20 of vagrant.sh with sudo apt-get install -y build-essential g++-4.8 g++-4.8-multilib means everything builds out of the box. Thanks

SizzlingCalamari commented 8 years ago

Great, could you make a pull request to replace lines 3-24 with sudo apt-get install -y build-essential g++-4.8 g++-4.8-multilib?

SizzlingCalamari commented 8 years ago

Fixed by #7, thanks!