mapcache icon indicating copy to clipboard operation
mapcache copied to clipboard

1.6.0 cmake fails with error: 'mapcache_source' has no member named 'render_map'

Open anantjagania opened this issue 7 years ago • 7 comments

During cmake on mapcahce 1.6.0 it fails for two members of mapcache_source struct.

The mapcache_source struct has _render_map and _query_info memebrs in mapcache.h but in lib/source_mapserver.c line 250 does assignment to a member called "render_map" on mapcache_source. Note that its missing underscore "_" prefix on "render_map" and fails to compile.

anantjagania avatar Jun 07 '17 19:06 anantjagania

I aso get build errors when building with the flag -DWITH_MAPSERVER=1 and Mapserver-7.0.5:

cmake .. -DWITH_MAPSERVER=1
make
[ 97%] /tmp/mapcache-1.6.0/lib/source_mapserver.c: In function ‘mapcache_source_mapserver_create’:
/tmp/mapcache-1.6.0/lib/source_mapserver.c:250:17: error: ‘mapcache_source’ has no member named ‘render_map’
   source->source.render_map = _mapcache_source_mapserver_render_map;
                 ^
/tmp/mapcache-1.6.0/lib/source_mapserver.c:252:42: warning: assignment from incompatible pointer type
   source->source.configuration_parse_xml = _mapcache_source_mapserver_configuration_parse_xml;
                                          ^
/tmp/mapcache-1.6.0/lib/source_mapserver.c:253:17: error: ‘mapcache_source’ has no member named ‘query_info’
   source->source.query_info = _mapcache_source_mapserver_query;
                 ^
Building C object CMakeFiles/mapcache.dir/lib/cache_bdb.c.o
CMakeFiles/mapcache.dir/build.make:928: recipe for target 'CMakeFiles/mapcache.dir/lib/source_mapserver.c.o' failed
make[2]: *** [CMakeFiles/mapcache.dir/lib/source_mapserver.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/mapcache.dir/all' failed
make[1]: *** [CMakeFiles/mapcache.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

I can get past the build errors via the patch

cat mapcache-1.6.0.patch
--- lib/source_mapserver.c.orig 2017-08-11 15:26:36.198967676 +0000
+++ lib/source_mapserver.c      2017-08-11 15:26:38.437296184 +0000
@@ -247,10 +247,10 @@
   }
   mapcache_source_init(ctx, &(source->source));
   source->source.type = MAPCACHE_SOURCE_MAPSERVER;
-  source->source.render_map = _mapcache_source_mapserver_render_map;
+  source->source._render_map = _mapcache_source_mapserver_render_map;
   source->source.configuration_check = _mapcache_source_mapserver_configuration_check;
   source->source.configuration_parse_xml = _mapcache_source_mapserver_configuration_parse_xml;
-  source->source.query_info = _mapcache_source_mapserver_query;
+  source->source._query_info = _mapcache_source_mapserver_query;
   return (mapcache_source*)source;
 }
 #else

However, I get a seg fault when my mapcache-config.xml contains

  <source name="raster_layer" type="mapserver">
    <mapfile>/data/mapcache_test.map</mapfile>
  </source>

I do see that libmapserver.so support is reported as experimental. For anyone who has used it in the past, what sort of performance benefit can one expect?

pedros007 avatar Aug 14 '17 14:08 pedros007

Digging through the mapserver-dev mailing list, I am under the impression that MapCache reading directly from a Mapfile is quite experimental indeed and possibly deprecated several years ago around the time of RFC 71. Perhaps config option -DWITH_MAPSERVER=1 and source_mapserver.c should be removed with documentation updated accordingly?

Edit: #126 notes the unsupported nature of this, but Thomas will accept a PR to fix.

pedros007 avatar Aug 15 '17 17:08 pedros007

i concur with assessment. I don't know that I'd remove the source code but updating the cmake configuration to hide that option and the docs would make sense. Unless there's a pull request coming! I think basically what that module was doing was embedding some of the functionality found in the MapServer CGI directly in MapCache. Performance should be better particularly with metatile generation since the image is doesn't have to be created, encoded, sent over the wire and decoded.

I wouldn't mind helping to fix if there were interested parties...

Steve

sdlime avatar Aug 15 '17 22:08 sdlime

@jbo-ads, this one probably your anointing as Mr. MapCache...

sdlime avatar Nov 08 '19 21:11 sdlime

I came across this option reading all the CMAKE options and trying to compile MapCache with MapServer. I don't understand why they are not compatible between them and also the lack of interest in support Nginx, sadly in the stack I'm working on, the only way to improve the speed of the cache is upgrade to HTTP2 with Apache as Nginx is still experimental after so many years and Apache is not really the best HTTP2 client to use.

BTW I agree with the point to remove it from the documentation if you cannot even compile it.

sebalaini avatar Nov 08 '19 23:11 sebalaini

+1 for removing the possibility to configure Mapcache with mapfile that has been a theoretical option for a long time because it does not compile.

IMHO similar option did not work especially well with TinyOWS because editing the mapfile for Mapserver could easily break TinyOWS. In theory it would be easier for the admin to maintain one mapfile that serves both Mapserver and TinyOWS (or MapCache) but in real life the effect was the opposite: it was harder to maintain one multi-purpose mapfile than two separate configurations. Probably the would still need some configuration options which are not supported by mapfile and as a result there would be a split configuration: partly through the mapfile and partly through the in mapcache.xml.

jratike80 avatar Nov 11 '19 09:11 jratike80

If everybody agrees, I can remove the compilation option from CMake and references to it in documentation. I can delete the source file as well since Git keeps an archive anyway.

Unfortunately I have not enough time to work the other way, i.e. make this interesting feature work.

jbo-ads avatar Nov 18 '19 09:11 jbo-ads