RustKit icon indicating copy to clipboard operation
RustKit copied to clipboard

Build broken due to duplicate 'new' method generation

Open coolbluewater opened this issue 5 years ago • 2 comments

Hi, I tried building against the Xcode 11.3 SDK. The build errors out with numerous errors of this kind:

error[E0201]: duplicate definitions with name `new`:
     --> src/RustKit/target/debug/build/rustkit-74ad679636d80c03/out/Foundation.rs:75054:5
      |
75042 | /     pub fn new() -> Arc<Self> {
75043 | |         unsafe {
75044 | |             let send: unsafe extern "C" fn(*mut Object, SelectorRef) -> *mut Self =
75045 | |                 mem::transmute(objc_msgSend as *const u8);
...     |
75052 | |         }
75053 | |     }
      | |_____- previous definition of `new` here
75054 | /     pub fn new() -> Arc<Self> {
75055 | |         unsafe {
75056 | |             let send: unsafe extern "C" fn(*mut Object, SelectorRef) -> *mut Self =
75057 | |                 mem::transmute(objc_msgSend as *const u8);
...     |
75064 | |         }
75065 | |     }
      | |_____^ duplicate definition

I think it is trying to generate the same method for the init and new Objective-C methods, both of which are marked deprecated, by the way.

Appreciate any assistance. Thanks!

coolbluewater avatar Dec 10 '19 10:12 coolbluewater

More details:

  1. I'm using a private build of clang 8.0.1, from the Release/8.x branch. I've verified that this contains your path:
commit 260e962402973093380843a11a7f9172b666af09
Author: Michael Wu <[email protected]>
Date:   Mon Nov 12 02:44:33 2018 +0000

    Support Swift in platform availability attribute

Any idea what the issue could be? Thanks!

coolbluewater avatar Dec 11 '19 09:12 coolbluewater

I was able to build successfully against the Xcode 10.3 SDK. Thus, the build is indeed broken against the Xcode 11.3 SDK.

Additionally, I had to compile a very specific branch of clang, the Releases/8.x branch, resulting in the 8.0.1 version of clang and libclang.dylib. (You can get the version via clang --version.) Maybe people visiting this page via google will find this information useful.

Is this project still active, and any chance that it will be updated to build against the Xcode 11.3 SDK?

Thanks!

coolbluewater avatar Dec 11 '19 11:12 coolbluewater