Created attachment 151474 [details] Fix games/xmoto with libc++ r224926 Bug 196535 shows that deskutils/strigidaemon fails to compile when libc++ r224926 is imported: http://package18.nyi.freebsd.org/data/headamd64PR196535-default/2015-01-07_20h10m47s/logs/errors/xmoto-0.5.11_6.log The build errors are caused by games/xmoto/files/patch-src-VTexture.h and games/xmoto/files/patch-src-drawlib-DrawLibOpenGL.cpp, which are incorrect, in the sense that the maps are still used to index char pointers, not std::strings. Also, std::string does not have a default hash function to call (the 'call operator error' indicate this. I simply removed these two patches, which makes the port build. Additionally, I've added two patches to make the port with -std=c+11. These are really just nice-to-haves, and one of them actually fixes a small bug in WWW.cpp.
Auto-assigned to maintainer amdmi3@FreeBSD.org
Copy/pasto: deskutils/strigidaemon was from a related bug, this is of course all about the games/xmoto port.
> which are incorrect, in the sense that the maps are still used to index char pointers, not std::strings No, they are correct - they should be indexed by strings. Using char pointers there is broken, as different pointers may refer to equal strings. You may run xmoto without the patch to see how it's broken. Regarding the hash function, N3337 specifies that there is std::hash specification for std::string, and it the port works fine with current version of libc++. What has changed so newer version doesn't have it? I see __gnu_cxx references in the log, maybe switching to std::unordered_map will fix it?
hash_map was never a standard, it's something from the original STI STL, which ended up in libstdc++'s ext/ directory. Since so many code relies on this, libc++ also implemented a version in ext/hash_map, but apparently the most recent version is not entirely compatible. But I have no idea at this point why the newer version of libc++ does not like to instantiate a hash_map with a std::string as index. That said, migrating to unordered_map is likely to work better, but that might not work so good with older versions of gcc and/or libstdc++.
It seems intentional, at least according to this libc++ commit: http://llvm.org/viewvc/llvm-project?view=revision&revision=203070 (The review link in the commit message is outdated, should now point to http://reviews.llvm.org/D2747 instead.) So the solution is probably to define an explicit specialization for std::string. I'll have a look if that is easier than changing to unordered_map.
Created attachment 151511 [details] Fix games/xmoto with libc++ r224926 Ok, here is a better patch, which: 1) does not remove the patch-src-VTexture.h and patch-src-drawlib-DrawLibOpenGL.cpp files 2) removes the now unused struct hashcmp_str 3) for the libc++ case, adds a __gnucxx::hash<std::string> specialization, which reuses the const char * specialization (and that, in turn calls libc++'s __do_string_hash(), which is based on either murmur2 or cityhash). I can't check here whether the specialization works correctly for the case that you fixed in r373383, e.g. the broken text rendering. I can only hope it will. :)
Yes, this looks good and works without problems. Committed, thanks!
A commit references this bug: Author: amdmi3 Date: Sun Jan 25 01:41:05 UTC 2015 New revision: 377854 URL: https://svnweb.freebsd.org/changeset/ports/377854 Log: - Fix build with new libc++ PR: 196652 Submitted by: dim Changes: head/games/xmoto/files/patch-src-GameInit.cpp head/games/xmoto/files/patch-src-WWW.cpp head/games/xmoto/files/patch-src-include-xm__hashmap.h