mapcache icon indicating copy to clipboard operation
mapcache copied to clipboard

mapcache windows build

Open tbonfort opened this issue 14 years ago • 38 comments

Reporter: assefa Date: 2011/12/02 - 18:21 mapcache windows build

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/02 - 18:25 Thomas,

Is it possible to apply the patch and tell me if things still work. I can then commit. The patch is only the first pass to bring the code to build on windows.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Date: 2011/12/02 - 18:33 Assefa, I have applied the patch and all seems correct on my osx build.

I skimmed through the patch, can you confirm that it only moves the variable declarations to the beginning of their code block?

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/02 - 19:01 majority of the change is that. but I also added a bit of things using ifdefs (#ifndef _WIN32) for things that did not build properly on windows (ex buffer.c, ezxml.c, http.c, imageio_png.c) look for any_WIN32 to see them. I think it should be ok but can you give it a quick look at least for buffer.c

tbonfort avatar Mar 29 '12 14:03 tbonfort

Date: 2011/12/02 - 19:15 Assefa, seems good to me, thanks for fixing those, I'll try to be more careful in the future now you windows guys are poking around in the code :)

some of the _WIN32 ifdefs also be applied to the unix builds, but we can do that in a next step.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/02 - 19:23 committed in r 12835. I will start committing the make files. It won't be complete though.

PS: I am an ubuntu guy since FOSS4G :)

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: rouault Date: 2011/12/02 - 20:07 I humbly suggest to turn (trunk/mapserver/mapcache/src/buffer.c) :

#ifndef _WIN32 
    memcpy(buffer->buf + buffer->size, data, len); 
#else 
    memcpy(((unsigned char*)buffer->buf) + buffer->size, data, len); 
#endif

into :

memcpy(((unsigned char*)buffer->buf) + buffer->size, data, len);

(or just (char*))

which should work on all platforms. void* pointer arithmetic compiled with -pedantic raises a warning.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/02 - 23:09 I have done the change in buffer.c according to comment. 65a465ffdd79a53a722df80ab008e7ead57e3742 (r12838)

windows make files committed:

  • build the fcgi
  • seed executable does not yet build: missing time related functions
  • did not try yet the Apache module

Note for Jeff:

  • I used : http://apache.sunsite.ualberta.ca//apr/binaries/win32/
  • http://apr.apache.org/download.cgi to build the modules locally. I started with that but the 2nd module did not build out of the box. I did not make any efforts on building it.
  • You can modify/fix ad you see fit

tbonfort avatar Mar 29 '12 14:03 tbonfort

Date: 2011/12/03 - 09:01 Assefa,

what are the time functions that are failing? All time handling is supposed to be done through apr which should take care of platform idiosyncrasies.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/03 - 14:38 It is not that they are failing, It is just that they are not available on windows:

  • strptime
  • gettimeofday

We need to define them locally as it is done for MapServer-cgi.

The other link problem I had was with:

mapcache_seed.obj : error LNK2019: unresolved external symbol __imp__apr_time_an
si_put@12 referenced in function _main

I am not sure why it was not available in the pre-build binaries I used. Probably need to build a local copy of the apr libraries.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: jmckenna Date: 2011/12/06 - 22:37 I have compiled from source (apr-1.4.5, apr-iconv-1.2.1, apr-util-1.3.12) and I now only get one error when I execute 'nmake /f makefile.vc' for mapcache, but I am not sure which library this function/symbol comes from:

fastcgi_mapcache.obj : error LNK2019: unresolved external symbol __imp__apr_date_parse_http@4 referenced in function _fcgi_write_response
mapcache.exe : fatal error LNK1120: 1 unresolved externals

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/06 - 23:22 It should be in apr-util (source code I see apr-util-1.3.12\misc\apr_date.c(145))

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: jmckenna Date: 2011/12/07 - 00:00 ok thanks, I think I am missing libaprutil-1.lib and it might be causing this.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: jmckenna Date: 2011/12/07 - 00:17 I think I made it past that. 2 new missing symbols:

mapcache_seed.obj : error LNK2019: unresolved external symbol _strptime referenced in fun
tion _main
mapcache_seed.obj : error LNK2019: unresolved external symbol _gettimeofday referenced in
function _main
mapcache_seed.exe : fatal error LNK1120: 2 unresolved externals

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: aboudreault Date: 2011/12/21 - 18:04 I talked with Assefa, and I doubt he'll get time to finish this task. I'm going to try take it. Question: how did you get it to compile ... I'm getting a lot of illegal declaration errors. (due to a declaration not at the beginning of a scope. Didn't find the c99 flag for VC 2010 and VC 2008.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: aboudreault Date: 2011/12/21 - 20:51 nvm about the declaration errors... I think my mapcache directory was not up-to-date.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: jmckenna Date: 2011/12/21 - 23:25 I'm not sure if you are talking to me directly - but I left this since there were 2 missing functions in the mapcache code, not part of MSVC/SDK (see comment:13) I believe there are already workarounds for these in the MS base code, and I talked to Assefa about this also. I have been meaning to dive back in and port those 2 functions over, but, haven't yet :)

Short story: I never did get it to compile.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/22 - 05:09 I have ported locally the code from MS to mapcahe for the 2 functions but did not commit yet. I have not done the module building yet and not sure when I will get to this.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: aboudreault Date: 2011/12/22 - 14:49 Assefa, Please attach a patch of you changes not committed, I would like to try building/porting the mapcache module.

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: jmckenna Date: 2011/12/22 - 15:24 same comment here :)

tbonfort avatar Mar 29 '12 14:03 tbonfort

Author: assefa Date: 2011/12/23 - 17:46 It is committed ( 5e5cde4b5dba9a1e0a3b29ac162b639f107081e4 (r12915) and 809508117c7d611f10b7576c44a7ccb45dcf6cc3 (r12916))

tbonfort avatar Mar 29 '12 14:03 tbonfort