Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
#!/usr/bin/env bash
set -eu
set -o pipefail
: '
Normally postgres is installed globally and you can only run one postgres server. This shows otherwise.
This script demonstrates how to:
@springmeyer
springmeyer / build_pycairo.sh
Last active August 29, 2015 14:14
build pycairo against mason installed cairo
#!/usr/bin/env bash
set -e -u
PYCAIRO_VERSION="py2cairo-1.10.0"
if [[ ! -f ${PYCAIRO_VERSION}.tar.bz2 ]]; then
wget https://mapnik.s3.amazonaws.com/deps/${PYCAIRO_VERSION}.tar.bz2
fi
if [[ ! -d ${PYCAIRO_VERSION} ]]; then
@springmeyer
springmeyer / install-gdal.sh
Created January 26, 2015 23:48
Install gdal with mason
git clone --depth 1 https://github.com/mapbox/mason.git
export MASON_DIR=$(pwd)/mason
./mason/mason install gdal 1.11.1
./mason/mason link gdal 1.11.1
# test gdalinfo works
./mason_packages/.link/bin/gdalinfo --version
#include <termios.h>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
/*
clang++ -o t t.cpp -I/usr/local/include/
@springmeyer
springmeyer / visitor-test.cpp
Created December 3, 2014 21:21
example of compiling a test program against mapnik local build
#include <mapnik/image_data.hpp>
#include <mapnik/image_data_any.hpp>
#include <mapnik/util/variant.hpp>
#include <iostream>
/*
source localize.sh
clang++ -o visitor-test visitor-test.cpp -Wpadded \
-isystem /Users/dane/projects/mapnik-packaging/osx/out/build-cpp11-libcpp-x86_64-macosx/include \
@springmeyer
springmeyer / setup.sh
Created October 30, 2014 19:23
setup clang/llvm on osx
# http://clang-developers.42468.n3.nabble.com/How-to-determine-clang-s-system-include-dirs-to-set-in-ASTVisitor-td4029080.html
: '
https://gist.github.com/springmeyer/4480481
https://gist.github.com/springmeyer/4279264
'
git clone http://llvm.org/git/llvm.git
cd llvm/tools
git clone http://llvm.org/git/clang.git
diff --git a/bindings/python/mapnik_generator_grammars.cpp b/bindings/python/mapnik_generator_grammars.cpp
index e621628..f6fa4d1 100644
--- a/bindings/python/mapnik_generator_grammars.cpp
+++ b/bindings/python/mapnik_generator_grammars.cpp
@@ -29,8 +29,8 @@
using sink_type = std::back_insert_iterator<std::string>;
template struct mapnik::json::feature_generator_grammar<sink_type>;
-template struct mapnik::json::geometry_generator_grammar<sink_type>;
-template struct mapnik::json::multi_geometry_generator_grammar<sink_type>;
@springmeyer
springmeyer / asan-results.txt
Created October 7, 2014 23:01
asan node-mapnik results when loading all visual test xml files
ubuntu@ip-10-39-6-15:~/node-mapnik$ asan_symbolize-3.5 / < log | c++filt
==25020==WARNING: Can't read from symbolizer at fd 10
==25020==WARNING: Can't read from symbolizer at fd 10
==25020==WARNING: Can't read from symbolizer at fd 10
==25020==WARNING: Can't read from symbolizer at fd 10
==25020==WARNING: Failed to use and restart external symbolizer!
=================================================================
==25020==ERROR: LeakSanitizer: detected memory leaks
@springmeyer
springmeyer / asan-notes.md
Last active August 29, 2015 14:07
asan notes
  • docs at https://code.google.com/p/address-sanitizer/w/list
  • to be able to get asan working from node, both node.js and mapnik must be build with -fsanitize=address in CXXFLAGS and LDFLAGS. If this is not done you'll hit symbol errors on linux and on mac the program just quits silently
  • to be able to get symbols with clang-3.5 + asan you need to use ./proj 2> log && asan_symbolize-3.5 / < log | c++filt
  • asan seems to work on OS X (with source built clang++) but detects more problems (particularly leaks) on linux (with clang=3.5 from llvm apt packages).
  • turn on everything except leaks export ASAN_OPTIONS=check_initialization_order=1:detect_leaks=0:strict_init_order=1:detect_stack_use_after_return=1:detect_odr_violation=0
  • suppress node.js leaks with echo 'leak:node::Buffer' &gt; supp.txt &amp;&amp; export LSAN_OPTIONS=suppressions=supp.txt
@springmeyer
springmeyer / tilelive-vector
Last active August 29, 2015 14:07
node v0.10.32 + -fsanitize=address + node-mapnik 3.0.1
$ npm test
=================================================================
==21035==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x614000009640
#0 0x5b1f0b in operator delete(void*) (/usr/local/bin/node+0x5b1f0b)
#1 0x1039e8b in node::After(uv_fs_s*) (/usr/local/bin/node+0x1039e8b)
#2 0x10be1ec in uv__work_done /home/ubuntu/node/out/../deps/uv/src/unix/threadpool.c:220:5
#3 0x10b40c3 in uv__async_event /home/ubuntu/node/out/../deps/uv/src/unix/async.c:80:5
#4 0x10b42cb in uv__async_io /home/ubuntu/node/out/../deps/uv/src/unix/async.c:156:3
#5 0x10c0b03 in uv__io_poll /home/ubuntu/node/out/../deps/uv/src/unix/linux-core.c:271:9
#6 0x10b4767 in uv_run /home/ubuntu/node/out/../deps/uv/src/unix/core.c:317:5