Skip to content
Dane Springmeyer edited this page Apr 10, 2014 · 19 revisions

Installation problems

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 it depends upon.

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 nice 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/_mapnik.node')

This should prompt and error to pop up in a new graphical window that presents like library 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 two things: either the node-mapnik build missed critical CXXFLAGS or you have duplicate mapnik headers on your path and node-mapnik ended up linking to one but compiling against another. The former is the most likely problem and can result from when mapnik-config --defines reports -DBIGINT but somehow this did not end up in the compile flags when node-mapnik was built, either due to an old-buggy node-gyp version or some problem calling mapnik-config from the node-mapnik binding.gyp.

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.

Clone this wiki locally