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

[MAPNIK] new port added #11656

Closed
wants to merge 23 commits into from
Closed

[MAPNIK] new port added #11656

wants to merge 23 commits into from

Conversation

am2222
Copy link
Contributor

@am2222 am2222 commented May 29, 2020

Describe the pull request

  • What does your PR fix? Fixes #
    Adds new port for mapnik [New Port Request] <Mapnik> #7526
  • Which triplets are supported/not supported? Have you updated the CI baseline?
mapnik:arm-uwp=fail
mapnik:x64-uwp=fail

This port has a dependency to the following package
#11652

@NancyLi1013 NancyLi1013 self-assigned this Jun 1, 2020
ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
scripts/ci.baseline.txt Outdated Show resolved Hide resolved
scripts/ci.baseline.txt Outdated Show resolved Hide resolved
@NancyLi1013 NancyLi1013 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Jun 2, 2020
@NancyLi1013
Copy link
Contributor

It seems the review suggestions are not been resolved yet.
Could you please check them again?

@am2222 am2222 marked this pull request as ready for review June 5, 2020 06:05
@am2222
Copy link
Contributor Author

am2222 commented Jun 5, 2020

It seems the review suggestions are not been resolved yet.
Could you please check them again?

Hi @NancyLi1013 , I had addressed them but I did not push them because I was trying to figure out the reason why it fails on x64-windows and Linux but I found out this error for Linux build.
#11780
and on my machine x64-windows builds with no issues but I think here it fails.

@NancyLi1013
Copy link
Contributor

OK. You can push them after you solved the failures. I will try to review this PR again when you have done all work for this PR.

@am2222
Copy link
Contributor Author

am2222 commented Jun 5, 2020

Thanks. I pushed almost all of the changes. however still waiting for the results of the checks for x64-windows and linux.

@NancyLi1013
Copy link
Contributor

@am2222
Could you please resolve the conflicts?

@am2222
Copy link
Contributor Author

am2222 commented Jun 9, 2020

@NancyLi1013 Thanks. I did not notice that conflict. I resolved it. But for some reason it does not pass tests while it builds on my machine for both x64:windows and x86:windows

E:\Personal\SideWorks\vcpkg>vcpkg install mapnik[*] --recurse
Computing installation plan...
The following packages will be built and installed:
    mapnik[CAIRO,DEMO,INPUT_CSV,INPUT_GDAL,INPUT_GEOBUF,INPUT_GEOJSON,INPUT_OGR,INPUT_PGRASTER,INPUT_POSTGIS,INPUT_RASTER,INPUT_SHAPE,INPUT_SQLITE,INPUT_TOPOJSON,PROJ4,UTILS,core]:x86-windows
Warning: abi keys are missing values:
    cairo
    cairomm
    gdal

Starting package 1/1: mapnik:x86-windows
Building package mapnik[CAIRO,DEMO,INPUT_CSV,INPUT_GDAL,INPUT_GEOBUF,INPUT_GEOJSON,INPUT_OGR,INPUT_PGRASTER,INPUT_POSTGIS,INPUT_RASTER,INPUT_SHAPE,INPUT_SQLITE,INPUT_TOPOJSON,PROJ4,UTILS,core]:x86-windows...
-- Using cached E:/Personal/SideWorks/vcpkg/downloads/mapnik-mapnik-v3.0.23.tar.gz
-- Extracting source E:/Personal/SideWorks/vcpkg/downloads/mapnik-mapnik-v3.0.23.tar.gz
-- Applying patch 0001-CMakeFiles.patch
-- Applying patch 0002-sqlitepixelwidth.patch
-- Using source at E:/Personal/SideWorks/vcpkg/buildtrees/mapnik/src/v3.0.23-060d40449d
-- Adding worktree done
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Installing: E:/Personal/SideWorks/vcpkg/packages/mapnik_x86-windows/share/mapnik/copyright
-- Installing: E:/Personal/SideWorks/vcpkg/packages/mapnik_x86-windows/share/mapnik/fonts_copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package mapnik[CAIRO,DEMO,INPUT_CSV,INPUT_GDAL,INPUT_GEOBUF,INPUT_GEOJSON,INPUT_OGR,INPUT_PGRASTER,INPUT_POSTGIS,INPUT_RASTER,INPUT_SHAPE,INPUT_SQLITE,INPUT_TOPOJSON,PROJ4,UTILS,core]:x86-windows... done
Installing package mapnik[CAIRO,DEMO,INPUT_CSV,INPUT_GDAL,INPUT_GEOBUF,INPUT_GEOJSON,INPUT_OGR,INPUT_PGRASTER,INPUT_POSTGIS,INPUT_RASTER,INPUT_SHAPE,INPUT_SQLITE,INPUT_TOPOJSON,PROJ4,UTILS,core]:x86-windows...
Installing package mapnik[CAIRO,DEMO,INPUT_CSV,INPUT_GDAL,INPUT_GEOBUF,INPUT_GEOJSON,INPUT_OGR,INPUT_PGRASTER,INPUT_POSTGIS,INPUT_RASTER,INPUT_SHAPE,INPUT_SQLITE,INPUT_TOPOJSON,PROJ4,UTILS,core]:x86-windows... done
Elapsed time for package mapnik:x86-windows: 26.08 min

Total elapsed time: 26.08 min

ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/CONTROL Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
Copy link
Contributor Author

@am2222 am2222 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments are applied.

@NancyLi1013
Copy link
Contributor

Could you please resolve the conflicts again?

@am2222
Copy link
Contributor Author

am2222 commented Jun 11, 2020

Could you please resolve the conflicts again?

Sure, thanks. I am trying to make a set of patches. I will push it soon. I found the reason why it is breaking on windows tests

@NancyLi1013
Copy link
Contributor

Hi @am2222
Could you please resolve the conflicts?

ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
ports/mapnik/portfile.cmake Outdated Show resolved Hide resolved
@treigilbert
Copy link

treigilbert commented Sep 2, 2020

For x64-windows, vcpkg was giving a command parse error for install mapnik[proj4,input_shape]. I had to change all the input_* features to input-* in the CONTROL and portfile.cmake to allow install mapnik[proj4,input-shape].

For x64-windows using Visual Studio 16.7.5 for vcpkg to compile I had to:
Add #include <algorithm> in src\mapnik\include\mapnik\util\char_array_buffer.hpp
Add #include <string> in src\mapnik\include\mapnik\box2d.hpp

For linking errors from including mapnik headers in my code:
In src\mapnik\include\mapnik\enumeration.hpp disable the #ifdef _MCS_VER at line 278. This might be because I was using /Zc:preprocessor when compiling my code.

@am2222
Copy link
Contributor Author

am2222 commented Sep 2, 2020

For x64-windows, vcpkg was giving a command parse error for install mapnik[proj4,input_shape]. I had to change all the input_* features to input-* in the CONTROL and portfile.cmake to allow install mapnik[proj4,input-shape].

For x64-windows using Visual Studio 16.7.5 for vcpkg to compile I had to:
Add #include <algorithm> in src\mapnik\include\mapnik\util\char_array_buffer.hpp
Add #include <string> in src\mapnik\include\mapnik\box2d.hpp

For linking errors from including mapnik headers in my code:
In src\mapnik\include\mapnik\enumeration.hpp disable the #ifdef _MCS_VER at line 278. This might be because I was using /Zc:preprocessor when compiling my code.

Thanks I will apply the changes you mentioned and will push request again. Thanks

@NancyLi1013
Copy link
Contributor

@am2222
Could you please resolve the conflicts?

@am2222
Copy link
Contributor Author

am2222 commented Sep 10, 2020

@NancyLi1013 I think so far it does not work on the x64_linux,x64_osx,x86_windows,arm_uwp. I think there is an issue with one of the dependencies. Can I have the logs?

@NancyLi1013
Copy link
Contributor

You can get the log here:
https://dev.azure.com/vcpkg/public/_build/results?buildId=42695&view=artifacts&type=publishedArtifacts

@SNiLD
Copy link
Contributor

SNiLD commented Oct 21, 2020

For x64-windows, vcpkg was giving a command parse error for install mapnik[proj4,input_shape]. I had to change all the input_* features to input-* in the CONTROL and portfile.cmake to allow install mapnik[proj4,input-shape].

These changes are (still) needed. I also needed to add boost-msm to the dependencies.

I was building x64-windows with dependencies as static (however gdal, icu, boost-regex, libpq and openssl need to be dynamic).

After those changes the build was successfull though (haven't linked against it yet).

@am2222
Copy link
Contributor Author

am2222 commented Oct 21, 2020

For x64-windows, vcpkg was giving a command parse error for install mapnik[proj4,input_shape]. I had to change all the input_* features to input-* in the CONTROL and portfile.cmake to allow install mapnik[proj4,input-shape].

These changes are (still) needed. I also needed to add boost-msm to the dependencies.

I was building x64-windows with dependencies as static (however gdal, icu, boost-regex, libpq and openssl need to be dynamic).

After those changes the build was successfull though (haven't linked against it yet).

Are you working with latest version of mapnik? Since I could not make it work with the latest version

@SNiLD
Copy link
Contributor

SNiLD commented Oct 22, 2020

Are you working with latest version of mapnik? Since I could not make it work with the latest version

I'm using the version you have used in this pull request i.e.:

set(GIT_URL "https://github.com/am2222/mapnik-windows.git")
set(GIT_REV "cfa268fa6ab438568b9b5320f6fce4317f0e3d8e")

@am2222
Copy link
Contributor Author

am2222 commented Oct 22, 2020

@SNiLD Can you please let me know what other changes did you made that it worked? It works on my local machine but breaks here

@SNiLD
Copy link
Contributor

SNiLD commented Oct 23, 2020

Well first of all I compiled with Visual Studio 2017 Express Edition in x64 mode (from command prompt started with C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\vcvarsall.bat x86_x64).

I used following triplet (named x64-windows-mapnik):

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
if(PORT MATCHES "mapnik|gdal|icu|boost-regex|libpq|openssl")
    set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()

The build command I used was: vcpkg install mapnik[input-csv,input-gdal,input-geobuf,input-geojson,input-ogr,input-pgraster,input-postgis,input-raster,input-shape,input-sqlite,input-topojson,proj4] --triplet=x64-windows-mapnik

I didn't need to do other changes than mentioned in my other post.

@SNiLD
Copy link
Contributor

SNiLD commented Oct 30, 2020

Now that I tried to use mapnik I faced couple of problems with this build. First you need to apply mapbox/variant#182 and mapnik/mapnik#4184 to fix MIN/MAX macro incompatibility with Visual Studio.

I also needed to fix following things:

  • dependency headers were not installed
  • .lib file was not installed for dynamic build

I can't provide you a pull request because Github doesn't support me to have fork of fork when I already have fork of the main project. 💯
So here is a diff what I needed to add to your CMakeLists.txt:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e6f4049c..d6c393c51 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,8 @@ set(mapnik_include_paths
     deps/mapbox/polylabel/include
     deps/mapbox/variant/include)
 
-
+install(DIRECTORY deps/agg/include/ DESTINATION include CONFIGURATIONS Release)
+install(DIRECTORY deps/mapbox/geometry/include/ DESTINATION include CONFIGURATIONS Release)
 
 include_directories(${mapnik_include_paths}  ${thirdparty_include_paths})
 
@@ -175,7 +176,7 @@ if (MAPNIK_STATIC_LIB)
 else ()
     message(STATUS "Building shared library")
     add_library(mapnik SHARED ${MAPNIK_SOURCES} ${MAPNIK_AGG_SOURCES} ${AGG_SOURCES})
-    target_compile_definitions(mapnik PRIVATE  -DMAPNIK_EXPORTS)
+    set_target_properties(mapnik PROPERTIES DEFINE_SYMBOL MAPNIK_EXPORTS)
     set(MAPNIK_LIB_DEFINITION )
 endif ()
 
@@ -201,9 +202,7 @@ target_link_libraries(mapnik PUBLIC
 #        )
 
 
-install(TARGETS mapnik
-    LIBRARY DESTINATION lib
-    RUNTIME DESTINATION bin)
+install(TARGETS mapnik)
 
 add_subdirectory(src/json)
 add_subdirectory(src/wkt)

Btw. I have made CMake support for mapnik long time ago based on their SCons scripts (version 3.0.11). Maybe those could help you as well: https://github.com/SNiLD/mapnik/tree/cmake

@am2222
Copy link
Contributor Author

am2222 commented Oct 30, 2020

@SNiLD Thanks for the information, I am currently doing my comp exam until mid Dec, I will try to fix them then,
thanks so much,

@mathisloge mathisloge mentioned this pull request Nov 18, 2020
2 tasks
@NancyLi1013
Copy link
Contributor

@am2222

Is work still being done for the PR? I noticed that mapnik was also added in another PR #14628.

@am2222
Copy link
Contributor Author

am2222 commented Dec 4, 2020

Hi @NancyLi1013 , I could not manage to fix the issues with it yet. I had to take my comp exam and could not spend much time on it. I am not sure if the other PR has solved it or not. If yes we can use it, However I will update the forked mapnik repo with the latest mapnik version

@mathisloge
Copy link
Contributor

@am2222 yes, I have resolved the issues.
There is now a PR @ mapnik for the cmake build mapnik/mapnik#4191

Additionally mapbox/geometry and mapbox/polylabel were added to vcpkg to not to fetch the contents in the port

@am2222
Copy link
Contributor Author

am2222 commented Dec 10, 2020

@mathisloge Hi, That is great, so it seems we will finally have it on windows and its nodejs package will also work. that is perfect, probably we need also port its python package as well

@mathisloge
Copy link
Contributor

@am2222 that's right. But unfortunately I don't have any spare time to do the node build.

But it might be easy with https://github.com/cmake-js/cmake-js

@NancyLi1013
Copy link
Contributor

@am2222
Thanks for the PR. I'm closing this for now since there's been no progress for a long time. If you'd like to continue working on it, please reopen and ping us!

@NancyLi1013 NancyLi1013 closed this Feb 8, 2021
@mathisloge
Copy link
Contributor

@am2222 if you still using node-mapnik I've added a proof of work mapnik/node-mapnik#976

@am2222
Copy link
Contributor Author

am2222 commented Jul 2, 2021

@mathisloge Thanks, are you using the github repo of mapnik for building it? if we can fix this port it will be perfect.

@mathisloge
Copy link
Contributor

@am2222
#14628 in conjunction with mapnik/mapnik#4191 are working pretty well.

@mathisloge
Copy link
Contributor

@am2222 the cmake support is now merged into mapnik@master.

@am2222
Copy link
Contributor Author

am2222 commented Aug 31, 2021

@mathisloge thanks man, That is a great new. We finally are able to have windows version alive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants