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

swigfaiss.so incompatible with mac arm64 #2432

Closed
2 tasks
CaucherWang opened this issue Aug 26, 2022 · 8 comments
Closed
2 tasks

swigfaiss.so incompatible with mac arm64 #2432

CaucherWang opened this issue Aug 26, 2022 · 8 comments
Labels

Comments

@CaucherWang
Copy link

Summary

swigfaiss.so cannot be read by arm infrastructure, like Apple M1

Platform

OS: macOS 12.5

Installed from: compiled from source

Faiss compilation options: --without-cuda

Running on:

  • CPU

Interface:

  • Python

Reproduction instructions

at python/Makefile, I only have the rule to generate swigfaiss.so, despite in arm64 infra.

when I try to import faiss:
ImportError: dlopen(/faiss-learned-termination/python/faiss/_swigfaiss.so, 0x0002): tried: '/faiss-learned-termination/python/faiss/_swigfaiss.so' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))

@mdouze mdouze added the install label Aug 29, 2022
@mdouze
Copy link
Contributor

mdouze commented Aug 29, 2022

you mean you are cross-compiling by accident?

@CaucherWang
Copy link
Author

No, I want to build Faiss on my MBP(arm infra.),but meet problems on the python interface, where the makefile can only generate swigfaiss.so rather than "swigfaiss.dylib".
.so in the python package cannot be used in mac.

@wx257osn2
Copy link
Contributor

the makefile can only generate swigfaiss.so rather than "swigfaiss.dylib".
.so in the python package cannot be used in mac.

So this is not a problem with arm64 , but a problem on macOS with arm64 . I install and develop faiss on Linux with arm64.

Then, how did you install swig and other dependencies of faiss? And how did you build faiss? I think that current information is not enough to help you.

@CaucherWang CaucherWang changed the title swigfaiss.so incompatible with arm64 swigfaiss.so incompatible with mac arm64 Sep 2, 2022
@CaucherWang
Copy link
Author

the makefile can only generate swigfaiss.so rather than "swigfaiss.dylib".
.so in the python package cannot be used in mac.

So this is not a problem with arm64 , but a problem on macOS with arm64 . I install and develop faiss on Linux with arm64.

Then, how did you install swig and other dependencies of faiss? And how did you build faiss? I think that current information is not enough to help you.

You are right! I have changed the title by adding "mac".
I install swig (4.0.2) by homebrew, and build Faiss as the guidelines in INSTALL.md (lines 100-132)

@wx257osn2
Copy link
Contributor

Hmm, it seems that current homebrew has prebuilt swig for apple silicon, so swig probably works correctly. Of course your homebrew is for arm64, not for x86_64, right?

@CaucherWang
Copy link
Author

Hmm, it seems that current homebrew has prebuilt swig for apple silicon, so swig probably works correctly. Of course your homebrew is for arm64, not for x86_64, right?

Yes, my homebrew is for arm64.
% brew -v
Homebrew 3.5.9-138-gd81bd6a
Homebrew/homebrew-core (git revision bb6e3862b8f; last commit 2022-08-22)
Homebrew/homebrew-cask (git revision 7eb97cddbc; last commit 2022-08-22)

% swig -version

SWIG Version 4.0.2

Compiled with clang++ [arm-apple-darwin21.1.0]

Configured options: +pcre

@wx257osn2
Copy link
Contributor

@CaucherWang Hmm... some people had succeeded to build faiss on M1 Mac like #2111 and #2386, so it should be able, but actually I have no mac environment, so I can't any check at my own... Would you show me your CMake command and log?

@mdouze
Copy link
Contributor

mdouze commented Sep 9, 2022

@mdouze mdouze closed this as completed Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants