didkit icon indicating copy to clipboard operation
didkit copied to clipboard

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

Open bibash28 opened this issue 3 years ago • 13 comments

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

bibash28 avatar May 13 '22 06:05 bibash28

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

Sean-Snow avatar May 13 '22 09:05 Sean-Snow

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

bibash28 avatar May 13 '22 10:05 bibash28

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)

TalebRafiepour avatar Jul 08 '22 08:07 TalebRafiepour

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.

sbihel avatar Jul 11 '22 14:07 sbihel

@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

bibash28 avatar Jul 11 '22 15:07 bibash28

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

sbihel avatar Jul 11 '22 20:07 sbihel

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..

bibash28 avatar Jul 12 '22 02:07 bibash28

I meant, you can remove it.

sbihel avatar Jul 12 '22 13:07 sbihel

removing doesn't solve issue @sbihel

bibash28 avatar Jul 12 '22 13:07 bibash28

Is it the same error? For which command?

sbihel avatar Jul 13 '22 10:07 sbihel

I still have this issue @sbihel @itsbalamurali

image

What I did? I followed https://github.com/spruceid/didkit/pull/315/commits/8cb30fd28069a97e9f5679c77a2f3c6d567e3e06 https://github.com/spruceid/didkit/pull/315/commits/c381070a97f8bd98c853bfed4e3220e08a5e78bc

bibash28 avatar Oct 26 '22 00:10 bibash28

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

kangminhao avatar Apr 19 '23 13:04 kangminhao

Not yet @kangminhao

bibash28 avatar Apr 19 '23 14:04 bibash28