Skip to content
springmeyer edited this page Nov 12, 2014 · 19 revisions

Installation problems

error MSB3428: Could not load the Visual C++ component "VCBuild.exe"

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual

This likely means you need to pass --msvs_version=2013 to npm/node-gyp.

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found

This likely means that a node-mapnik binary built on ubuntu precise + g++ 4.8 needs an upgraded libstdc++ to run on ubuntu precise:

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -q
sudo apt-get install -y libstdc++

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

This likely means that a node-mapnik binary built on ubuntu trusty will only run on ubuntu trusty and above, so the only solution is to upgrade to at least trusty.

dyld: lazy symbol binding failed: Symbol not found:

Users running OS X Mavericks with the latest xcode/clang updates might see an error at startup like:

dyld: lazy symbol binding failed: Symbol not found: __ZN6mapnik15freetype_engine14register_fontsERKSsb
  Referenced from: /Users/tburke/Projects/edge-tile-server/node_modules/mapnik/lib/_mapnik.node
  Expected in: dynamic lookup

dyld: Symbol not found: __ZN6mapnik15freetype_engine14register_fontsERKSsb
  Referenced from: /Users/tburke/Projects/edge-tile-server/node_modules/mapnik/lib/_mapnik.node
  Expected in: dynamic lookup

This can be fixed by upgrading your node-mapnik version or by setting these flags and then re-compiling:

export CXXFLAGS="-mmacosx-version-min=10.9"
export CFLAGS="-mmacosx-version-min=10.9"
export LDFLAGS="-mmacosx-version-min=10.9"

What these do is force the compiler and linker to prefer linking to libc++ instead of libstdc++. Previous to OS X 10.9 OS X would link by default to libstdc++ but starting at Mavericks the new default is libc++. The becomes problematic because all C++ based libraries node-mapnik depends on must link to the same C++ standard library. This error is likely to happen when Mapnik is compiled with default settings (like with homebrew or from source): it will properly respect the operating default behavior and will link to libc++. (you can check this with otool -L /usr/local/lib/libmapnik.dylib). But the problem happens when Node.js enters the mix. Node.js overrides the mmacosx-version-min flag and forces 10.5 (https://github.com/joyent/node/blob/c20b209dbb7e2f3ac8a75a8750bc4205d43952c8/common.gypi#L207) which causes node-mapnik to link to libstdc++. This is not viable. Setting the above flags fixes this by asking node's build system to allow node-mapnik to link against libc++.

ld: internal error: atom not found in symbolIndex

Users running OS X Mavericks with the latest xcode/clang updates might see a linking error like:

ld: warning: option -s is obsolete and being ignored
ld: internal error: atom not found in symbolIndex(__ZN5boost16exception_detail20copy_boost_exceptionEPNS_9exceptionEPKS1_) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/mapnik.node] Error 1

Can be fixed by upgrading your node-mapnik version or manually removing the -s stripping from common.gypi if it exits.

cannot find module 'mapnik

If you see an error like Error: cannot find module 'mapnik' it means one of three possible things:

  • You have not actually installed node-mapnik: run npm install mapnik or run npm install in a directory with a package.json that declares a dependency on mapnik.
  • Mapnik is installed but for some reason (custom node.js configuration) you need to manually ensure that the mapnik folder is in your node_modules or otherwise on your NODE_PATH.

Symbol mapnik_module not found.

If you see an error like:

  Module._extensions[extension](this, filename);
                               ^
Error: Symbol blend_module not found.

Then it indicates you have either forgotten to use the NODE_MODULE macro or the name for your module in the binding.gyp does not match what is used in the NODE_MODULE.

the specified module cannot be found

If you see an error on like:

  Module._extensions[extensions](this,filename)

Error: the specified module cannot be found

This likely means that the module was found but that it cannot be loaded because it is unable to find other dynamic libraries (dlls) it depends upon. This is likely due to a missing C++ runtime and can be fixed by downloading and installing http://www.microsoft.com/en-us/download/details.aspx?id=40784.

A way to figure out which library specifically is missing is to use python's ctypes module to import the node module like:

$ python
>>> import ctypes
>>> ctypes.CDLL('./lib/binding/mapnik.node')

This should prompt an error that should provide more details.

the specified procedure could not be found

If you see an error on like:

  Module._extensions[extensions](this,filename)

Error: the specified procedure could not be found

This means that the module was found but that a symbol/function it references cannot be found, likely because of some stale build.

A way to figure out which module or symbol is missing is to use python's ctypes module to import the node module like:

$ python
>>> import ctypes
>>> ctypes.CDLL('./lib/binding/mapnik.node')

This should prompt an error to pop up in a new graphical window that presents like library symbol name that is missing like:

or:

fatal error: 'unicode/unistr.h' file not found

Hitting an error with node v0.6 or v0.8 like:

