exp-trmf-nips16
exp-trmf-nips16 copied to clipboard
MacOS import TRMF error
I followed the python installation instruction on my MacOS, and everything seemed to run smoothly. When I try to import TRMF, I get the following error:
rm -rf trmf trmf*.so *.o
if [ "Darwin" = "Darwin" ]; then \
SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,trmf"; \
BLAS_LIB_FLAG="-framework Accelerate";\
else \
SHARED_LIB_FLAG="-shared -Wl,-soname,trmf"; \
BLAS_LIB_FLAG=" -Wl,--as-needed -Wl,-rpath,/Users/abdullah/TRMF/trmf-env/lib -L/Users/abdullah/TRMF/trmf-env/lib -lmkl_rt -lpthread -liomp5";\
fi; \
echo CXXFLAGs=-fopenmp -march=native -O3 -std=c++11 -fPIC; \
echo BLAS_LIB_FLAG=${BLAS_LIB_FLAG}; \
c++ -fopenmp -march=native -O3 -std=c++11 -fPIC -D ValueType=float ${SHARED_LIB_FLAG} -o trmf_float32.so trmf.cpp ${BLAS_LIB_FLAG} ; \
c++ -fopenmp -march=native -O3 -std=c++11 -fPIC -D ValueType=double ${SHARED_LIB_FLAG} -o trmf_float64.so trmf.cpp ${BLAS_LIB_FLAG}; \
CXXFLAGs=-fopenmp -march=native -O3 -std=c++11 -fPIC
BLAS_LIB_FLAG=-framework Accelerate
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [lib] Error 1
Traceback (most recent call last):
File "/Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/rf_util.py", line 24, in load_dynamic_library
_c_lib = CDLL(path_to_so)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/corelib/trmf_float32.cpython-37m-darwin.so, 6): Symbol not found: _GOMP_loop_ull_nonmonotonic_dynamic_next
Referenced from: /Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/corelib/trmf_float32.cpython-37m-darwin.so
Expected in: flat namespace
in /Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/corelib/trmf_float32.cpython-37m-darwin.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/__init__.py", line 2, in <module>
from .trmf import Model, Metrics
File "/Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/trmf.py", line 82, in <module>
_clib = corelib(corelib_path, soname, forced_rebuild=forced_rebuild)
File "/Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/trmf.py", line 21, in __init__
self.clib_float32 = load_dynamic_library(dirname, soname + '_float32', forced_rebuild=forced_rebuild)
File "/Users/abdullah/TRMF/exp-trmf-nips16/python/trmf/rf_util.py", line 31, in load_dynamic_library
raise Exception('{soname} library cannot be found and built.'.format(soname=soname))
Exception: trmf_float32 library cannot be found and built.
Please follow https://github.com/rofuyu/exp-trmf-nips16/tree/master/python#install-for-macos. It requires GCC to build the library (instead of the built-in clang). The error msg suggests that you might still use the clang to build the package. Please try to set the environment variables appropriately to install it on Mac.