I've been trying to complile php apcu on my m1 mac without success, everythime I compile it produces:
modules/apcu.so: Mach-O 64-bit bundle x86_64
I've tried with the following options (cleaning and building each time) with no luck:
./configure --with-php-config=/opt/homebrew/opt/valet-php@7.2/bin/php-config --target=aarch64-apple-darwin20 --host=aarch64-apple-darwin20 --build=aarch64-apple-darwin20
./configure --with-php-config=/opt/homebrew/opt/valet-php@7.2/bin/php-config --target=arm64-apple-macos11
./configure --with-php-config=/opt/homebrew/opt/valet-php@7.2/bin/php-config --target=arm-apple-darwin
./configure --with-php-config=/opt/homebrew/opt/valet-php@7.2/bin/php-config --target=aarch64-apple-darwin20
file modules/apcu.so
modules/apcu.so: Mach-O 64-bit bundle x86_64
I did some googling and found different articles which all seemed to get arm64-apple-darwin20.1.0
when checking there target for cc, but I get the following:
~/D/apcu ❯❯❯ clang++ --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~/D/apcu ❯❯❯ cc --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~/D/apcu ❯❯❯ ./config.guess
x86_64-apple-darwin20.3.0
I raised an issue to then github here - https://github.com/krakjoe/apcu/issues/419
Does anyone have any ideas? Not done much compling before so any help would be awesome! thanks!
It reads x86_64
and not ARM64
(or alike). Try to clean the project once and then configure and build it again for the correct architecture (as you might have previously cross-compiled that file for the wrong architecture).
After some help from some very helpful people on twitter I found I was running the commands from a terminal which had launched bash into i386 mode and not arm64 like I thought.
I was using vscode built in terminal which showed i386 when running arch
. When performing arch
from iterm it showed arm64. After trying my commands from iterm everything worked as expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.