Skip to content

Native library compiled with incorrect target architecture (x86_64, not arm64) #524

Description

@zeyus

First, thanks, flutter-pi seems awesome and would be really useful in my case to run a headless app that does physics calculations for a game (and logging, and coordination).

The problem is that when I copy the built bundle, it packages the .so files for the native libs, but it's in the wrong format:


❯ file liblsl.so
liblsl.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=9382c48ff4a3643874f80f38b21975cfee7006ce, not stripped

❯ file libbox2d.so 
libbox2d.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=40eb884b4159a0c260e8c7b1b6a76c453aebcdc7, not stripped


❯ file app.so
app.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[md5/uuid]=4d0d11e02909fd040442e7152eb13d3e, stripped

This is the command I used to make the build: fvm exec flutterpi_tool build --release --cpu=pi4 --arch=arm64 -t lib/main_headless.dart

On the raspberry pi (4B):

fvm exec flutter-pi --release --dummy-display --dummy-display-size "1,1" /home/zeyus/RiseTogetherFPI

Log directories initialized:
  App logs: /home/zeyus/.local/share/flutter-pi/logs/app
  Data logs: /home/zeyus/.local/share/flutter-pi/logs/data
App logging isolate started, log file: /home/zeyus/.local/share/flutter-pi/logs/app/app_2026-08-13T20-07-01.796078.log
Data logging isolate started, log file: /home/zeyus/.local/share/flutter-pi/logs/data/app_data_2026-08-13T20-07-01.796078.tsv
Headless Server - Logging status: {appLogging: {enabled: true, destination: LogDestination.both, path: /home/zeyus/.local/share/flutter-pi/logs/app/app_2026-08-13T20-07-01.796078.log}, dataLoggers: [app_data], directories: {appLogDirectory: /home/zeyus/.local/share/flutter-pi/logs/app, dataLogDirectory: /home/zeyus/.local/share/flutter-pi/logs/data}}
Headless server started successfully
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Couldn't resolve native function 'lsl_set_config_content' in 'package:liblsl/native_liblsl.dart' : Failed to load dynamic library '/home/zeyus/RiseTogetherFPI/liblsl.so': Failed to load dynamic library '/home/zeyus/RiseTogetherFPI/liblsl.so': /home/zeyus/RiseTogetherFPI/liblsl.so: cannot open shared object file: No such file or directory.

#0      Native._ffi_resolver.#ffiClosure0 (dart:ffi-patch/ffi_patch.dart)
#1      Native._ffi_resolver_function (dart:ffi-patch/ffi_patch.dart:1943)
#2      lsl_set_config_content (package:liblsl/native_liblsl.dart)
#3      LSL.setConfigContent (package:liblsl/src/lsl.dart:46)
#4      LSLTransport.initialize (package:liblsl_coordinator/transports/lsl/lsl_transport.dart:235)
#5      PeerSession.initialize (package:peer_coordinator/src/network/peer_session.dart:266)
<asynchronous suspension>
#6      SessionHost.connect (package:rise_together/src/services/network/session/session_host.dart:140)
<asynchronous suspension>
#7      NetworkCoordinator.initialize (package:rise_together/src/services/network_coordinator.dart:383)
<asynchronous suspension>
#8      _HeadlessAppState._initializeHeadlessMode (package:rise_together/src/headless/headless_app.dart:89)
<asynchronous suspension>

Any ideas? Did I miss something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions