Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active December 21, 2015 03:48
Show Gist options
  • Save springmeyer/6244531 to your computer and use it in GitHub Desktop.
Save springmeyer/6244531 to your computer and use it in GitHub Desktop.
libosmium os x patch
diff --git a/include/osmium/detail/typed_mmap.hpp b/include/osmium/detail/typed_mmap.hpp
index 96b5213..382461b 100644
--- a/include/osmium/detail/typed_mmap.hpp
+++ b/include/osmium/detail/typed_mmap.hpp
@@ -41,6 +41,11 @@ DEALINGS IN THE SOFTWARE.
#include <sys/types.h>
#include <unistd.h>
+// for bsd systems
+#ifndef MAP_ANONYMOUS
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+
namespace osmium {
/**
diff --git a/include/osmium/index/map/mmap_vector_anon.hpp b/include/osmium/index/map/mmap_vector_anon.hpp
index 03d655d..49d5d3d 100644
--- a/include/osmium/index/map/mmap_vector_anon.hpp
+++ b/include/osmium/index/map/mmap_vector_anon.hpp
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
*/
+#ifdef __linux__
+
#include <osmium/index/map/vector.hpp>
#include <osmium/detail/mmap_vector_anon.hpp>
@@ -54,4 +56,6 @@ namespace osmium {
} // namespace osmium
+#endif // __linux__
+
#endif // OSMIUM_INDEX_MAP_MMAP_VECTOR_ANON_HPP
diff --git a/include/osmium/index/multimap/mmap_vector_anon.hpp b/include/osmium/index/multimap/mmap_vector_anon.hpp
index 26100d7..61aa107 100644
--- a/include/osmium/index/multimap/mmap_vector_anon.hpp
+++ b/include/osmium/index/multimap/mmap_vector_anon.hpp
@@ -33,6 +33,8 @@ DEALINGS IN THE SOFTWARE.
*/
+#ifdef __linux__
+
#include <osmium/index/multimap/vector.hpp>
#include <osmium/detail/mmap_vector_anon.hpp>
@@ -51,4 +53,6 @@ namespace osmium {
} // namespace osmium
+#endif // __linux__
+
#endif // OSMIUM_INDEX_MULTIMAP_MMAP_VECTOR_ANON_HPP
diff --git a/include/osmium/io/file.hpp b/include/osmium/io/file.hpp
index 66616ba..d3e9098 100644
--- a/include/osmium/io/file.hpp
+++ b/include/osmium/io/file.hpp
@@ -40,6 +40,7 @@ DEALINGS IN THE SOFTWARE.
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <cstdlib>
#include <osmium/io/encoding.hpp>
#include <osmium/io/file_type.hpp>
diff --git a/include/osmium/io/meta.hpp b/include/osmium/io/meta.hpp
index 23865f3..1b813e4 100644
--- a/include/osmium/io/meta.hpp
+++ b/include/osmium/io/meta.hpp
@@ -33,6 +33,7 @@ DEALINGS IN THE SOFTWARE.
*/
+#include <string>
#include <osmium/osm/bounds.hpp>
namespace osmium {
diff --git a/include/osmium/memory/builder.hpp b/include/osmium/memory/builder.hpp
index 00d06bf..a9f0834 100644
--- a/include/osmium/memory/builder.hpp
+++ b/include/osmium/memory/builder.hpp
@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE.
*/
#include <cstring>
-
+#include <new>
#include <osmium/memory/buffer.hpp>
namespace osmium {
diff --git a/include/osmium/memory/collection.hpp b/include/osmium/memory/collection.hpp
index 791d8ad..e383e69 100644
--- a/include/osmium/memory/collection.hpp
+++ b/include/osmium/memory/collection.hpp
@@ -85,7 +85,7 @@ namespace osmium {
}
friend std::ostream& operator<<(std::ostream& out, const CollectionIterator<TMember>& iter) {
- out << static_cast<void*>(iter.m_data);
+ out << static_cast<data_type>(iter.m_data);
return out;
}
diff --git a/include/osmium/osm/bounds.hpp b/include/osmium/osm/bounds.hpp
index cf09996..bcf2e93 100644
--- a/include/osmium/osm/bounds.hpp
+++ b/include/osmium/osm/bounds.hpp
@@ -34,6 +34,7 @@ DEALINGS IN THE SOFTWARE.
*/
#include <osmium/osm/location.hpp>
+#include <ostream>
namespace osmium {
diff --git a/test/run_tests.sh b/test/run_tests.sh
index 403165b..609a138 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -18,15 +18,13 @@ if [ -z "$CXXFLAGS_WARNINGS" ]; then
CXXFLAGS_WARNINGS="-Wall -Wextra -Wredundant-decls -Wdisabled-optimization -pedantic -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wno-long-long"
fi
-if [ -z "$CXXFLAGS" ]; then
- CXXFLAGS="-g -std=c++11"
-fi
+CXXFLAGS+=" -g -std=c++11"
if [ `uname -s` = 'Darwin' ]; then
CXXFLAGS="${CXXFLAGS} -stdlib=libc++"
fi
-COMPILE="$CXX -I../include -I. $CXXFLAGS $CXXFLAGS_WARNINGS -o tests"
+COMPILE="$CXX -I../include -I. $CXXFLAGS $CXXFLAGS_WARNINGS -o tests $LDFLAGS"
if [ "x$1" = "x-v" ]; then
VALGRIND="valgrind --leak-check=full --show-reachable=yes"
@@ -43,7 +41,7 @@ test_file () {
eval OPTS_CFLAGS=`../get_options.sh --cflags $FILES`
eval OPTS_LIBS=`../get_options.sh --libs $FILES`
- PARAMS="$OPTS_CFLAGS $OPTS_LIBS -DBOOST_TEST_DYN_LINK -lboost_unit_test_framework"
+ PARAMS="$OPTS_CFLAGS $OPTS_LIBS -lboost_unit_test_framework"
echo "Checking $BOLD$1$NORM..."
echo $COMPILE $FILES $PARAMS
diff --git a/test/t/index/test_id_to_location.cpp b/test/t/index/test_id_to_location.cpp
index 152717f..f5cd8d3 100644
--- a/test/t/index/test_id_to_location.cpp
+++ b/test/t/index/test_id_to_location.cpp
@@ -91,6 +91,7 @@ BOOST_AUTO_TEST_CASE(DenseMapMem) {
test_func_real<index_type>(index2);
}
+#ifdef __linux__
BOOST_AUTO_TEST_CASE(DenseMapMmap) {
typedef osmium::index::map::DenseMapMmap<osmium::unsigned_object_id_type, osmium::Location> index_type;
@@ -100,6 +101,7 @@ BOOST_AUTO_TEST_CASE(DenseMapMmap) {
index_type index2;
test_func_real<index_type>(index2);
}
+#endif
BOOST_AUTO_TEST_CASE(DenseMapFile) {
typedef osmium::index::map::DenseMapFile<osmium::unsigned_object_id_type, osmium::Location> index_type;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment