Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can mapnik3.0 be installed on a Windows system? #4062

Closed
gisgirlone opened this issue May 27, 2019 · 36 comments
Closed

Can mapnik3.0 be installed on a Windows system? #4062

gisgirlone opened this issue May 27, 2019 · 36 comments

Comments

@gisgirlone
Copy link

No description provided.

@millapet
Copy link

millapet commented Jun 10, 2019

Windows binaries are no longer suppported, as per mapnik/node-mapnik/issues/848 . I did make mapnik work after that by creating a VS solution by hand, it was however a pain (to put it mildly). This was of course more a one-time thing rather than a sustainable approach.

Edit: I have just noticed #4056 where there is a link to a CMake build which can be used with Visual Studio, but have not tried it yet.

@pedro-vicente
Copy link

yes, this fork

https://github.com/pedro-vicente/mapnik

has a CMake build for the 3.0 and 2.3 branches with the minimum dependencies

the 2.3 branch builds without errors and runs a test program with the OSM plugin
the 3.0 branch has some compiling errors, with Visual Studio 2019

I'll post those errors here later

@pedro-vicente
Copy link

here are the 3.0 errors

L:\mapnik\include\mapnik/feature.hpp(108,14): error C2664: 'mapnik::geometry::geometry::geometry(const mapnik::geometry::geometry &)': cannot convert argument 1 from 'mapnik::geometry::geometry_empty' to 'mapbox::util::no_init'

code

feature_impl(context_ptr const& ctx, mapnik::value_integer _id)
        : id_(_id),
        ctx_(ctx),
        data_(ctx_->mapping_.size()),
        geom_(geometry::geometry_empty()),
        raster_() {}

@pedro-vicente
Copy link

L:\mapnik\include\mapnik/geometry/reprojection_impl.hpp(171,1): error C2440: 'return': cannot convert from 'mapnik::geometry::geometry_empty' to 'mapnik::geometry::geometry'

code

geometry<T> operator() (geometry_empty) const
    {
        return geometry_empty();
    }

@pedro-vicente
Copy link

mapnik\src\wkb.cpp(124,1): error C2440: 'initializing': cannot convert from 'mapnik::geometry::geometry_empty' to 'mapnik::geometry::geometry'

mapnik::geometry::geometry<double> geom = mapnik::geometry::geometry_empty();

@pedro-vicente
Copy link

L:\mapnik\src\wkb.cpp(132,1): error C2679: binary '=': no operator found which takes a right-hand operand of type 'mapbox::geometry::point' (or there is no acceptable conversion)

auto pt = read_point();
 if (!std::isnan(pt.x) && !std::isnan(pt.y))
      geom = std::move(pt);

@pedro-vicente
Copy link

L:\mapnik\src\wkb.cpp(136,1): error C2679: binary '=': no operator found which takes a right-hand operand of type 'mapbox::geometry::line_string<double,std::vector>' (or there is no acceptable conversion)


case wkbLineString:
            geom = read_linestring();

@pedro-vicente
Copy link

pedro-vicente commented Jun 11, 2019

L:\mapnik\src\wkb.cpp(139,1): error C2679: binary '=': no operator found which takes a right-hand operand of type 'mapbox::geometry::polygon<double,std::vector>' (or there is no acceptable conversion)

case wkbPolygon:
            geom = read_polygon();

@pedro-vicente
Copy link

pedro-vicente commented Jun 11, 2019

L:\mapnik\src\wkb.cpp(145,1): error C2679: binary '=': no operator found which takes a right-hand operand of type 'mapbox::geometry::multi_line_string<double,std::vector>' (or there is no acceptable conversion)

 case wkbMultiLineString:
            geom = read_multilinestring();

@pedro-vicente
Copy link

L:\mapnik\src\wkb.cpp(151,1): error C2679: binary '=': no operator found which takes a right-hand operand of type 'mapnik::geometry::geometry_collection<double,std::vector>' (or there is no acceptable conversion)

case wkbGeometryCollection:
            geom = read_collection();

@pedro-vicente
Copy link

