Fasttext: make fail on MAC OS

Created on 14 Oct 2019  ·  5Comments  ·  Source: facebookresearch/fastText

Error happens after I cloned master and make:

`c++ -pthread -std=c++11 -march=native -O3 -funroll-loops -DNDEBUG args.o autotune.o matrix.o dictionary.o loss.o productquantizer.o densematrix.o quantmatrix.o vector.o model.o utils.o meter.o fasttext.o src/main.cc -o fasttext

Undefined symbols for architecture x86_64:
"fasttext::Autotune::kCutoffLimit", referenced from:
fasttext::Autotune::getCutoffForFileSize(bool, bool, int, long long) const in autotune.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make: * [fasttext] Error 1`

Did I do anything wrong? Since I have installed and uninstalled v0.8.22 fastText-github

Build bug

All 5 comments

And my python3.6 import fasttext errors too:

`import fasttext
File "/anaconda3/lib/python3.6/site-packages/fasttext/__init__.py", line 12, in
from .FastText import train_supervised
File "/anaconda3/lib/python3.6/site-packages/fasttext/FastText.py", line 12, in
import fasttext_pybind as fasttext
ImportError: dlopen(/anaconda3/lib/python3.6/site-packages/fasttext_pybind.cpython-36m-darwin.so, 2): Symbol not found: __ZN8fasttext8Autotune12kCutoffLimitE
Referenced from: /anaconda3/lib/python3.6/site-packages/fasttext_pybind.cpython-36m-darwin.so

Expected in: flat namespace
in /anaconda3/lib/python3.6/site-packages/fasttext_pybind.cpython-36m-darwin.so`

i have the same question

I had the same problem on macOS 10.15.1 + latest xcode-tools. Fasttext 0.9.1 and HEAD would fail importing, while 0.8.4 worked fine. Switching from Apple's old clang to homebrew fixed it for me:

  • brew install llvm
  • CXX=/usr/local/opt/llvm/bin/clang++ CC=/usr/local/opt/llvm/bin/clang pip install fasttext

Here's homebrew's clang version:

❯ /usr/local/opt/llvm/bin/clang -v                                                                
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

and Apple's:

❯ clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Users/bigo/opt/anaconda3/envs/char/bin

@dariobig , thanks a lot this helped me install on MAC

@dariobig this does not seem to solve things for me:

dev ➤ /usr/local/opt/llvm/bin/clang -v
clang version 11.0.0
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

dev ➤ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.6)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Your Apple LLVM is pointing to anaconda...

Was this page helpful?
0 / 5 - 0 ratings