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

Incompatible architecture (have 'arm64', need 'x86_64') in M1 mac #297

Open
bibash28 opened this issue May 13, 2022 · 13 comments
Open

Incompatible architecture (have 'arm64', need 'x86_64') in M1 mac #297

bibash28 opened this issue May 13, 2022 · 13 comments

Comments

@bibash28
Copy link

[mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64') in Flutter]
image

@bibash28 bibash28 changed the title Incompatible architecture (have 'arm64', need 'x86_64') Incompatible architecture (have 'arm64', need 'x86_64') in M1 mac May 13, 2022
@Sean-Snow
Copy link

change arch
env /usr/bin/arch -arm64 /bin/zsh
env /usr/bin/arch -x86_64 /bin/zsh
clean and build

@bibash28
Copy link
Author

@Sean-Snow.. changing the arch didn't solve the issue...

@TalebRafiepour
Copy link

TalebRafiepour commented Jul 8, 2022

Same Issue when I want to call "keyToDID" method with android on Macbook M1 pro:

error: Invalid argument(s): Failed to load dynamic library 'libdidkit.so': dlopen failed: library "libdidkit.so" not found, stack: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
I/flutter ( 5031): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
I/flutter ( 5031): #2      lib (package:didkit/didkit.dart:9:22)
I/flutter ( 5031): #3      lib (package:didkit/didkit.dart)
I/flutter ( 5031): #4      key_to_did (package:didkit/didkit.dart:29:20)
I/flutter ( 5031): #5      key_to_did (package:didkit/didkit.dart)
I/flutter ( 5031): #6      DIDKit.keyToDID (package:didkit/didkit.dart:119:17)

@sbihel
Copy link
Member

sbihel commented Jul 11, 2022

Could you both specify what Flutter commands you are running and for which targets?

@bibash28 you will need to compile DIDKit for x86

rustup target add x86_64-apple-darwin
cargo build --release --target x86_64-apple-darwin

Then, assuming you're in the flutter directory, you need to set DYLD_LIBRARY_PATH="$PWD/../../target" and things should work. Except if you're running flutter test in which case you'll need to hardcode the path.

@TalebRafiepour you should follow the steps above but with the correct target, e.g. x86_64-linux-android.

@bibash28
Copy link
Author

bibash28 commented Jul 11, 2022

@sbihel I am trying to build for android in M1 mac... Let me share the commands

echo "Checking for rustup installation and setting rust to nightly."
if ! command -v rustup &>/dev/null; then
  echo "rustup"
  if ! command -v curl &>/dev/null; then
    echo "curl"
    if [[ "$OSTYPE" == "darwin"* ]]; then
      echo "rust darwin"
      brew install curl
    else
      echo "rust linux"
      sudo apt install curl -yet
    fi
  fi

  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

fi
rustup default nightly


echo "Cloning DIDKit repo if not yet on previous directory"
[ ! -d "didkit" ] && git clone https://github.com/spruceid/didkit.git

cd didkit

if [[ "$*" == *-android* ]]; then
  echo "Build didkit for Android"
  cd lib/flutter
  fvm use 2.10.1
  fvm flutter pub get
  cd -
  make -C lib install-rustup-android
  make -C lib ../target/test/java.stamp
  make -C lib ../target/test/android.stamp
  make -C lib ../target/test/flutter.stamp
fi

cargo build

Ref: https://github.com/spruceid/credible/blob/main/install_android_dependencies.sh

@sbihel
Copy link
Member

sbihel commented Jul 11, 2022

You can drop make -C lib ../target/test/flutter.stamp in that script

@bibash28
Copy link
Author

bibash28 commented Jul 12, 2022

ok. @sbihel

make -C lib ../target/test/flutter.stamp

is failing...

error: Invalid argument(s): Failed to load dynamic library 'libdidkit.so': dlopen failed: library "libdidkit.so" not found, stack: #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
I/flutter ( 5031): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
I/flutter ( 5031): #2      lib (package:didkit/didkit.dart:9:22)
I/flutter ( 5031): #3      lib (package:didkit/didkit.dart)
I/flutter ( 5031): #4      key_to_did (package:didkit/didkit.dart:29:20)
I/flutter ( 5031): #5      key_to_did (package:didkit/didkit.dart)
I/flutter ( 5031): #6      DIDKit.keyToDID (package:didkit/didkit.dart:119:17)

Android app returns this error..

@sbihel
Copy link
Member

sbihel commented Jul 12, 2022

I meant, you can remove it.

@bibash28
Copy link
Author

removing doesn't solve issue @sbihel

@sbihel
Copy link
Member

sbihel commented Jul 13, 2022

Is it the same error? For which command?

@bibash28
Copy link
Author

I still have this issue @sbihel @itsbalamurali

image

What I did?
I followed
8cb30fd
c381070

@kangminhao
Copy link

I'm encountering the same issue when building an iOS framework.
Do someone fix this problem or find the solution?

@bibash28
Copy link
Author

Not yet @kangminhao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants