{"action":"created","issue":{"url":"https://api.github.com/repos/rubys/nokogumbo/issues/71","repository_url":"https://api.github.com/repos/rubys/nokogumbo","labels_url":"https://api.github.com/repos/rubys/nokogumbo/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/rubys/nokogumbo/issues/71/comments","events_url":"https://api.github.com/repos/rubys/nokogumbo/issues/71/events","html_url":"https://github.com/rubys/nokogumbo/issues/71","id":350720180,"node_id":"MDU6SXNzdWUzNTA3MjAxODA=","number":71,"title":"Matching libxml2 headers with nokogiri","user":{"login":"stevecheckoway","id":1239089,"node_id":"MDQ6VXNlcjEyMzkwODk=","avatar_url":"https://avatars0.githubusercontent.com/u/1239089?v=4","gravatar_id":"","url":"https://api.github.com/users/stevecheckoway","html_url":"https://github.com/stevecheckoway","followers_url":"https://api.github.com/users/stevecheckoway/followers","following_url":"https://api.github.com/users/stevecheckoway/following{/other_user}","gists_url":"https://api.github.com/users/stevecheckoway/gists{/gist_id}","starred_url":"https://api.github.com/users/stevecheckoway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevecheckoway/subscriptions","organizations_url":"https://api.github.com/users/stevecheckoway/orgs","repos_url":"https://api.github.com/users/stevecheckoway/repos","events_url":"https://api.github.com/users/stevecheckoway/events{/privacy}","received_events_url":"https://api.github.com/users/stevecheckoway/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/rubys/nokogumbo/milestones/1","html_url":"https://github.com/rubys/nokogumbo/milestone/1","labels_url":"https://api.github.com/repos/rubys/nokogumbo/milestones/1/labels","id":3572026,"node_id":"MDk6TWlsZXN0b25lMzU3MjAyNg==","number":1,"title":"2.0","description":"Issues to resolve before version 2.0.","creator":{"login":"stevecheckoway","id":1239089,"node_id":"MDQ6VXNlcjEyMzkwODk=","avatar_url":"https://avatars0.githubusercontent.com/u/1239089?v=4","gravatar_id":"","url":"https://api.github.com/users/stevecheckoway","html_url":"https://github.com/stevecheckoway","followers_url":"https://api.github.com/users/stevecheckoway/followers","following_url":"https://api.github.com/users/stevecheckoway/following{/other_user}","gists_url":"https://api.github.com/users/stevecheckoway/gists{/gist_id}","starred_url":"https://api.github.com/users/stevecheckoway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevecheckoway/subscriptions","organizations_url":"https://api.github.com/users/stevecheckoway/orgs","repos_url":"https://api.github.com/users/stevecheckoway/repos","events_url":"https://api.github.com/users/stevecheckoway/events{/privacy}","received_events_url":"https://api.github.com/users/stevecheckoway/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2018-08-15T08:06:55Z","updated_at":"2018-08-15T08:08:15Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-08-15T08:01:30Z","updated_at":"2018-08-15T17:58:43Z","closed_at":null,"author_association":"COLLABORATOR","body":"# Build configurations\r\nNokogiri has (for our purposes) two supported configurations\r\n1. Compile with an embedded `libxml2` (the default and most supported option)\r\n2. Compile with system libraries\r\n\r\nNokogumbo has two supported configurations\r\n1. Compile with `libxml2` (and nokogiri) headers (this should be the most efficient option)\r\n2. Compile without the headers present and only use the nokogiri API to construct the DOM tree\r\n\r\n# Issue\r\nThere's no guarantee that the version of `libxml2` that nokogumbo builds against in configuration 1 matches the version of `libxml2` that nokogiri builds against.\r\n\r\nThe reason is that `ext/nokogumboc/extconf.rb` checks for the presence of a system `libxml2` (via `have_library('xml2', 'xmlNewDoc')`) and then searches for `nokogiri.h`. If nokogiri is built in its default configuration, then there's no guarantee that the system library matches.\r\n\r\n# Desired goal\r\nI think the best approach is for `extconf.rb` to perform the following actions.\r\n1. If nokogiri was compiled with an embedded `libxml2` and if the headers it needs (in this case `libxml/tree.h` and `nokogiri.h`) are available from the nokogiri gem, then build nokogumbo configuration 1.\r\n2. If nokogiri was compiled with the system `libxml2` and the system library headers (and `nokogiri.h`) are available, then build nokogumbo in configuration 1.\r\n3. Otherwise, build nokogumbo in configuration 2.\r\n\r\n# Blocking issue\r\nI believe that for nokogiri 1.7, we can achieve this using this [`extconf.rb`](https://github.com/stevecheckoway/nokogumbo/blob/check-for-libxml2/ext/nokogumboc/extconf.rb). Unfortunately, for 1.8, this approach doesn't work because the built `libxml2`, along with its headers, are deleted after the extension is built. See https://github.com/sparklemotion/nokogiri/pull/1325/#issuecomment-413024069 for more discussion on this.\r\n\r\nOne possible way forward (and I haven't tested this because I don't like this solution) would be to test if the `libxml2` symbols are available in the nokogiri `.so/.bundle` and if so, then download the corresponding version of `libxml2` and extract the headers.\r\n\r\nIt would be better if nokogiri either didn't delete the built libraries or first installed all of its headers into the extension directory."},"comment":{"url":"https://api.github.com/repos/rubys/nokogumbo/issues/comments/413281802","html_url":"https://github.com/rubys/nokogumbo/issues/71#issuecomment-413281802","issue_url":"https://api.github.com/repos/rubys/nokogumbo/issues/71","id":413281802,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzI4MTgwMg==","user":{"login":"stevecheckoway","id":1239089,"node_id":"MDQ6VXNlcjEyMzkwODk=","avatar_url":"https://avatars0.githubusercontent.com/u/1239089?v=4","gravatar_id":"","url":"https://api.github.com/users/stevecheckoway","html_url":"https://github.com/stevecheckoway","followers_url":"https://api.github.com/users/stevecheckoway/followers","following_url":"https://api.github.com/users/stevecheckoway/following{/other_user}","gists_url":"https://api.github.com/users/stevecheckoway/gists{/gist_id}","starred_url":"https://api.github.com/users/stevecheckoway/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevecheckoway/subscriptions","organizations_url":"https://api.github.com/users/stevecheckoway/orgs","repos_url":"https://api.github.com/users/stevecheckoway/repos","events_url":"https://api.github.com/users/stevecheckoway/events{/privacy}","received_events_url":"https://api.github.com/users/stevecheckoway/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T17:58:43Z","updated_at":"2018-08-15T17:58:43Z","author_association":"COLLABORATOR","body":"@rubys Over at https://github.com/sparklemotion/nokogiri/pull/1325 I suggested a way that this might work. Essentially nokogiri would install its headers and, if system libraries aren't used, the headers for libxml2 and libxslt.\r\n\r\nIf that (or a similar approach) seems reasonable to @flavorjones and the other nokogiri maintainers, then I think we should be able to modify nokogumbo's `extconf.rb` to check for the headers in nokogiri's extension dir."}}
{"actor":{"display_login":"stevecheckoway"}}