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

support m1 #49

Open
wyu0hop opened this issue Oct 6, 2021 · 4 comments
Open

support m1 #49

wyu0hop opened this issue Oct 6, 2021 · 4 comments

Comments

@wyu0hop
Copy link

wyu0hop commented Oct 6, 2021

i cannot run it on mac m1

@wyu0hop
Copy link
Author

wyu0hop commented Oct 6, 2021

CRITICAL Unexpected error:
Traceback (most recent call last):
File "/Users/ba1yu2/.venvs/mariana-trench/lib/python3.9/site-packages/mariana_trench/shim/shim.py", line 583, in main
output = subprocess.run(command)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/Users/ba1yu2/.venvs/mariana-trench/bin/mariana-trench-binary'

@yuhshin
Copy link

yuhshin commented Oct 6, 2021

Hi @wyu0hop, thanks for reaching out!

Mac m1 is not currently supported with the pip install (assuming that is what you have set up).

A workaround for now would be to build from source: https://mariana-tren.ch/docs/contribution#building-from-source

@nanashili
Copy link

I tried building the binary but for some reason i can't get past building for Regex

@chenguangshen
Copy link

Hey Mariana Trench team, hope you all are doing well :)

It looks like some workaround are needed for building from source on M1 Mac. Sharing here in case others ran into similar issues:

  1. For building Redex from source (https://mariana-tren.ch/docs/contribution/#building-redex), one of its required dependency, zlib, is keg-only for Homebrew on Mac, and therefore the path to the static/shared library needed to be passed in explicitly for cmake to work:
cmake -DCMAKE_INSTALL_PREFIX="$MT_INSTALL_DIRECTORY" -DZLIB_STATIC_LIB=/opt/homebrew/opt/zlib/lib/libz.a -DZLIB_SHARED_LIB=/opt/homebrew/opt/zlib/lib/libz.1.2.12.dylib ..
  1. Mariana Trench requires the fmt library 7.1.2. However it looks like the latest version on Homebrew is 9.1.0 and version 9 introduced additional requirements on formatting user defined types (https://fmt.dev/latest/api.html#udt), which will cause a build error for Mariana Trench's fmt usage in Log.h. I had to build fmt version 7.1.2 from source (https://github.com/fmtlib/fmt/tree/7.1.2), then passing in the library path for cmake to work.
  2. Small nit: in Mariana Trench's CMakeLists.txt, it searches for $ANDROID_SDK but only $ANDROID_DX is used by cmake and should be set. https://github.com/facebook/mariana-trench/blob/main/CMakeLists.txt#L177

Based on 2 and 3, the cmake command for Mariana Trench that worked for me:

cmake -DREDEX_ROOT="$MT_INSTALL_DIRECTORY" -DCMAKE_INSTALL_PREFIX="$MT_INSTALL_DIRECTORY" -DANDROID_DX=/path/to/sdk/build-tools/33.0.0/d8 -Dfmt_DIR=/path/to/fmt/build ..

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

4 participants