node-mapnik icon indicating copy to clipboard operation
node-mapnik copied to clipboard

Fails to build on Debian sid/unstable

Open StyXman opened this issue 1 year ago • 1 comments

I was tracking down this error:

https://github.com/OSGeo/gdal/issues/11786

That led me to try to build node-mapnik with npm, but got:

npm ERR! /bin/sh: 1: mapnik-config: not found
npm ERR! gyp: Call to 'mapnik-config --cflags' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error

Debian sid/unstable does not have the mapnik-config binary, but pkg-config should be used instead. For more information, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095136

StyXman avatar Feb 05 '25 13:02 StyXman

@StyXman - thanks for reporting.

Preferred way to install node-mapnik -

npm install @mapnik/mapnik   

The command above will install both

  • latest @mapnik/[email protected]
  • and platform specific @mapnik/core-[platform]-[arch]@4.0.5

(tested on Debian GNU/Linux trixie/sid aarch64)

If your platform-arch is not supported, you can also build mapnik from source using scons toolkit which will create requiredmapnik-config. Then build node-mapnik with npm install --build-from-source

If you want to use Debian sid/unstable libmapnik-dev you have a few options (not tested!)

  1. Fix CMake build to output well-formed mapnik-config instead of pkg-config
  2. Create and populate mapnik-config manually with required values.
  3. Make node-mapnik to use pkg-config instead of mapnik-config. This would require adding some missing options to libmapnik.pc to match mapnik-config

grep -rn 'mapnik-config' binding.gyp  scripts  
binding.gyp:74:          'MAPNIK_GIT_REVISION="<!@(mapnik-config --git-describe)"',
binding.gyp:90:              '<!@(mapnik-config --includes)',
binding.gyp:91:              '<!@(mapnik-config --dep-includes)'
binding.gyp:93:            'defines': ['NOMINMAX','<!@(mapnik-config --defines)'],
binding.gyp:96:              '<!@(mapnik-config --libs)',
binding.gyp:99:              '<!@(mapnik-config --dep-libs)',
binding.gyp:105:                  '<!@(mapnik-config --ldflags)'
binding.gyp:113:              '<!@(mapnik-config --cflags)',
binding.gyp:116:              '<!@(mapnik-config --libs)',
binding.gyp:119:              '<!@(mapnik-config --ldflags)',
binding.gyp:120:              '<!@(mapnik-config --dep-libs)'
binding.gyp:129:                '<!@(mapnik-config --cflags)',
binding.gyp:132:                '<!@(mapnik-config --cflags)'
scripts/postinstall.sh:13:    'fonts':         '$(mapnik-config --fonts)',
scripts/postinstall.sh:14:    'input_plugins': '$(mapnik-config --input-plugins)',
scripts/postinstall.sh:19:    'ICU_DATA':      '$(mapnik-config --icu-data)',
scripts/postinstall.sh:20:    'GDAL_DATA':     '$(mapnik-config --gdal-data)',
scripts/postinstall.sh:21:    'PROJ_LIB':      '$(mapnik-config --proj-lib)'
scripts/postinstall.sh:25:    ln -sf $(mapnik-config --prefix)/bin .
scripts/postinstall.sh:26:    ln -sf $(mapnik-config --prefix)/lib .
scripts/preinstall.sh:23:    MAPNIK_VERSION=$(mapnik-config -v)

HTH

artemp avatar Feb 05 '25 14:02 artemp