L:\mapnik\src\twkb.cpp(84,1): error C2440: 'initializing': cannot convert from 'mapnik::geometry::geometry_empty' to 'mapnik::geometry::geometry'

mapnik::geometry::geometry<double> geom = mapnik::geometry::geometry_empty();

@pedro-vicente
Copy link

pedro-vicente commented Jun 11, 2019

for the 3.0 branch, this is the CMake script used, not complete regarding list of source files

https://github.com/pedro-vicente/mapnik/blob/master/CMakeLists.txt

list of dependencies can be built with

https://github.com/pedro-vicente/mapnik/blob/master/build/bld.bat

https://github.com/pedro-vicente/mapnik/blob/master/build/dep.bat

@pedro-vicente
Copy link

for the 2.3 branch , this is a complete CMake script that builds the demo

https://github.com/pedro-vicente/mapnik/blob/2.3.x/CMakeLists.txt

there was only a small change in code needed

https://github.com/pedro-vicente/mapnik/commit/82c6e6c7f7b7c0d049964195282b03e8743e2d62

@am2222
Copy link

am2222 commented Jun 13, 2019

@pedro-vicente Wow that is great, Is it possible to give some more information about compiling on windows? does it work with MSVC 2015 build tools?

@pedro-vicente
Copy link

@am2222 The above that's basically all the information needed to get started:

  1. get dependencies and build, example script to build

https://github.com/pedro-vicente/mapnik/blob/master/build/dep.bat

  1. Use Cmake to build, example build script bld.bat
mkdir build
cd build
bld.bat

https://github.com/pedro-vicente/mapnik/blob/master/build/bld.bat

with MSVC 2015, there are more building errors. I recently switched to MSVC 2019 from MSVC 2015, very happy about it

@am2222
Copy link

am2222 commented Jun 13, 2019

@pedro-vicente wow thanks,
Have you tried to install python-mapnik on windows?

@am2222
Copy link

am2222 commented Jun 14, 2019

@pedro-vicente Can you tell me which dependencies should I download?
I downloaded boost 1.70.1 and Installed that. For ICU I downloaded ICU-4c-64_2 but It faces errors while Installation, I am also using MSVC 2019

@roelandschoukens
Copy link

I have downloaded (and built — slow process) all dependencies with vcpkg.

There’s a few errors with Visual Studio 2015 but they are reasonably easy to solve. I’ve got the main library and most input plug-ins: https://github.com/roelandschoukens/mapnik/tree/mapnik-win

@am2222
Copy link

am2222 commented Jul 25, 2019

@roelandschoukens Hi, thanks I will try to use vcpkg to see how things goes. thanks

@am2222
Copy link

am2222 commented Jul 25, 2019

@roelandschoukens have you tired to install python wrapper for mapnik as well?

@roelandschoukens
Copy link

I tried but that wrapper doesn't appear to be maintained anymore. It cannot be built with the current version of Mapnik.

@am2222
Copy link

am2222 commented Jul 26, 2019

@roelandschoukens thanks so much, It seems python is lacking a good map rendering engine

@roelandschoukens
Copy link

okay, I could fix the errors and now have a working python package. See my python-mapnik fork.

This requires the static library build. I cannot get all exported symbols working on Visual Studio (the problematic ones are static class members).

You must also set up a working mapnik-config program. I don't know how to do that automatically. After finishing the Mapnik build you can get the flags and libraries names you need from the generated Visual Project file.

Some input plugins have DLL dependencies (eg. gdal requires gdal204.dll). These DLLs have to be available via %PATH% when starting python.

@am2222
Copy link

am2222 commented Jul 27, 2019

@roelandschoukens wow thanks so much it is great to hear that. It was for a while that I was looking for it. About mapnik itself, You built is same as on linux? or you added it into visual studio and build it?

@roelandschoukens
Copy link

I’m building the mapnik library using CMake, and the python package using setup.py.

@am2222
Copy link

am2222 commented Jul 28, 2019

@roelandschoukens thanks so much, I am trying to install dependencies. so far to install libwebp vcpkg can not find opengl32.lib in my sdk folder. I am still looking for it's solution.

@roelandschoukens
Copy link

If you don't need webp image format support you can build mapnik without support for it. I haven't implemented an option in the CMake build for that. I guess you have to remove the -DHAVE_WEBP definition.

@am2222
Copy link

am2222 commented Jul 29, 2019

@roelandschoukens thanks for your help, Actually I was gonna to build it without that format, But interesting part is that I managed to install it using vcpkg but it can not find it.

@am2222
Copy link

am2222 commented Jul 30, 2019

@roelandschoukens thanks, I managed to start build mapnik but I faced C2664 errors:

mapnik-win\mapnik\include\mapnik/feature.hpp(108,14): error C2664:  'mapnik::geometry::geometry<d
ouble>::geometry(const mapnik::geometry::geometry<double> &)': cannot convert argument 1 from 'mapnik::geometry::geomet
ry_empty' to 'mapbox::util::no_init' (compiling source file mapnik-win\mapnik\src\datasource_cach
e.cpp) [mapnik-win\mapnik\build\mapnik.vcxproj]
mapnik-win\mapnik\include\mapnik/feature.hpp(108,14): error C2664:  'mapnik::geometry::geometry<d
ouble>::geometry(const mapnik::geometry::geometry<double> &)': cannot convert argument 1 from 'mapnik::geometry::geomet
ry_empty' to 'mapbox::util::no_init' (compiling source file mapnik-win\mapnik\src\feature_style_p
rocessor.cpp) [mapnik-win\mapnik\build\mapnik.vcxproj]
mapnik-win\mapnik\include\mapnik/feature.hpp(108,14): error C2664:  'mapnik::geometry::geometry<d
ouble>::geometry(const mapnik::geometry::geometry<double> &)': cannot convert argument 1 from 'mapnik::geometry::geomet
ry_empty' to 'mapbox::util::no_init' (compiling source file mapnik-win\mapnik\src\json\generic_js
on_grammar_x3.cpp) [mapnik-win\mapnik\build\src\json\mapnik-json.vcxproj]

and some c2679

mapnik-win\mapnik\src\wkb.cpp(145,1): error C2679:  binary '=': no operator found which takes a r
ight-hand operand of type 'mapbox::geometry::multi_line_string<double,std::vector>' (or there is no acceptable conversi
on) [mapnik-win\mapnik\build\mapnik.vcxproj]

Where am I doing something wrong?

@am2222
Copy link

am2222 commented Aug 3, 2019

@roelandschoukens which boost version have you installed? I just found that mapnik is not compatible with boost 1.70 probably the errors which I have faced is due to this issue.

@bipbip1
Copy link

bipbip1 commented May 8, 2020

Hello,
i also try to compile mapnik on window and expect to be able to bind the result with python3. I am a very beginner in this field and started by cloning the mapnik-windows repositery.
Then i ran vcpkg install boost-locale[icu] boost-regex[icu] boost --triplet x64-windows --recurse (which seems to have been succesfull)
And now i am lost. Should i run configure ? When i try scons do not find the c++ compiler even if visual studio 2019 is installed.
Could someone give me an indication about the path to follow ? In advance thank you.

@mathisloge
Copy link
Collaborator

@artemp this can be closed since windows is now supported to be build with cmake.

For anyone coming across this issue, see https://github.com/mapnik/mapnik/blob/master/docs/cmake-usage.md for more information. As long as the vcpkg.json manifsest file isn't in the source tree, a vcpkg.json file can be found here: https://github.com/mapnik/mapnik/blob/cd21256b6b308aad7e8d28b33da150fcec10b585/vcpkg.json

@artemp artemp closed this as completed Jan 21, 2022
@bartoli
Copy link

bartoli commented Mar 20, 2024

@pedro-vicente would you happen to still have a clone of your fork with cmake support?

@mathisloge
Copy link
Collaborator

You can compile mapnik@master with cmake.

@bartoli
Copy link

bartoli commented Mar 20, 2024

You can compile mapnik@master with cmake.

Yes, but i needed some cmake scripts that would work for 3.0.x, so wanted to start from an older version

@pedro-vicente
Copy link

@pedro-vicente would you happen to still have a clone of your fork with cmake support?

I don't , sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants