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: 3.1.0 -> unstable-2022-04-14 #146039

Closed
wants to merge 2 commits into from

Conversation

erictapen
Copy link
Member

Motivation for this change

Mapnik is currently broken, so I don't see any other choice than to use current master. I also bumped python-mapnik to latest master and fixed the build.

It required some minor patches, that I'm willing to maintain for future releases.

Things done
    mapnik: 3.1.0 -> unstable-2021-11-02
    
    - use CMake. I just didn't got it to work with SCons.
    - patch cmake to find harfbuzz
    - prefetch catch2 for enabling tests
    - add myself as maintainer
    - build mapnik-config with scons, as it isn't build by cmake
    - use python3 exclusively
    - build with harfbuzz-icu
    - change license to lgpl21Plus
    python3Packages.python-mapnik: unstable-2020-02-24 -> unstable-2020-09-08
    
    Also:
    
    - use libxml2 for xml parsing
    - use newest boost
    - patch to find libmapnik{json,wkt}.a
    - fix license
    - add myself as maintainer
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@erictapen erictapen requested a review from jonringer as a code owner November 14, 2021 22:38
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels Nov 14, 2021
@dotlambda
Copy link
Member

Does

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ee2d656c8bc..7026b0da1a8 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18490,7 +18490,14 @@ with pkgs;

   opencl-clang = callPackage ../development/libraries/opencl-clang { };

-  mapnik = callPackage ../development/libraries/mapnik { };
+  mapnik = callPackage ../development/libraries/mapnik {
+    gdal = gdal.override {
+      libgeotiff = libgeotiff.override { proj = proj_7; };
+      libspatialite = libspatialite.override { proj = proj_7; };
+      proj = proj_7;
+    };
+    proj = proj_7;
+  };

   marisa = callPackage ../development/libraries/marisa {};

not do the trick? It might at least lead to problems when using other packages that depend on PROJ 8.

@erictapen
Copy link
Member Author

@dotlambda Mh, sounds like an easy fix. python-mapnik builds with that.

I guess my changes make sense whenever a new mapnik version comes out. Until then I'd try your fix.

@erictapen erictapen marked this pull request as draft November 14, 2021 23:58
@erictapen erictapen mentioned this pull request Nov 15, 2021
12 tasks
- list(APPEND MAPNIK_OPTIONAL_LIBS HarfBuzz::HarfBuzz HarfBuzz::ICU)
-endif()
+pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz)
+list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::harfbuzz)
Copy link

@mathisloge mathisloge Nov 20, 2021

Choose a reason for hiding this comment

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

With mapnik/mapnik#4270 merged, you can pass CMAKE_DISABLE_FIND_PACKAGE_harfbuzz=OFF to the configure call to disable find_packge(harfbuzz) and force pkg-config therefore. So the patch can be removed after that.

See https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure (at the bottom of the section) for more info.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's nice!
Any chance we'd get a new mapnik release anytime soon? Using master in Nixpkgs is usually only done for special cases, e.g. when the last stable release is broken/unsecure.

Choose a reason for hiding this comment

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

Good question. I don't really know which plans @artemp has regarding mapnik 4.0.0. I've just started contributing first things to mapnik like the CMake build and windows support.

Choose a reason for hiding this comment

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

merged. Patch could be removed

@dotlambda
Copy link
Member

dotlambda commented Dec 28, 2021

Does it make sense to apply the python-mapnik bump anyway?
Also #144544 breaks mapnik, so it might make sense to apply the mapnik bump after all.
EDIT: Never mind, the latter was a false positive. See #152448.

@erictapen
Copy link
Member Author

@dotlambda Sure, I'll open a separate PR!

@erictapen
Copy link
Member Author

@dotlambda
Looked a bit into it and unfortunately python-mapnik needs mapnik master. Their include file layout seems to have changed in many places.
Do you need the bump for anything specific?

@dotlambda
Copy link
Member

Do you need the bump for anything specific?

No. Let's just wait for the next official mapnik release.

@vcunat
Copy link
Member

vcunat commented Jul 7, 2022

Perhaps reconsider, in light of PR #180578

@dotlambda
Copy link
Member

Perhaps reconsider, in light of PR #180578

In fact, mapnik's tests fail in #179406, so we need the mapnik upgrade.
I tried applying a60e669 there but mapnik fails to build with

/build/source/benchmark/src/test_png_encoding2.cpp:6:10: error: 'shared_ptr' in namespace 'std' does not name a template type
    6 |     std::shared_ptr<mapnik::image_rgba8> im_;
      |          ^~~~~~~~~~
/build/source/benchmark/src/test_png_encoding2.cpp:3:1: note: 'std::shared_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?
    2 | #include "compare_images.hpp"
  +++ |+#include <memory>
    3 |
/build/source/benchmark/src/test_png_encoding2.cpp: In constructor 'test::test(const mapnik::parameters&)':
/build/source/benchmark/src/test_png_encoding2.cpp:16:9: error: 'im_' was not declared in this scope
   16 |         im_ = std::make_shared<mapnik::image_rgba8>(reader->width(),reader->height());
      |         ^~~
/build/source/benchmark/src/test_png_encoding2.cpp:16:20: error: 'make_shared' is not a member of 'std'
   16 |         im_ = std::make_shared<mapnik::image_rgba8>(reader->width(),reader->height());
      |                    ^~~~~~~~~~~
/build/source/benchmark/src/test_png_encoding2.cpp:16:20: note: 'std::make_shared' is defined in header '<memory>'; did you forget to '#include <memory>'?
/build/source/benchmark/src/test_png_encoding2.cpp:16:51: error: expected primary-expression before '>' token
   16 |         im_ = std::make_shared<mapnik::image_rgba8>(reader->width(),reader->height());
      |                                                   ^
/build/source/benchmark/src/test_png_encoding2.cpp: In member function 'virtual bool test::validate() const':
/build/source/benchmark/src/test_png_encoding2.cpp:23:31: error: 'im_' was not declared in this scope
   23 |         mapnik::save_to_file(*im_,actual, "png8:m=h:z=1");
      |                               ^~~
/build/source/benchmark/src/test_png_encoding2.cpp: In member function 'virtual bool test::operator()() const':
/build/source/benchmark/src/test_png_encoding2.cpp:31:43: error: 'im_' was not declared in this scope
   31 |             out = mapnik::save_to_string(*im_,"png8:m=h:z=1");
      |                                           ^~~
make[2]: *** [benchmark/CMakeFiles/mapnik-benchmark-test_png_encoding2.dir/build.make:76: benchmark/CMakeFiles/mapnik-benchmark-test_png_encoding2.dir/src/test_png_encoding2.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1509: benchmark/CMakeFiles/mapnik-benchmark-test_png_encoding2.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

@vcunat
Copy link
Member

vcunat commented Jul 9, 2022

Well, that sounds easy to fix, as it hints:

note: 'std::shared_ptr' is defined in header '<memory>'; did you forget to '#include <memory>'?

@erictapen erictapen changed the title mapnik: 3.1.0 -> unstable-2021-11-02 mapnik: 3.1.0 -> unstable-2022-04-14 Jul 11, 2022
@erictapen erictapen marked this pull request as ready for review July 11, 2022 17:41
@erictapen
Copy link
Member Author

I just rebased on latest nixpkgs master and bumped to latest mapnik master.

@SuperSandro2000
Copy link
Member

I think we should squash the commits together.

@erictapen
Copy link
Member Author

@SuperSandro2000 I wanted to wait with that until it is mergeable, so the development of the PR remains observable.

@dotlambda
Copy link
Member

I fixed the import by using the same version of PROJ for mapnik and python-mapnik.
Python-mapnik's tests are still failing and I lack the time to fix them.

@erictapen
Copy link
Member Author

@dotlambda This is great news, thanks a lot! I was almost ready to give up, as I'm having a hard time remembering what I did back then.

How about we just disable the tests for now and do it some other time? I'll squash the commits then so this can be reviewed again.

@dotlambda
Copy link
Member

How about we just disable the tests for now and do it some other time? I'll squash the commits then so this can be reviewed again.

Okay, sounds good.

@dotlambda
Copy link
Member

@erictapen Please squash if the changes look good to you. I suggest we move the last two commits to a separate PR targeting staging.

@erictapen
Copy link
Member Author

Just returned from my holidays. I squashed everything and removed your last two commits @dotlambda, I also think a separate PR would be good for them, thx.

# mapnik-config is currently not build with CMake. So we use the SCons for this one.
preBuild = ''
cd ..
${scons}/bin/scons utils/mapnik-config
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
${scons}/bin/scons utils/mapnik-config
scons utils/mapnik-config

Please add scons to nativeBuildInputs

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that breaks the build, as stdenv tries to build everything with scons then. I amended the comment to clarify that.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like the solution, but can't we just merge this and then put these changes on top (via staging)? Seems like a rather unproblematic occurence of non-idiomatic code to me.

Copy link
Member

Choose a reason for hiding this comment

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

We could also use buildPackages.scons and avoid nativeBuildInputs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point about buildPackages, I included that.

Copy link
Member

@dotlambda dotlambda left a comment

Choose a reason for hiding this comment

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

The radioboat commit shouldn't be here.

@erictapen
Copy link
Member Author

@dotlambda Right, don't know how that slipped in.

erictapen and others added 2 commits July 18, 2022 20:23
- use CMake. I just didn't got it to work with SCons.
- patch cmake to find harfbuzz
- prefetch catch2 for enabling tests
- add erictapen as maintainer
- build mapnik-config with scons, as it isn't build by cmake
- use python3 exclusively
- build with harfbuzz-icu
- change license to lgpl21Plus
- use PROJ 8
- use latest scons, but use cmake for everything but mapnik-config
- don't make postgresql optional

Co-Authored-by: Robert Schütz <[email protected]>
…9-08

Also:

- use libxml2 for xml parsing
- use newest boost
- patch to find libmapnik{json,wkt}.a
- fix license
- add erictapen as maintainer
- use same harfbuzz as mapnik
- use pytestCheckHook, disable failing tests

Co-Authored-by: Robert Schütz <[email protected]>
@dotlambda
Copy link
Member

included in #179406

@dotlambda dotlambda closed this Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: python 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants