pcpl2/flutterMediainfo

package doesn't work on MacOS

vadimbarda opened this issue ยท 8 comments

๐Ÿ› Bug Report

๐Ÿ—’๏ธ Describe the bug

pod install command brake with this log:
...
Installing flutter_media_info (0.0.3)
[!] /bin/bash -c
set -e
sh ./buildForMacos.sh

./buildForMacos.sh: line 6: cmake: command not found
make: *** No targets specified and no makefile found. Stop.

โœ”๏ธ To Reproduce

Steps to reproduce the behavior:

  1. update package to version 0.0.3
  2. run application on MacOS
  3. See error

๐Ÿค” Expected Behavior

application can build with mediaLibrary

๐Ÿ’ Possible Solution

๐Ÿ’ก Context

๐Ÿ’ป Code Sample

๐ŸŒ Your Environment

Software Version(s)
Flutter 3.4.0-17.2.pre, on macOS 12.5
IDE VCode(1.74.3), XCode(13.4.1)
Operating System macOS 12.5
Targeting Operating System macOS 12.5
pcpl2 commented

I forgot to write in the readme that from now cmake is required to compile on macOS too, I used to send precompiled binaries before, from this version I don't do it anymore.

Hi @pcpl2. This build script make another issue on Mac. It is connected to different Apple architecture. For example I use Codemagic as CI to build package for MacOS. Default environment for that is Apple M1 machine. It has arm64 architecture. When I start this application on my Mac own laptop and try to call your package it crashes. Because my laptop has 'x86_64' architecture. So all application and another libraries works well, except media info. I think you can start your investigation from this article https://discourse.cmake.org/t/how-to-determine-which-architectures-are-available-apple-m1/2401 I think you need take a look as another libraries build for Mac. There is callstack
Invalid argument(s): Failed to load dynamic library '/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Resources/libnative_utils.dylib': dlopen(/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Resources/libnative_utils.dylib, 0x0001): tried: '/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Resources/libnative_utils.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Resources/libnative_utils.dylib' (no such file), '/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Resources/libnative_utils.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64')), '/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Versions/A/Resources/libnative_utils.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Versions/A/Resources/libnative_utils.dylib' (no such file), '/private/var/folders/qn/4m5kpdxd4y1_h49zqlyy7kgh0000gn/T/AppTranslocation/34B87948-8130-4FF5-AAF7-EBCEA586F54A/d/MediaCasa.ai.app/Contents/Frameworks/flutter_media_info.framework/Versions/A/Resources/libnative_utils.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64'))

pcpl2 commented

I published prerelease versions 0.0.4-dev.1 with the appropriate flag in cmake, but I had no way to check if the compilation under arm64 works because I don't have access to any computer with this cpu.

@pcpl2 Thank you very much. Compilation works for me on both architecture. I have possibility to run build on Codemagic CI machine with Apple M1 and run application on my laptop with x86_64. It works correctly. But I can't check if application works on arm64

pcpl2 commented

As far as I know it should work thanks to Rosetta 2 emulation which is available on macOS systems. Flutter itself does this because they haven't added support for arm64 yet.

@pcpl2 Just checked with my colleague on Apple M1. Application is works in general, but library doesn't work.

pcpl2 commented

In the near future I will try to investigate why the library does not work on Apple M1 processors. I created a new issue #11 for this problem. I consider the problem with compiling for x64 on arm64 architecture has solved. I will release version 0.0.4 in a few days as the final one. If you want to stay up to date with the work on the fix for working on arm64, watch the new issue #11.
Thanks for checking my fixes, you make this package better.

@pcpl2 Thank you