In file included from ../src/node_mapnik.cpp:13:
In file included from ../src/mapnik_feature.hpp:9:
In file included from /usr/local/include/mapnik/feature.hpp:28:
/usr/local/include/mapnik/value_types.hpp:27:10: fatal error: 'unicode/unistr.h' file not found
#include <unicode/unistr.h>  // for UnicodeString
         ^
1 error generated.
make: *** [Release/obj.target/_mapnik/src/node_mapnik.o] Error 1

or

In file included from ../src/mapnik_map.cpp:10:
../node_modules/mapnik-vector-tile/src/vector_tile_processor.hpp:27:10: fatal error: 'agg_conv_clip_polygon.h' file not found
#include "agg_conv_clip_polygon.h"
         ^
1 error generated.
make: *** [Release/obj.target/_mapnik/src/mapnik_map.o] Error 1
``

These either mean that critical -I (include) paths are missing from the build or that icu and mapnik are not installed. If you are using older node that contains older node-gyp then the former is the problem and you can work around the issue but doing:

```sh
export CXXFLAGS=`mapnik-config --cflags`
npm install mapnik

mapnik mapnik::hit_grid::base_mask symbol not found

You might see an error like:

module.js:356
  Module._extensions[extension](this, filename);
                               ^
Error: dlopen(/Users/dane/projects/node-mapnik/lib/binding/mapnik.node, 1): Symbol not found: __ZN6mapnik8hit_gridIxE9base_maskE
  Referenced from: /Users/dane/projects/node-mapnik/lib/binding/mapnik.node
  Expected in: flat namespace
 in /Users/dane/projects/node-mapnik/lib/binding/mapnik.node
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/dane/projects/node-mapnik/lib/mapnik.js:18:14)
...

This indicates one of three things:

  1. Your Mapnik was not build with -DGRID_RENDERER so it missing support for rendering utf8grids, which node-mapnik requires.

  2. The node-mapnik build missed critical CXXFLAGS. This can result when mapnik-config --defines reports -DBIGINT but somehow this does not end up in the compile flags either due to an old-buggy node-gyp version or some problem calling mapnik-config from the node-mapnik binding.gyp.

  3. You have duplicate mapnik headers on your path and node-mapnik ended up linking to one but compiling against another.

Symbol not found: HandleScope

dyld: lazy symbol binding failed: Symbol not found: __ZN2v811HandleScopeC1Ev
  Referenced from: /Users/dane/projects/node-mapnik/lib/binding/node-v11-darwin-x64/mapnik.node
  Expected in: flat namespace

This can happen if node was compiled with -fvisibility=hidden which appears not to be supported currently: https://github.com/joyent/node/pull/4274. Note: I've found that -fvisibility=hidden and/or -flto work fine when compiling node-mapnik and node itself: its just that when node is compiled with -fvisibility=hidden then this breaks node-mapnik (and likely all c++ addons).

Runtime crashes

Segfault / Segmentation Fault / EXC_BAD_ACCESS (SIGSEGV)

These indicate a memory error that leads node-mapnik to crash. To find out the exact details of the crash you should find the backtrace or core dump. On OS X this is easy just open up:

open ~/Library/Logs/DiagnosticReports/

You should see some files named like node_<date>-<some number>_d.crash. Open up the latest two or three crash logs created and post them to new gists at https://gist.github.com/. Then create a new node-mapnik issue to share your crashlogs with the developers. A crash like this is bad and should not happen and the developers of node-mapnik really want to hear from you if this happens to ensure it is fixed promptly.

If you have compiled node-mapnik from source and hit a crash like this then you can do an extra valuable thing: build in debug mode. You can do this like:

npm install mapnik --debug

Then try to replicate your crash again. If you can still replicate your crash then the new crash logs created in ~/Library/Logs/DiagnosticReports/ will have more detail for the node-mapnik developers to see. If you can't replicate your crash anymore then that is interesting information as well to share with the developers.

Segfault with node::Exit(v8::Arguments const&) and __cxa_finalize and mapnik::datasource_cache::~datasource_cache() in the backtrace

If you hit a segfault like https://gist.github.com/springmeyer/10383669 it likely means that your program crashed while exiting. One reason this can happen is that you are testing with mocha and using node-mapnik and a test seemingly (to mocha) finishes while Mapnik is still doing work in the threadpool. Mocha may be exiting early because of a bug in your tests or your javascript code whereby you are returning too early from a callback. But this still should not crash! If you are hitting this situation you can likely avoid the crash problem by running mocha with the --no-exit option.

Raster access crashes

If you see ERROR 6: Attempt to call SetGeoTransform() on a read-only GeoTIFF file. it likely means that Mapnik was build incorrectly against GDAL or the Mapnik gdal.input is linked incorrect and can only be fixed by a clean re-install.