AparokshaUI/adwaita-swift

Redefinition of module 'FFI'

felix-schindler opened this issue · 4 comments

Describe the bug

Hey, I'm not sure wether I'm doing something wrong or this is an actual bug. Maybe you can help me out. I've followed the tutorial for macOS and can't start the Template project because of the error described in the title.

My OS: macOS 14.4.1 23E224 arm64

Screenshot 2024-04-13 at 22 25 17

To Reproduce

Follow the tutorial for macOS.

Expected behavior

The Template project should build without any compile errors.

Additional context

No response

Thanks for reaching out! Have you tried this fix:

Thanks for opening the issue, @litewrap! I experienced this as well when testing on macOS. Here is what works for me:

  1. Clean the build folder (Xcode: Product > Clean Build Folder...).
  2. Reset package caches (Xcode: File > Packages > Reset Package Caches)
  3. Delete the DerivedData folder (~/Library/Developer/Xcode/DerivedData)
  4. Run the following command in a terminal:
sed -i '' 's/-I..includedir.//g' $(brew --prefix)/Library/Homebrew/os/mac/pkgconfig/*/libffi.pc
  1. Resolve package versions (Xcode: File > Packages > Resolve Package Versions)
  2. Run the app. Now, it succeeds.

I'm not sure whether every step is strictly necessary. Does that help in your case?

I first experienced this problem here: stackotter/swift-cross-ui#47

It's a macOS only problem that sometimes occurs and sometimes doesn't. If this works for you, I'll add the link to the README. Note that this package works best on Linux.

I hit this as well. Its still an occuring issue in xcode. Despite issues in other related repos claiming it was fixed back in 2023. Look out for this if you use xcode. These instructions do work.

This workaround works for me too :) THX, I suppose that issue between SDK from Xcode and Adwaita from Homebrew :)