Search code examples
iosobjective-cxcodelibxml2

Xcode 9 Beta 2 libxml error


When I build my project with beta 1 it works just fine, but in beta 2 it does not work. In this build I get all sort of errors with libxml I think. For example:

* tree.h:81:3: Unsupported: typedef changes linkage of anonymous type, but linkage was
already computed

* tree.h:346:8: Redefinition of '_xmlElement'

I think this is because somehow libxml is include twice in my project or something. If I change all the #include/imports with the @import xml2 statements it compiles again. The include are guarded by defines.

I want to know if this is the correct solution and why this is needed or is this a bug?

To reproduce problem:

I'm using a wrapper around libxml so I can use objc. When I strip all code the problem can be reproduced with these files/classes:

// DDXMLNode.h
#import <libxml/tree.h>

//@import xml2.tree;
@import Foundation;
@import ObjectiveC.runtime;

@interface DDXMLNode : NSObject<NSCopying>

@end

// DDXMLNode.m
#import "DDXMLNode.h"

@implementation DDXMLNode
@end

I added libxml2 through build phases and just add libxml2.tbd.


Solution

  • As Calimari328 said in the comments this is fixed in xCode beta 3.