bgame icon indicating copy to clipboard operation
bgame copied to clipboard

Linux build broken currently on arch

Open Glog78 opened this issue 7 years ago • 13 comments

CMakeLists.txt Line 114 -> components/item.cpp should most likely be components/items/item.cpp

/systems/helpers/inventory_assistant.hpp

template <class ITEM_TYPE>
	std::size_t claim_closest_item_by_category(position_t &pos, const int range) {
		// We're taking advantage of map being sorted to find the closest here
		std::map<float, std::size_t> distance_sorted;

		**each**<item_t, ITEM_TYPE>([&distance_sorted, **&category**, &pos, &range](bengine::entity_t &e, item_t &i, ITEM_TYPE &type) {
			if (e.component<claimed_t>() == nullptr) {
				auto p = get_item_location(e.id);
				if (p) {
					const float distance = distance3d_squared(pos.x, pos.y, pos.z, p->x, p->y, p->z);
					if (range == -1 || distance < range) distance_sorted[distance] = e.id;
				}
			}
		});

		if (distance_sorted.empty()) return 0;

		std::size_t closest_matching_id = distance_sorted.begin()->second;
		systems::**inventory_system**::claim_item(closest_matching_id, true);

		return closest_matching_id;
}

each should be most likely bengine::each / or the namespace is missing like in the other template category isn't defined inventory_system isn't defined

hope this helps a little

Glog78 avatar Jan 30 '18 20:01 Glog78

Oops! I just moved that file and forgot to update some things. I'll get that fixed ASAP. Thanks!

thebracket avatar Jan 30 '18 20:01 thebracket

Looks like there are a bunch of Linux build issues here, so I'm fixing them in the temporary fixlinux branch. I'll merge them in when they work on my Linux VM.

thebracket avatar Jan 30 '18 21:01 thebracket

Good morning. Ok i tried the fixlinux branch. This one compiles now but doesn't link even with changing the cmake LUA_INCLUDE_DIR and LUA_LIBRARY to version 5.1.

Here is the output when linking -> http://termbin.com/ri2b

The default LUA on Arch is 5.3 btw.

Glog78 avatar Jan 31 '18 09:01 Glog78

Sorry about that, I wasn't done when I stopped yesterday (family things). It was still missing several files.

I just pushed a commit that builds and links on my Linux Mint VM. It also breaks up the CMake file into a bunch of different static libraries (with dependencies defined separately for them), to speed up compile (and especially recompile) time.

Testing it on my Mac build system now.

thebracket avatar Jan 31 '18 15:01 thebracket

Will try on arch and post back.

Glog78 avatar Jan 31 '18 15:01 Glog78

Seems to have still issues with the lua stuff.

1st) LC_ALL=C cmake -DLUA_INCLUDE_DIR=/usr/include/lua5.1/ -DLUA_LIBRARY=/usr/lib/liblua5.1.so ../src/ output -> http://termbin.com/kmvpx interesting might be the warning for systemsettler 2nd) LC_ALL=C VERBOSE=1 make output -> http://termbin.com/eviz

seems to have still problems somehow to link against dynamic lua ?

Glog78 avatar Jan 31 '18 16:01 Glog78

Interesting, I'll see what I can find. I'm getting similar Lua build problems on OS X currently, so something isn't right. I just checked my Linux Mint install, and I'm using the liblua5.3-dev package. Maybe I'm using something that changed between versions without knowing it?

thebracket avatar Jan 31 '18 16:01 thebracket

let me try 5.3 (arch has all 3 versions) but i supose it's something different.

Glog78 avatar Jan 31 '18 16:01 Glog78

Sounds good. I'm investigating just including Lua as a sub-project and compiling it statically into the binary. That seems to work better on OS X (which always gives me problems), maybe it'll help with Linux and MSYS2 also.

thebracket avatar Jan 31 '18 17:01 thebracket

ok 5.3 doesn't work either. Can it be that this double definition is problematic line 315 target_link_libraries(raws bengine components) line 343 target_link_libraries(raws ${LUA_LIBRARIES})

Glog78 avatar Jan 31 '18 17:01 Glog78

This is very strange.

I just succeeded in building on OS X for the first time in a while (months) with the same CMake build. I had to nuke my "build" folder and regenerate (specifying compilers, since I'm using newer versions of Clang than Apple). Removing any reference to LUA_LIBRARY in the setup (letting FindLua do the magic) did the trick there.

I just built/linked the same build on my Linux Mint VM.

I'll see if I can get an Arch Linux VM running tomorrow to try and recreate the problem. I had some issues with msys2, which also uses pacman - so maybe it's something in the way the packages interact with how I'm building?

Also, don't know if it helps - but I just uploaded my current Linux build to http://bfnightly.bracketproductions.com/noxfutura-linux.tgz

thebracket avatar Jan 31 '18 20:01 thebracket

i can try to use clang instead and gold instead of gcc tomorow. The build doesn't run on arch and i don't think it's good to include so many libraries. So better we fix the build. My first idea for the libraries would be use steam runtime as goal and avoid to link to minor versions directly.

Glog78 avatar Jan 31 '18 20:01 Glog78

current master branch with clang and llvm toolchain: LC_ALL=C CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -D_CMAKE_TOOLCHAIN_PREFIX=llvm- ../src/ http://termbin.com/kl82d

LC_ALL=C VERBOSE=1 make -j4 http://termbin.com/4xfr

this indicates a bug with clang and glm inside of lua_bridge. Maybe worth checking ?

Current master branch with gcc builds. Maybe the missing zlib dependency ? Thanks alot.

Glog78 avatar Feb 01 '18 23:02 Glog78