ivk1800 / telegram-flutter

(WIP) Telegram client written in Dart and uses Flutter.
GNU General Public License v3.0
59 stars 14 forks source link

ld: warning: building for macOS-x86_64 but attempting to link with file built for macOS-arm64 #8

Closed jerrygzy closed 1 year ago

jerrygzy commented 1 year ago
ld: warning: ignoring file /Users/owaf/Dart/app/telegram-flutter/tdlib/macos/libtdjson.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')

here is my env

❯ flutter doctor     
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.3.1 22E772610a darwin-arm64, locale zh-Hans-CN)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.78.2)
[✓] Connected device (2 available)
[✓] Network resources
ivk1800 commented 1 year ago

libtdjson.dylib builded for x86_64, but you have arm64.

jerrygzy commented 1 year ago

@ivk1800 hi, I have followed these steps from this link https://github.com/tdlib/td/tree/master/example/ios and created libtdjson.xcframework . according to the docs, XCFramework will work on any architecture and even on a simulator.

but what is the correct way os using the libtdjson.xcframework ?

i tried it and still got the following error

flutter run  
Connected devices:
macOS (desktop) • macos  • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.92

Checking for wireless devices...

[1]: macOS (macos)
[2]: Chrome (chrome)
Please choose one (or "q" to quit): 1
Resolving dependencies... (1.7s)
  archive 3.3.0 (3.3.7 available)
  args 2.4.1 (2.4.2 available)
  badges 2.0.2 (3.1.1 available)
  bloc 8.0.2 (8.1.2 available)
  collection 1.17.1 (1.17.2 available)
  connectivity_plus 2.2.1 (4.0.1 available)
  dbus 0.7.3 (0.7.8 available)
  dependency_validator 3.2.0 (3.2.2 available)
  device_info_plus 3.2.2 (9.0.2 available)
  device_info_plus_linux 2.1.1 (5.0.0 available)
  device_info_plus_macos 2.2.3 (5.0.0 available)
  device_info_plus_platform_interface 2.6.1 (7.0.0 available)
  device_info_plus_web 2.1.0 (5.0.0 available)
  device_info_plus_windows 2.1.1 (6.0.0 available)
  ffi 1.2.1 (2.0.2 available)
  file 6.1.4 (7.0.0 available)
  flutter_bloc 8.0.1 (8.1.3 available)
  flutter_lints 1.0.4 (2.0.1 available)
  flutter_staggered_grid_view 0.4.0 (0.6.2 available)
  flutter_svg 1.0.3 (2.0.7 available)
  intl 0.17.0 (0.18.1 available)
  lints 1.0.1 (2.1.1 available)
  lottie 1.3.0 (2.4.0 available)
  mask_text_input_formatter 2.1.0 (2.4.0 available)
  material_color_utilities 0.2.0 (0.5.0 available)
  path 1.8.2 (1.8.3 available)
  path_provider 2.0.9 (2.0.15 available)
  path_provider_windows 2.0.7 (2.1.7 available)
  petitparser 4.4.0 (5.4.0 available)
  provider 6.0.2 (6.0.5 available)
  rxdart 0.27.3 (0.27.7 available)
  scrollable_positioned_list 0.3.2 (0.3.8 available)
  shared_preferences 2.0.15 (2.1.2 available)
  shimmer 2.0.0 (3.0.0 available)
  sprintf 6.0.0 (7.0.0 available)
  tuple 2.0.0 (2.0.2 available)
  win32 2.6.1 (5.0.3 available)
  xml 5.1.1 (6.3.0 available)
Got dependencies!
Launching lib/main.dart on macOS in debug mode...
Running pod install...                                             920ms
2023-06-13 21:12:25.027 xcodebuild[62518:3952895] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-000A78CA343A001E }
{ platform:macOS, arch:x86_64, id:00008103-000A78CA343A001E }
/Users/owaf/.pub-cache/hosted/pub.dev/device_info_plus_macos-2.2.3/macos/Classes/SystemUUID.swift:7:72: warning: 'kIOMasterPortDefault' was deprecated in macOS 12.0: renamed to 'kIOMainPortDefault'
        let platformExpert: io_service_t = IOServiceGetMatchingService(kIOMasterPortDefault, dev)
                                                                       ^
        let platformExpert: io_service_t = IOServiceGetMatchingService(kIOMasterPortDefault, dev)
                                                                       ^~~~~~~~~~~~~~~~~~~~
                                                                       kIOMainPortDefault
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
Building macOS application...                                           
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'td_json_client_create': dlsym(RTLD_DEFAULT, td_json_client_create): symbol not found
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1      JsonBindings._clientCreate (package:tdlib/src/client/platform/io/json_bindings.dart:31:8)
#2      JsonBindings._clientCreate (package:tdlib/src/client/platform/io/json_bindings.dart)
#3      JsonBindings.createClient (package:tdlib/src/client/platform/io/json_bindings.dart:58:33)
#4      PlatformImpl.initialize (package:tdlib/src/client/platform/io/io_platform.dart:26:30)
#5      ClientImpl.initialize (package:tdlib/src/client/client_impl.dart:70:22)
#6      TdClient.init (package:td_client/src/client.dart:22:19)
#7      TdLibInitializer.init (package:app/src/app/td_lib_initializer.dart:10:33)
#8      AppInitializer.init (package:app/src/app/app_initializer_impl.dart:28:29)
<asynchronous suspension>
#9      launch (package:app/app.dart:12:3)
<asynchronous suspension>
#10     main (package:launch/main.dart:9:5)
<asynchronous suspension>

Syncing files to device macOS...                                   295ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on macOS is available at: http://127.0.0.1:49329/6muC7d3AObk=/
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:49329/6muC7d3AObk=/
Lost connection to device.
jerrygzy commented 1 year ago

now it's running, here is my solution.

after compile libtdjson.xcframework instructions, copy libtdjson.1.8.14.dylib from macos-arm64_x86_64 to

└── tdlib 
    └── macos 
        └── libtdjson.dylib (rename from libtdjson.1.8.14.dylib )
❯ flutter run
Connected devices:
macOS (desktop) • macos  • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.92

No wireless devices were found.

[1]: macOS (macos)
[2]: Chrome (chrome)
Please choose one (or "q" to quit): 1
Launching lib/main.dart on macOS in debug mode...
Running pod install...                                             872ms
2023-06-15 22:36:01.783 xcodebuild[74136:5894516] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-000A78CA343A001E }
{ platform:macOS, arch:x86_64, id:00008103-000A78CA343A001E }
ld: warning: dylib (/Users/owaf/Dart/app/telegram/telegram-flutter/tdlib/macos/libtdjson.dylib) was built for newer macOS version (13.0) than being linked (11.0)
/Users/owaf/Dart/app/telegram/telegram-flutter/launch/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.11, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'ReachabilitySwift' from project 'Pods')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
Building macOS application...                                           
[ 3][t 3][1686839802.517158031][Td.cpp:2504][#1][!MultiTd]      Create Td with layer 158, database version 14 and version 47 on 4 threads
[ 3][t 3][1686839802.517393112][Td.cpp:3977][#1][!Td][&td_requests]     Sending update: updateOption {
  name = "version"
  value = optionValueString {
    value = "1.8.14"
  }
}
[ 3][t 3][1686839802.517446041][Td.cpp:3977][#1][!Td][&td_requests]     Sending update: updateOption {
  name = "commit_hash"
  value = optionValueString {
    value = "04525f6f6b9c7ebe5ad68fc46253a2bf312f3a58"
  }
}
[ 3][t 3][1686839802.517472028][Td.cpp:3977][#1][!Td][&td_requests]     Sending update: updateAuthorizationState {
  authorization_state = authorizationStateWaitTdlibParameters {
  }
}
[ 3][t 0][1686839802.521393060][Client.cpp:280][&td_requests]   Begin to wait for updates with timeout 1.000000
[ 3][t 0][1686839802.521408081][Client.cpp:293][&td_requests]   End to wait for updates, returning object 0 0x15365ee40
Syncing files to device macOS...                                   348ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on macOS is available at: http://127.0.0.1:52431/4etf-Zb9BtI=/
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:52431/4etf-Zb9BtI=/
2023-06-15 22:37:42.587 Telegram[74640:5897070] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit

══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
The following UnimplementedError was thrown in parseSvgElement:
The <style> element is not implemented in this library.

Style elements are not supported by this library and the requested SVG may not render as intended.
If possible, ensure the SVG uses inline styles and/or attributes (which are supported), or use a
preprocessing utility such as svgcleaner to inline the styles for you.

Picture key
════════════════════════════════════════════════════════════════════════════════════════════════════