Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Patch to support building of osm2pgsql under mingw32 #926

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 15 comments
Closed

Patch to support building of osm2pgsql under mingw32 #926

openstreetmap-trac opened this issue Jul 23, 2021 · 15 comments

Comments

@openstreetmap-trac
Copy link

Reporter: grand.edgemaster[at]gmail.com
[Submitted to the original trac issue database at 2.55pm, Tuesday, 27th May 2008]

Attached is a patch to sprompt.c to fix a compile error under mingw32/msys.

I'll note that I have no clue about c development, a patch for the Makefile is also required, but is above my level to make it platform-sensitive. I did note that -lz is missing from the LDFLAGS, causing a linker error on mingw.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 8.02pm, Tuesday, 27th May 2008]

Does windows.h really provide termios?!? That seems very unlikely...

One for Jon anyway - he knows more about this code than me.

@openstreetmap-trac
Copy link
Author

Author: grand.edgemaster[at]gmail.com
[Added to the original trac issue at 8.09pm, Tuesday, 27th May 2008]

The code seemed to already have WIN32 measures in place if termios was not available, I've just removed the hard-coded termios define, which appears to work.

@openstreetmap-trac
Copy link
Author

Author: grand.edgemaster[at]gmail.com
[Added to the original trac issue at 9.19pm, Tuesday, 27th May 2008]

My original compile was with pgsql 8.3 and postgis 1.3.3.

Since steve8 had only pgsql 8.2 and an older postgis, I had to recompile.

As requested by kleptog, attached is the patch file for that. Most of the changes to the Makefile are because I used the geos bundled with postgis this time around. There is one change to the headers for geos as well.

@openstreetmap-trac
Copy link
Author

Author: martinvoosterhout
[Added to the original trac issue at 7.13am, Wednesday, 28th May 2008]

(In [7976]) Add some changes from Edgemaster for MinGW support, see #926

@openstreetmap-trac
Copy link
Author

Author: osm[at]kleptog.org
[Added to the original trac issue at 7.43am, Wednesday, 28th May 2008]

I committed the non-makefile changes already, what's not clear to me is how much of the Makefile changes are specific to windows and how much is specific to Edgemaster's installation. Does windows really not have geos-config, for example?

@openstreetmap-trac
Copy link
Author

Author: grand.edgemaster[at]gmail.com
[Added to the original trac issue at 9.12am, Wednesday, 28th May 2008]

Replying to [comment:5 osm[at]kleptog.org]:

I committed the non-makefile changes already, what's not clear to me is how much of the Makefile changes are specific to windows and how much is specific to Edgemaster's installation. Does windows really not have geos-config, for example?

I was too lazy to recompile it all, so just downloaded the headers from the source package and linked against the geos-2 bundled with PostGIS. The compile I had of 1.3 did include geos-config, so this is one of those things you should ignore.

I do reckon that quite a lot of the makefile stuff is just my local build, although I suspect the -lz requirement is a mingw thing?

I'm also not sure about geos.h and geos_c.h, the latter doesn't exist in the 1.2 headers, not sure about the former in 1.3.

@openstreetmap-trac
Copy link
Author

Author: grand.edgemaster[at]gmail.com
[Added to the original trac issue at 9.16am, Wednesday, 28th May 2008]

The -lpthreadGC2 is a Win32 implementation of pthreads (googled for it when the linker complained), not sure if it's required, since I just spotted the -DHAVE_PTHREAD flag.

@openstreetmap-trac
Copy link
Author

Author: tom[at]compton.nu
[Added to the original trac issue at 9.21am, Wednesday, 28th May 2008]

geos.h is correct when you're writing C++ code and linking against libgeos - if you're linking against libgeos_c then you should use geos_c.h

@openstreetmap-trac
Copy link
Author

Author: osm[at]kleptog.org
[Added to the original trac issue at 11.07am, Wednesday, 28th May 2008]

The pthread stuff is new for parallelizing the final index build. It would probably be easier to simply remove the HAVE_PTHREAD, the code will still work. The -lz should have been needed, no idea why the linker doesn't complain.

@openstreetmap-trac
Copy link
Author

Author: grand.edgemaster[at]gmail.com
[Added to the original trac issue at 11.33pm, Friday, 30th May 2008]

Can makefiles contain platform-specific instructions, if not I'll just write a howto up with what to patch in the makefile (and what dependancies are required) to build under mingw.

Feel free to close this if nothing else can be done, the main codebase changes are in, which is probably the most important part.

@openstreetmap-trac
Copy link
Author

Author: osm[at]kleptog.org
[Added to the original trac issue at 9.10am, Saturday, 31st May 2008]

Replying to [comment:10 grand.edgemaster[at]gmail.com]:

Can makefiles contain platform-specific instructions, if not I'll just write a howto up with what to patch in the makefile (and what dependancies are required) to build under mingw.

There are a number of ways to handle this:

  • Makefiles can contains conditionals and file tests, so you can make things conditional on the existance of a file (say /dev/null) which doesn't exist on Windows.
  • You can group the different settings by system and ask people to uncomment the settings relevent for them.

What I was hoping for was Artems patch for VC which AIUI required more work. But given that it now works under MinGW perhaps that isn't important anymore. Especially if the resulting binary can be uploaded somewhere so anyone can use it.

@openstreetmap-trac
Copy link
Author

Author: grand.edgemaster[at]gmail.com
[Added to the original trac issue at 2.14pm, Thursday, 5th June 2008]

It would probably be sensible to revert the change made to applications/utils/export/osm2pgsql/build_geometry.cpp in r7976, it now breaks my build on Debian sid.
I'm guessing the difference in header file was due to differing versions of geos.

@openstreetmap-trac
Copy link
Author

Author: osm[at]kleptog.org
[Added to the original trac issue at 4.04pm, Thursday, 5th June 2008]

Replying to [comment:12 grand.edgemaster[at]gmail.com]:

It would probably be sensible to revert the change made to applications/utils/export/osm2pgsql/build_geometry.cpp in r7976, it now breaks my build on Debian sid.
I'm guessing the difference in header file was due to differing versions of geos.

Please confirm your version of libgeos-dev. 2.2.3-3 is etch has both and 3.0.0 in sid has both. Or do you mean some other kind of error?

@openstreetmap-trac
Copy link
Author

Author: amm
[Added to the original trac issue at 7.38pm, Sunday, 25th September 2011]

As anyone recently tried to compile osm2pgsql on Windows? Does it work? Can this bug be close for outdatedness?

@openstreetmap-trac
Copy link
Author

Author: amm
[Added to the original trac issue at 11.00pm, Saturday, 27th October 2012]

Closing this bug as outdated.

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

No branches or pull requests

1 participant