Git Product home page Git Product logo

Comments (21)

colinhumber avatar colinhumber commented on August 30, 2024 1

Added a small fix to the podspec to fix this issue in PR #68. Tested a clean pod install in Xcode 8 with the private_libxml branch with the podspec changes and everything compiles!

Thanks a ton for all the help @chrisballinger! I owe you a beer. 😄

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

Ohhhhh yes. I'm definitely not happy about how Apple left developers to create their own modulemaps for libxml, CommonCrypto, sqlite, etc. We are also missing modulemaps for a bunch of other platforms like watch and tv.

SQLite.swift has a number of them here: https://github.com/stephencelis/SQLite.swift/blob/master/SQLite.swift.podspec#L35
https://github.com/stephencelis/SQLite.swift/tree/master/CocoaPods

I'm not sure how we could support both easily in the same podspec, but perhaps in the readme we could point people to a Xcode-beta branch? Oh yeah another issue is people running 10.12 and not Xcode-beta, and Xcode-beta and 10.11...

:(

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

What I'm a little confused about is why the #if DDXML_LIBXML_MODULE_ENABLED check is ignored. I can hack the modulemap to point to Xcode-beta.app, but this check always seems to return false, which forces the #import <libxml/tree.h> to run instead of importing the appropriate module.

The flag is property included in the OTHER_SWIFT_FLAGS and OTHER_CFLAGS.

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

I'm wondering if a better route would be to remove all references to libxml from the public headers. It seems easy to fix in DDXMLNode without breaking backwards compatibility but NSString+DDXML might be trickier because the public API exposes xmlChar directly. Even though xmlChar is just a typedef for unsigned char, I don't see a great way to fix it without introducing tons of warnings into people's projects, or breaking things entirely.

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

Might be worth just keeping an eye on as Xcode betas keep coming out. I just installed beta 2, and it introduced more errors that weren't present before.

image

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

Is there any way it's pulling in two modulemaps for both beta and non-beta? I guess if the ifdef isn't working it's not pulling in anything though..

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

I started tinkering with having a nested beta subspec under libxml_module, that references a second .modulemap that points to Xcode-beta.app.

  s.subspec 'libxml_module' do |ss|
    ss.subspec 'beta' do |beta|
      beta.preserve_path = 'libxml/module-beta.modulemap'
    end
 ...

and then

pod "KissXML/libxml_module/beta"

Still a WIP to see if I can get it working. I'm still wrapping my head around the modulemap stuff, so I don't even know if having a second file named something other than module.modulemap even works...

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

I thiiink it needs to be named module.modulemap, so perhaps put it in a different folder. You also need to make sure that the modulemap folder path is included in the header search paths: https://github.com/robbiehanson/KissXML/blob/master/KissXML.podspec#L34

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

Ya, you're right. I pulled that and just tried changing the paths in module.modulemap to point to Xcode-beta.app and it's still causing issues. Seems like a lot of the issues are just due to the DDXML_LIBXML_MODULE_ENABLED being ignored. 😦

Gonna need to keep digging...

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

Maybe Swift 3 changed how they expect preprocessor defines on the command line? Hopefully it's not deprecated...

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

I ran the converter and am using Swift 2.3, same issues. Definitely seems
like something changed with preprocessor defines in Xcode 8…

I just noticed in the release notes that there’s a new build setting for
Swift. Doesn’t fix the issue, but something to be aware of, at any rate.

“Active Compilation Conditions” is a new build setting for passing conditional compilation flags to the Swift compiler. Each element of the value of this setting passes to swiftc prefixed with "-D", in the same way the elements of “Preprocessor Macros” pass to clang with the same prefix. (22457329)

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

So, it definitely seems like the preprocessor define isn't being handled.

In DDXMLNode.h, I added the following at the top, just to see if the flag was defined, and sure enough, it's not.

#ifndef DDXML_LIBXML_MODULE_ENABLED
#error "UNDEFINED"
#endif

image

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

Aha! That changelog entry is most likely the cause and possibly an Apple or CocoaPods bug. There is definitely funky stuff that happens when Swift imports Objective-C modules, and I bet that the flags aren't being passed around properly from Swift->ObjC.

I bet it works fine when imported into an Obj-C project (with modules).

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

😢 No joy... I'm trying to just build the KissXML framework directly now at it's still failing. Ugh... I'm sure it's gonna end up being one flag that is new or needs flipping to get this working...

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

There's some discussion possibly related to this here: http://stackoverflow.com/questions/24003291/ifdef-replacement-in-swift-language

Try -D DDXML_LIBXML_MODULE_ENABLED instead of -DDDXML_LIBXML_MODULE_ENABLED

It seems that you also can't set it =1 so we might have to change the obj-c ifdef to be ifdef instead of if.

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

So... in order to get rid of the issues with the #if DDXML_LIBXML_MODULE_ENABLED check failing, in Xcode 8 I needed to add DDXML_LIBXML_MODULE_ENABLED=1 to the list of Preprocessor Macros, not the OTHER_CFLAGS. 😐 However, now it can't fine the actual modules.

The new compiler must have changed how SWIFT/OTHER_CFLAGS work.

image

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

I had KissXML setup as a local development pod, and the search paths don't pick up the module.modulemap in this config. I think I have a handle on this now. Gonna play around a bit and get this working tonight.

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

You may be interested in my new branch that removes libxml from the public headers entirely:

https://github.com/robbiehanson/KissXML/tree/private_libxml

Seems like a nice way to work around the problem and hopefully doesn't break anything for people. :)

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

With DDXMLPrivate.h importing <libxml/tree.h>, it's throwing the same error as above in Xcode 8. Xcode 7 is still working as expected. 😞

image

Update: I think I have a workaround. Please hold...

from kissxml.

chrisballinger avatar chrisballinger commented on August 30, 2024

Ya no problem! :)

Btw I used to use itunes_transporter_generator before I switched to Deliver. Even made an issue 3 years ago: https://github.com/colinhumber/issues/19

from kissxml.

colinhumber avatar colinhumber commented on August 30, 2024

Awesome! Ya, that project died pretty quick after Deliver came out, and rightly so. Deliver is amazing!

from kissxml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.