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

Pods issue on macOS Monterey 12.0.1 #572

Closed
jonny7737 opened this issue Oct 27, 2021 · 42 comments
Closed

Pods issue on macOS Monterey 12.0.1 #572

jonny7737 opened this issue Oct 27, 2021 · 42 comments
Assignees
Labels
1 backlog bug Something isn't working

Comments

@jonny7737
Copy link

Which API doesn't behave as documented, and how does it misbehave?
Not an API issue. build of package example fails.

Minimal reproduction project
The example

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. From project directory
  2. flutter run
  3. build fails
  4. See error

Error messages

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local
      because checking is only performed in repo update
    [!] CocoaPods could not find compatible versions for pod "just_audio":
      In Podfile:
        just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)

    Specs satisfying the `just_audio (from
    `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)` dependency were
    found, but they required a higher minimum deployment target.

Expected behavior
Expected example app to run.

Screenshots
No screens => no screenshots.

Desktop (please complete the following information):

  • OS: macOS 12.0.1
  • None - Desktop application

Smartphone (please complete the following information):

  • Device:N/A
  • OS: N/A

Flutter SDK version

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] VS Code (version 1.53.0-insider)
[✓] Connected device (2 available)

• No issues found!

Additional context
I would very much like to try this audio player.

@jonny7737 jonny7737 added 1 backlog bug Something isn't working labels Oct 27, 2021
@ryanheise
Copy link
Owner

Specs satisfying the `just_audio (from
`Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)` dependency were
found, but they required a higher minimum deployment target.

Can you try doing that and let me know how it goes?

@jonny7737
Copy link
Author

jonny7737 commented Oct 28, 2021

Yes. That worked. The value of 'minimum deployment target' was 10.11 [default]

I changed it to 10.12.2 and that work with some warnings in the build process.
I changed it to 11.0 and that work with some warnings in the build process.
I changed it to 12.0.1 and that worked with some warnings in the build process.
I changed it back to 10.11 and that worked with fewer warnings than the other three tries.
I will leave it at 10.11.

The 10.11 warnings are:
`/Users/#####/dev-tools/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.6+1/macos/Classes/AudioSessionPlugin.m:14:5: warning: expression result unused [-Wunused-value]
[[AudioSessionPlugin alloc] initWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

ld: warning: dylib (/Users/#####/StudioProjects/stocks/build/macos/Build/Products/Debug/just_audio/just_audio.framework/just_audio) was built for newer macOS version (10.12.2) than being linked (10.11)
`

Thanks.

@ryanheise
Copy link
Owner

I'm a bit concerned that this can happen in the official example when Apple releases a new version of macOS. I would have expected the example to continue to work due to backwards compatibility.

Can you summarise which files in the plugin/example you changed? i.e. git status -s or git diff? (I haven't upgraded macOS yet so I can't try.)

@ryanheise
Copy link
Owner

Hi @jonny7737 any update on this?

@jonny7737
Copy link
Author

Sorry, replied via email on 10/28.

At pub.dev just_audio package under Tutorials is an article link

Playing short audio clips in Flutter with Just Audio by @suragch

The article links to a github repo
https://github.com/suragch/audio_clips_flutter_demo/tree/master/lib

I copied main.dart and inserted that into a new flutter project.

I see now that this is NOT the official example but is instead a third party tutorial. I apologize for my confusion on this item.

@ryanheise
Copy link
Owner

I see, have you tried the official example and does it contain the bug you reported?

@jonny7737
Copy link
Author

jonny7737 commented Nov 9, 2021

Official example has the same result as reported in my second post:

ld: warning: dylib (/Users/jonny/Downloads/just_audio-master/just_audio/example/build/macos/Build/Products/Debug/just_audio/just_audio.framework/just_audio) was built for newer macOS version (10.12.2) than being linked (10.11)

And the build runs as expected.

@ebwood
Copy link

ebwood commented Nov 28, 2021

Below solution is working for me:

  1. comment the platform :osx, '10.11' in macos/Podfile
  2. delete Podfile.lock and run pod install:
    cd macos && rm Podfile.lock && pod install

@BytesZero
Copy link

macos/Podfile replace platform :osx, '10.11' to platform :osx, '10.15'

@meng-fucius
Copy link

macos/Podfile replace platform :osx, '10.11' to platform :osx, '10.15'

this worked for me

@ryanheise
Copy link
Owner

Hmm, the official example already has platform :osx, '10.15', but it has been reported by @jonny7737 that this official example still doesn't work:

Official example has the same result as reported in my second post:

ld: warning: dylib (/Users/jonny/Downloads/just_audio-master/just_audio/example/build/macos/Build/Products/Debug/just_audio/just_audio.framework/just_audio) was built for newer macOS version (10.12.2) than being linked (10.11)

And the build runs as expected.

@Ruzo
Copy link

Ruzo commented May 19, 2022

Hmm, the official example already has platform :osx, '10.15', but it has been reported by @jonny7737 that this official example still doesn't work:

Official example has the same result as reported in my second post:
ld: warning: dylib (/Users/jonny/Downloads/just_audio-master/just_audio/example/build/macos/Build/Products/Debug/just_audio/just_audio.framework/just_audio) was built for newer macOS version (10.12.2) than being linked (10.11)
And the build runs as expected.

This is the warning I get even with '11.6.5' which is the Big Sur version my Mac is at right now.

@ryanheise
Copy link
Owner

May I ask what version of Xcode you're using?

@Ruzo
Copy link

Ruzo commented May 19, 2022

May I ask what version of Xcode you're using?

Hi, it's Xcode version 13.2.1 (13C100)

@ryanheise
Copy link
Owner

I may need to test that version of Xcode in order to reproduce this.

@Ruzo
Copy link

Ruzo commented May 19, 2022

Great! Thank you for looking into it.

@ryanheise
Copy link
Owner

However, I can't say it's easy/quick, I'm short on storage space and the whole installation process usually requires me to do a painful game of musical chairs to make enough space to perform the installation.

@Ruzo
Copy link

Ruzo commented May 19, 2022

I can imagine. If it was a web issue I might have helped but I don't mess with Swift dev :)

@Ruzo
Copy link

Ruzo commented May 23, 2022

Alright, I did a search in the code to see where it was being linked (10.11) and found 10.11 as value for the MACOSX_DEPLOYMENT_TARGET in the project.pbxproj file in macos/Runner.xcodeproj/ folder. I changed it to 10.12.2 in all three spots where it was assigned the 10.11 version.

There are no warnings anymore. I don't know if there will be a nasty surprise waiting for me in some later process.

@ryanheise
Copy link
Owner

@Ruzo would you consider making a pull request for that change? If you can verify that it works in your newer version of Xcode and I can verify that it works in my older version of Xcode, then I'll merge and publish it. (Although after that, I will definitely want to upgrade Xcode because Flutter 3 requires it.

@Ruzo
Copy link

Ruzo commented May 23, 2022

@Ruzo would you consider making a pull request for that change? If you can verify that it works in your newer version of Xcode and I can verify that it works in my older version of Xcode, then I'll merge and publish it. (Although after that, I will definitely want to upgrade Xcode because Flutter 3 requires it.

I made these changes in my own project's macos folder so MACOSX_DEPLOYMENT_TARGET is only present in your example folder.

The only code that references 10.11 is in the UriAudioSource.m file in darwin/Classes/ and ios/Classes/ folders. It seems to be checking for macOS version availability. What would be the best way to fix it?

@ryanheise
Copy link
Owner

I made these changes in my own project's macos folder so MACOSX_DEPLOYMENT_TARGET is only present in your example folder.

Here my interest is in making sure the official example is fixed. Does the unmodified official example work for you as is?

@Ruzo
Copy link

Ruzo commented May 23, 2022

These are the warnings I get with the example:

/Users/richardrouzeau/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.6+1/macos/Classes/AudioSessionPlugin.m:14:5: warning: expression result unused [-Wunused-value]
    [[AudioSessionPlugin alloc] initWithRegistrar:registrar];
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
ld: warning: dylib (/Users/richardrouzeau/apps/Flutter/just_audio/just_audio/example/build/macos/Build/Products/Debug/just_audio/just_audio.framework/just_audio) was built for newer macOS version (10.12.2) than being linked (10.11)
: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
lib/main.dart:27
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../../flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
    WidgetsBinding.instance?.addObserver(this);
                   ^
: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
lib/main.dart:55
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../../flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1

    WidgetsBinding.instance?.removeObserver(this);

I also found that you have s.platform = :osx, '10.12.2' in the package's /macos/just_audio.podspec folder.

@ryanheise
Copy link
Owner

That could be it... If you bump up that version, does it fix the warning?

@Ruzo
Copy link

Ruzo commented May 23, 2022

Fixing the WidgetsBinding warning eliminates all other warnings except for the macOS version one. I tried bringing the s.platform version up and down but it's not making a difference. Would it be because it's cached?

@ryanheise
Copy link
Owner

The WidgetsBinding warning is separate from this issue, and I will commit a fix for that separately.

Perhaps you are right about the cache. Can you try doing a flutter clean and possibly removing the Pods dir?

@Ruzo
Copy link

Ruzo commented May 23, 2022

I finally got to test it with different versions. Bringing the version down to 10.11 is actually what works.

So setting s.platform = :osx, '10.11' in the /just_audio/macos/just_audio.podspec file eliminates the versions warning.

@ryanheise
Copy link
Owner

Interesting, although from memory the macOS implementation uses some APIs that require a higher version...

@ryanheise
Copy link
Owner

So confirming with the Apple documentation, certain parts of the code do indeed require macOS 10.12, so I don't think lowering the it to 10.11 will be a correct solution.

@Ruzo
Copy link

Ruzo commented May 25, 2022

Maybe it has to do with checking for availability of macOS 10.11 in the UriAudioSource.m file. However, you are also checking for macOS 10.10 so... It's confusing.

@ryanheise
Copy link
Owner

That comes from the Apple API documentation's stated availability. However, I suppose since the plugin's podspec targets 10.12.2 or later, it may be a matter of simply editing UriAudioSource.m so that it uses a version number that is at least the number from the API documentation, but also at least the number from the plugin's podspec.

@Ruzo
Copy link

Ruzo commented May 26, 2022

Editing the UriAudioSource.m did not make a difference (if I did it right). It seems like having s.platform = :osx, '10.12.2' in the /just_audio/macos/just_audio.podspec file requires a project to also have its MACOSX_DEPLOYMENT_TARGET set to '10.12.2'.

@ryanheise
Copy link
Owner

I have finally managed to upgrade Xcode and I can confirm the issue does now happen for me. I'll take some time to investigate.

@ryanheise
Copy link
Owner

After some Googling, it turns out that this is just a result of not completely upgrading the build tools when upgrading Xcode. Here is how I got it working for me:

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
sudo gem install cocoapods
flutter clean

After doing all of that, it now builds and runs successfully. There are still the same warnings, but after these steps, they are no longer fatal.

@ryanheise
Copy link
Owner

Regarding the warning, it seems to be fixed by editing example/macos/Runner.xcodeproj/project.pbxproj and replacing 10.11 by 10.12.2.

@ryanheise
Copy link
Owner

I've just committed fixes for the various warnings on the fix/flutter3 branch. Please let me know whether it works for you, in addition to trying the upgrade instructions in #572 (comment)

@Ruzo
Copy link

Ruzo commented May 27, 2022

The warnings were never "fatal" in my case.

With the fix/flutter3 branch and MACOSX_DEPLOYMENT_TARGET still set to 10.12.2, There is only the AudioSessionPlugin warning left.

/Users/richardrouzeau/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.7/macos/Classes/AudioSessionPlugin.m:14:5: warning: expression result unused [-Wunused-value]
    [[AudioSessionPlugin alloc] initWithRegistrar:registrar];
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

This warning only shows up on the first run after just_audio has been freshly installed. Like after flutter clean.

@ryanheise
Copy link
Owner

Yes I still have to fix the audio_session warning, although it's for a separate plugin so I'll need to address it over on that project.

Regarding just_audio, did your fatal error go away with just the fix/flutter3 branch, or did you also need to do the xcode-select thing?

@ryanheise
Copy link
Owner

The fix/flutter3 branch has now been published to just_audio 0.9.22, so I'll close this issue. I'll monitor whether people still run into build errors and if so consider adding instructions to the README on how to upgrade Xcode.

@Ruzo
Copy link

Ruzo commented May 28, 2022

Yes I still have to fix the audio_session warning, although it's for a separate plugin so I'll need to address it over on that project.

Regarding just_audio, did your fatal error go away with just the fix/flutter3 branch, or did you also need to do the xcode-select thing?

Doing the xcode-select thing and using the fix/flutter3 branch does not fix the non-fatal version warning in my case. I still have to bump up the MACOSX_DEPLOYMENT_TARGET value which seems to be normal behavior for the support of certain features of just_audio.

@ryanheise
Copy link
Owner

OK, it sounds you already had most of the pieces of the puzzle already in place. Hopefully the above discussion will help people who stumble across the same error.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants