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

Failed to install on mac arm architecture #100

Open
sdondley opened this issue Jan 21, 2023 · 15 comments
Open

Failed to install on mac arm architecture #100

sdondley opened this issue Jan 21, 2023 · 15 comments

Comments

@sdondley
Copy link

sdondley commented Jan 21, 2023

I have an M1 mac running ventura, 13.1 I have installed openssl@3 package with brew. zef install OpenSSL results in an error:

 $ zef install OpenSSL                                                                                                    
===> Searching for: OpenSSL
===> Searching for missing dependencies: PathTools
===> Building: OpenSSL:ver<0.2.0>
[OpenSSL] Using openssl prefix /opt/homebrew/opt/openssl@3
===> Building [OK] for OpenSSL:ver<0.2.0>
===> Testing: PathTools:ver<0.2.0>:auth<github:ugexe>
===> Testing [OK] for PathTools:ver<0.2.0>:auth<github:ugexe>
===> Testing: OpenSSL:ver<0.2.0>
[OpenSSL] Cannot locate native library '/opt/homebrew/opt/openssl@3/lib/libssl.dylib': dlopen(/opt/homebrew/opt/openssl@3/lib/libssl.dylib, 0x000A): tried: '/opt/homebrew/opt/openssl@3/lib/libssl.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/openssl@3/lib/libssl.dylib' (no such file), '/opt/homebrew/opt/openssl@3/lib/libssl.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/opt/homebrew/Cellar/openssl@3/3.0.7/lib/libssl.3.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/openssl@3/3.0.7/lib/libssl.3.dylib' (no such file), '/opt/homebrew/Cellar/openssl@3/3.0.7/lib/libssl.3.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))in method setup at /Users/steve/.rakubrew/versions/moar-2022.12/install/share/perl6/core/sources/7B8DEDA2F7DE2BC68AFBCDDDCCD18DA2262416F3 (NativeCall) line 319 in method setup at /Users/steve/.rakubrew/versions/moar-2022.12/install/share/perl6/core/sources/7B8DEDA2F7DE2BC68AFBCDDDCCD18DA2262416F3 (NativeCall) line 366 in sub raku-nativecall at /Users/steve/.rakubrew/versions/moar-2022.12/install/share/perl6/core/sources/71DDCBA5C5EBFAE6A17BAC4C253AA782EA5EBFD3 (NativeCall::Dispatcher) line 46
in method new at /var/folders/3g/pjgd42p5417cx1jcc5kw58900000gn/T/.zef/OpenSSL%3Aver%3C0.2.0%3E%3Aauth%3Cgithub%3Asergot%3E.tar.gz/openssl-master/lib/OpenSSL.rakumod (OpenSSL) line 36  in block <unit> at t/01-basic.t line 6
===> Testing [FAIL]: OpenSSL:ver<0.2.0>
Aborting due to test failure: OpenSSL:ver<0.2.0> (use --force-test to override)

Note the bit in the error about "incompatible architecture."

@coke
Copy link

coke commented Mar 3, 2023

Same on mac m2 here. The confusing thing is that it's complaining that it has arm64 but needs x86_64 - but we want arm64, and that's what brew has installed.

@coke
Copy link

coke commented Mar 3, 2023

Same on mac m2 here. The confusing thing is that it's complaining that it has arm64 but needs x86_64 - but we want arm64, and that's what brew has installed.

Oh. No, Rakudo is built as Mach-O 64-bit executable x86_64

@coke
Copy link

coke commented Mar 3, 2023

Following the instructions here

https://medium.com/mkdir-awesome/how-to-install-x86-64-homebrew-packages-on-apple-m1-macbook-54ba295230f

I have installed an x86_64 homebrew (but also have the arm64 one) - I removed openssl from arm64, installed it on x86_64; now when I clone this repo, I get a different error:

$ git clone [email protected]:sergot/openssl.git
$ cd openssl
$ zef build .
$ raku -I. --ll-exception t/01-basic.t
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/rakudo is loading libcrypto in an unsafe way
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/rakudo is loading libcrypto in an unsafe way
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/rakudo is loading libcrypto in an unsafe way
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/raku is loading libcrypto in an unsafe way
zsh: abort      raku -I. --ll-exception t/01-basic.t

Curious that these are all for rakudo except the last one.

@coke
Copy link

coke commented Mar 3, 2023

% lldb raku
(lldb) target create "raku"
Current executable set to 'raku' (x86_64).
(lldb) run -I. t/01-basic.t
Process 35483 launched: '/Users/coke/.rakubrew/versions/moar-2023.02/install/bin/raku' (x86_64)
warning: libobjc.A.dylib is being read from process memory. This indicates that LLDB could not read from the host's in-memory shared cache. This will likely reduce debugging performance.

WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/rakudo is loading libcrypto in an unsafe way
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/rakudo is loading libcrypto in an unsafe way
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/rakudo is loading libcrypto in an unsafe way
WARNING: /Users/coke/.rakubrew/versions/moar-2023.02/install/bin/raku is loading libcrypto in an unsafe way
Process 35483 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007ff8151bb00e libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`:
->  0x7ff8151bb00e <+10>: jae    0x7ff8151bb018            ; <+20>
    0x7ff8151bb010 <+12>: movq   %rax, %rdi
    0x7ff8151bb013 <+15>: jmp    0x7ff8151b51c5            ; cerror_nocancel
    0x7ff8151bb018 <+20>: retq
Target 0: (raku) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007ff8151bb00e libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007ff8151f11ff libsystem_pthread.dylib`pthread_kill + 263
    frame #2: 0x00007ff81513cd24 libsystem_c.dylib`abort + 123
    frame #3: 0x00007ffb2e440afe libssl.dylib`__report_load.cold.1 + 36
    frame #4: 0x00007ffb2e44080d libssl.dylib`__report_load + 427
    frame #5: 0x0000000200024e4f dyld`invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 182
    frame #6: 0x000000020004baad dyld`invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 242
    frame #7: 0x0000000200042e26 dyld`invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 557
    frame #8: 0x0000000200011db3 dyld`dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 129
    frame #9: 0x0000000200042bb7 dyld`dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 179
    frame #10: 0x000000020004b604 dyld`dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 466
    frame #11: 0x0000000200024d82 dyld`dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 144
    frame #12: 0x000000020002b65a dyld`dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const + 30
    frame #13: 0x0000000200024f0e dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 178
    frame #14: 0x0000000200024fb2 dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 108
    frame #15: 0x0000000200033e00 dyld`dyld4::APIs::dlopen_from(char const*, int, void*) + 592
    frame #16: 0x0000000108fce31a libmoar.dylib`dlLoadLibrary + 26
    frame #17: 0x0000000108e588d9 libmoar.dylib`MVM_nativecall_setup(tc=0x0000021766020180, body=0x0000021766102200, interval_id=0) at nativecall.c:422:25 [opt]
    frame #18: 0x0000000108e58d61 libmoar.dylib`MVM_nativecall_build(tc=<unavailable>, site=0x0000021766102180, lib=<unavailable>, sym=<unavailable>, conv=0x0000000000000000, in_arg_info=0x00000217661b12e8, ret_info=0x00000217661ba050) at nativecall.c:532:5 [opt]
    frame #19: 0x0000000108e34ecc libmoar.dylib`MVM_interp_run(tc=<unavailable>, initial_invoke=<unavailable>, invoke_data=<unavailable>, outer_runloop=0x0000000000000000) at interp.c:3826:42 [opt]
    frame #20: 0x0000000108fa55ae libmoar.dylib`MVM_vm_run_file(instance=0x0000021766010000, filename=<unavailable>) at moar.c:505:5 [opt]
    frame #21: 0x0000000100003a49 raku`main(argc=<unavailable>, argv=0x00000003040c7480) at main.c:474:5 [opt]
    frame #22: 0x000000020001552e dyld`start + 462

@coke
Copy link

coke commented Mar 3, 2023

The fact that rakudo was building as an x86_64 was the issue. This appears to be caused by rakubrew (perhaps --optimize)? Doing a source build of rakudo for tag 2023.02 gives an arm64 version, you can install the regular openssl for arm64 via brew, then everything works!

@2colours
Copy link

If that was the whole problem, perhaps this issue can be closed.

By the way, from what I heard, rakubrew can now build arm64 for new Mac, @coke have you tried it by any chance?

@ugexe
Copy link
Collaborator

ugexe commented Oct 19, 2023

see Raku/App-Rakubrew@8640a60

@coke
Copy link

coke commented Oct 19, 2023

Yes I can use rakubrew on the m2 now.

@librasteve
Copy link

I have macOS M1 and still getting OpenSSL need x86_64 error:

===> Testing: OpenSSL:ver<0.2.0>
[OpenSSL] Cannot locate native library '/opt/homebrew/opt/openssl@3/lib/libssl.dylib': dlopen(/opt/homebrew/opt/openssl@3/lib/libssl.dylib, 0x000A): tried: '/opt/homebrew/opt/openssl@3/lib/libssl.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/openssl@3/lib/libssl.dylib' (no such file), '/opt/homebrew/opt/openssl@3/lib/libssl.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/opt/homebrew/Cellar/openssl@3/3.2.0_1/lib/libssl.3.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/openssl@3/3.2.0_1/lib/libssl.3.dylib' (no such file), '/opt/homebrew/Cellar/openssl@3/3.2.0_1/lib/libssl.3.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
[OpenSSL]   in method setup at /Users/stephenroe/.rakubrew/versions/moar-2023.12/install/share/perl6/core/sources/E898049441B443C280D861A4EAA2F331ACB6C71D (NativeCall) line 319
[OpenSSL]   in method setup at /Users/stephenroe/.rakubrew/versions/moar-2023.12/install/share/perl6/core/sources/E898049441B443C280D861A4EAA2F331ACB6C71D (NativeCall) line 366
[OpenSSL]   in sub raku-nativecall at /Users/stephenroe/.rakubrew/versions/moar-2023.12/install/share/perl6/core/sources/57A566CF3ED7E3613CE88276530B060BD63E4183 (NativeCall::Dispatcher) line 46
[OpenSSL]   in method new at /Users/stephenroe/.rakubrew/versions/moar-2023.12/install/share/perl6/site/sources/8C02A22C326DBA2AA006EAFCACD6A03BF386883B (OpenSSL) line 36
[OpenSSL]   in block <unit> at t/01-basic.t line 6
[OpenSSL] # NETWORK_TESTING was not set

This is after rakubrew build moar-2023.12 and build-zef

I also installed (manually) an arm64 version of perl, thus:
curl -L -o download/perl-precomp.tar.gz https://github.com/skaji/relocatable-perl/releases/download/5.36.0.1/perl-darwin-arm64.tar.gz ...etc but this did not work for me ;-(

@ugexe
Copy link
Collaborator

ugexe commented Jan 5, 2024

Does homebrew install an arm64 OpenSSL? I think you’d need to answer that

@librasteve
Copy link

well its arm64 openssl

~ > file /opt/homebrew/opt/openssl@3/lib/libssl.dylib
/opt/homebrew/opt/openssl@3/lib/libssl.dylib: Mach-O 64-bit dynamically linked shared library arm64

installed by arm64 homebrew (https://github.com/orgs/Homebrew/discussions/3223)

~ > brew config
HOMEBREW_VERSION: 4.2.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 705d2564ddfb9c915ee9425dd9ed408bfac61005
Last commit: 4 days ago
Core tap JSON: 04 Jan 21:45 UTC
Core cask tap JSON: 04 Jan 21:45 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.WRYILj4ROm/org.xquartz:0
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.42.1 => /opt/homebrew/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.2.1-arm64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.1
Rosetta 2: false

@librasteve
Copy link

oh shoot, i have built me a x86 rakudo

~ > file /Users/stephenroe/.rakubrew/versions/moar-2023.12/install/bin/rakudo
/Users/stephenroe/.rakubrew/versions/moar-2023.12/install/bin/rakudo: Mach-O 64-bit executable x86_64

@ugexe
Copy link
Collaborator

ugexe commented Jan 5, 2024

@librasteve
Copy link

turns out I had an older version of rakubrew when I built my raku ... did a full nuke/install of rakubrew and then rakubrew build moar-2023.12

and now it shows

~ > file /Users/xxx/.rakubrew/shims/raku
/Users/xxx/.rakubrew/shims/raku: Mach-O 64-bit executable arm64

and now zef install OpenSSL works fine

thanks for all your advice!

@librasteve
Copy link

guess we can close this issue now

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