Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS publishing error - Malformed Framework #135

Open
giregk opened this issue Nov 30, 2024 · 7 comments
Open

MacOS publishing error - Malformed Framework #135

giregk opened this issue Nov 30, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@giregk
Copy link

giregk commented Nov 30, 2024

Hello @Skycoder42,

Thank you very much for this package. My new build is refused by Apple on MacOS (it used to work, and it does work with the same app for iOS...).

Here is the message Apple sent me. (I changed the name of MyApp)

ITMS-90291: Malformed Framework - The framework bundle libsodium (MyApp.app/Contents/Frameworks/libsodium.framework) must contain a symbolic link 'libsodium' -> 'Versions/Current/libsodium'. Refer to the Anatomy of Framework Bundles for more information.

ITMS-90291: Malformed Framework - The framework bundle libsodium (MyApp.app/Contents/Frameworks/libsodium.framework) must contain a symbolic link 'Resources' -> 'Versions/Current/Resources'. Refer to the Anatomy of Framework Bundles for more information.

ITMS-90292: Malformed Framework - The framework bundle libsodium (MyApp.app/Contents/Frameworks/libsodium.framework) 'Versions' directory must contain a symbolic link 'Current' resolving to a specific version directory. Resolved link target: '${linkTarget}'. Refer to the Anatomy of Framework Bundles for more information.

I updated from sodium_libs: ^3.2.0+1 to sodium_libs: ^3.3.0+2
After some diging, it appears libsodium binaries used to be packaged as libsodium.dylib and now they are packaged as a libsodium.framework folder, which indeed does not have the mentioned symlinks.

@Skycoder42 Skycoder42 self-assigned this Dec 1, 2024
@Skycoder42 Skycoder42 added the bug Something isn't working label Dec 1, 2024
@Skycoder42
Copy link
Owner

Hi. Your findings are correct. I will publish an update with the correct framework anatomy.

@Skycoder42
Copy link
Owner

Okay, so apparently pub.dev does not allow directory symlinks (which are needed for the macOS bundle). I will have to find a way to deploy the framework over a different channel I think.

@Skycoder42 Skycoder42 reopened this Dec 2, 2024
@Skycoder42
Copy link
Owner

What you can do now to test if it works for you:

  1. Clone the repository to somewhere on your machine
  2. Enter the packages/sodium_libs directory and delete the pubspec_overrides.yaml file
  3. Run dart run tool/libsodium/download.dart darwin
  4. Update your projects pubspec.yaml and add a dependency override:
dependency_overrides:
  sodium_libs:
    path: path/to/sodium_libs

@giregk
Copy link
Author

giregk commented Dec 2, 2024

Hello @Skycoder42, thank you for the update. Unfortunately, your solution is very complicated since we have too many environment differences and I don't want to break mine.

I tried to downgrade, but It keeps the new structure anyway (even after cleaning flutter and xcode caches and removing the flutter build directory and forcing versions of sodium_libs and sodium in pubspec.lock). Do you know what I am missing ?

@Skycoder42
Copy link
Owner

The new format was introduced in version 3.0.0, so you need to downgrade to 2.2.1+6 if you want to use the old format. However, that version was broken with iOS, so I guess its a loose-loose situation here.

I researched some more and apparently there is currently no way to deploy directory symlinks (which are needed here) to pub.dev. As native assets are still in preview phase, there is no nice solution. I will have to check if I can somehow download the binaries via the podfiles. If not, it will have to be a custom script. This however will take a few days to accomplish.

If the steps are to complicated to repeat on your machines, I would recommend you to fork the repo, do those steps there and delete the relevant directory from the .gitignore. Then you can simply reference the git repository in all your environments. See https://dart.dev/tools/pub/dependencies#git-packages

@giregk
Copy link
Author

giregk commented Dec 3, 2024

On my machine, dart run tool/libsodium/download.dart darwin fails because I run an M1 apple chip. Anyway, I downgraded to version 2.2.1+6 for now. I'll reupgrade when you'll have found a solution. Thank you for your help and time.

@Skycoder42
Copy link
Owner

It has nothing todo with the M1, it's more likely some problem with your system configuration. However, that does not matter much.

I found a potential solution by downloading the framework via the podspec directly from github instead of uploading it to pub.dev. @giregk, could you please upgrade to version 3.3.1 and try if it works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants