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

Fails to load on Apple silicon CPUs because libfzf.so is built only for Intel CPUs #119

Closed
proofer opened this issue Dec 17, 2023 · 4 comments

Comments

@proofer
Copy link

proofer commented Dec 17, 2023

Workaround: run nvim under Rosetta (on the fly Intel to Apple silicon binary code translator). E.g., use the
arch -x86_64 nvim ... command to start nvim.

Fix: in Makefile, add CFLAGS to build libfzf.so for the CPU architecture on which make is running; as in my fork's Makefile.

@proofer proofer changed the title Fails to load running on Apple silicon because libfzf.so is built only for Intel CPUs Fails to load on Apple silicon CPUs because libfzf.so is built only for Intel CPUs Dec 17, 2023
@Conni2461
Copy link
Member

see #79

currently the way the makefile is setup it should be enough to just do CFLAGS=-arch arm64 make or maybe even this works CFLAGS=-march=native make

i dont have mac, so i cant test any of this and provide a fix. Like back over a year ago i am happy to merge one :) i am just the wrong person to create one, as i have not the reasources to even test a single solution (m1 or intel based) ...

so yeah please open a PR if you have a working solution

@proofer
Copy link
Author

proofer commented Dec 17, 2023

I don't think CFLAGS=-arch arm64 make and similar would be a general solution -- it wouldn't work for Intel CPU Macs. CFLAGS += -march=native may work, but it bothers me that I can't find doc on native; do you have a pointer?

In my fork I inserted...
ifeq ($(UNAME_S),Darwin)
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CFLAGS += -arch x86-64
endif
ifeq ($(UNAME_P)),arm)
CFLAGS += -arch arm64
endif
endif

I'm not sure it's the most elegant solution, especially if =natiive would work, but I don't yet know why it wouldn't work on any Mac. It works on my M2 Mac. I should be able to test it on an Intel Mac. Would a test on just those two systems be enough for a PR? Maybe I should note that any PR I open would be my first ever.

@rywng
Copy link

rywng commented Jan 2, 2024

I don't think CFLAGS=-arch arm64 make and similar would be a general solution -- it wouldn't work for Intel CPU Macs. CFLAGS += -march=native may work, but it bothers me that I can't find doc on native; do you have a pointer?

https://wiki.gentoo.org/wiki/GCC_optimization#-march

or

https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/AArch64-Options.html#index-march

The wiki says march=native works in GCC, but I'm not sure if apple's clang supports it, you can try it out.

I don't have a arm device to test, but the following works for me on a AMD64 CPU:

-- lazy.nvim config
	{
		'nvim-telescope/telescope-fzf-native.nvim',
		build = 'CFLAGS=-march=native make',
		lazy = true
	},

@proofer
Copy link
Author

proofer commented Jan 2, 2024

build = 'CFLAGS=-march=native make'

works on my Apple silicon Mac!

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

3 participants