Closed F-I-D-O closed 1 year ago
People have been using Osmium on Windows successfully for years and it builds in the CI, so I am not sure why this has not come up before. There must be something different on your system that makes this break. Can you give us some more information on how you built Osmium, how the problem manifested and how you fixed it?
The problem with RapidJSON ist that there hasn't been a release in 6 years or so. Packages are totally out of date. The only good solution is to get rid of RapidJSON alltogether, but that requires some time.
I agree that it is unfortunate that there has been no official release of RapidJSON since 2016. But there are unofficial releases that contain the bugfixes I mention on many package managers (e.g., vcpkg).
I am not sure why this has not come up before
I'm not sure either, but it is a well-known problem not exclusive to rapidjson. Basically, the name getObject
is not safe on Windows.
Can you give us some more information on how you built Osmium, how the problem manifested and how you fixed it?
I used CMake to build the project. The manifestation of the problem is described in the mentioned issue. It is basically a name clash between a macro defined in windows.h
and a function in rapidjson.
My solution to fix it was to modify the osmium-tool so that:
windows.h
are replaced with functions with the equal functionality but different names: those functions are included in the latest unofficial releases of rapidjson. @F-I-D-O Can you try compiling the version in the fix-compile-rapidjson branch I just pushed? I simply removed the one place where we use the GetObject()
function. So this should now compile with any RapidJSON version.
Yes, your solution works, thank you!
Thanks. I merged that code into master.
Hi, When building Osmium on Windows, I encountered the famous GetObject macro problem triggered by the rapidjson dependency. I was able to fix the problem and build Osmium successfully.
Now I wonder where should I share the solution so that others do not fall into the same trap. The solution is kind of radical, and I don't know whether you are interested in Windows builds.
So my question is: should I create a pull request, or should I just post the solution online, maybe link it from the OSM forum?
The solution briefly:
getObject
calls withgetObj