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

libxml2 capability #2139

Merged
merged 12 commits into from
Nov 4, 2021
Merged

libxml2 capability #2139

merged 12 commits into from
Nov 4, 2021

Conversation

WardF
Copy link
Member

@WardF WardF commented Nov 3, 2021

This PR contains #2135 plus fenceposting options for cmake and configure, -DENABLE_LIBXML2 or --enable/disable-libxml2.

DennisHeimbigner and others added 7 commits November 1, 2021 22:37
re: Unidata#2119

H/T to [Egbert Eich](https://github.com/e4t) and [Bas Couwenberg](https://github.com/sebastic) for this PR.

It is undesirable to make netcdf be dependent on the availability
of libxml2, but it is desirable to allow its use if available.

In order to do this, a wrapper API (include/ncxml.h) was constructed
that supports either ezxml or libxml2 as the implementation.
Additionally, the xml support code was moved to a new directory
netcdf-c/libncxml.

Primary changes:
* Create a new sub-directory named netcdf-c/libncxml to hold all the xml implementation code.
* Move ezxml.c and ezxml.h to libncxml
* Create a wrapper API -- include/ncxml.h
* Create an implementation, ncxml_ezxml.c to support use of ezxml.
* Create an implementation, ncxml_xml2.c to support use of libxml2.
* Add a check for libxml2 in configure.ac and CMakeLists.txt
* Modify libdap to use the wrapper API instead of ezxml directly.

Misc. Other Changes:
* Change include/netcdf_json.h from built source to be part of the distribution.
@WardF
Copy link
Member Author

WardF commented Nov 4, 2021

Encountering an error on OSX where a couple of additional "legacy" includes need to be included in addition to unistd.h in order for the read() function in ezxml.c to work. I've also encountered an issue in ncbytes[*]() function; gcc reports mismatch type errors, because size_t != unsigned long on ARM 32 bit. Looking at that as well.

@DennisHeimbigner
Copy link
Collaborator

If you make changes to ezxml.c, see if those changes can be codified
in the rebuild task near the bottom of libncxml/Makefile.am

@WardF
Copy link
Member Author

WardF commented Nov 4, 2021

@DennisHeimbigner Will do, thanks!

@WardF WardF merged commit 7dc355a into Unidata:main Nov 4, 2021
@WardF WardF deleted the gh2135.wif branch November 4, 2021 20:47
@e4t
Copy link
Contributor

e4t commented Nov 8, 2021

If you make changes to ezxml.c, see if those changes can be codified in the rebuild task near the bottom of libncxml/Makefile.am

I wonder how relevant this still is today: The 'upstream' tarball has last been updated in June 2006. Meanwhile, the code here has picked up a number of security patches. While the upstream project is seeing a surprising number of downloads, nobody seems to feel inclined to pick it up.

@DennisHeimbigner
Copy link
Collaborator

I noticed that the amazon s3 sdk uses tinyxml, so I am going to infestigate that as a replacement.

DennisHeimbigner added a commit to DennisHeimbigner/netcdf-c that referenced this pull request Dec 23, 2021
re: PR Unidata#2139
re: PR Unidata#2169
re: PR Unidata#2146
re: Issue Unidata#2119

Found the product tinyxml2 at https://github.com/leethomason/tinyxml2.git
and replaced ezxml with it. Tinyxml2 is about twice the LOC of ezxml,
but at least is it still being maintained, and I can use it out of the box.
It is C++ rather than C, but we seem to have reached the point that we can
include C++ code with only minor compile flag changes. Untested on Mac OS.
Added instructions to the end of libncxml/Makefile.am on how to upgrade
to a later version of tinyxml2.

This PR obsoletes the use of ezxml (re PRs Unidata#2146 and https://github.com/Unidata/netcdf-c/issue/2119).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants