equinor / segyio

Fast Python library for SEGY files.
Other
471 stars 213 forks source link

install error width Mac M1 #521

Closed lichuang3698 closed 1 month ago

Bersano commented 2 years ago

I think you have to use terminal from rosetta, then it will be successful

ofmla commented 2 years ago

I don't know what the original message above said but I wasn't able to build segyio (v 1.9.9) on Mac OSX using M1. After run make I got the following error

[  0%] Built target doc
[  3%] Building CXX object external/catch2/CMakeFiles/catch2.dir/dummy.cpp.o
[  7%] Linking CXX static library libcatch2.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: libcatch2.a the table of contents is empty (no object file members in the library define global symbols)
[  7%] Built target catch2
[ 11%] Building C object lib/CMakeFiles/segyio.dir/src/segy.c.o
[ 14%] Linking C shared library libsegyio.dylib
[ 14%] Built target segyio
[ 18%] Building CXX object lib/CMakeFiles/c.segy.dir/test/testsuite.cpp.o
/var/folders/4d/m6mrl1nj061f_p99n7typgmr0000gn/T//ccUp9JEZ.s:22111:2: error: unrecognized instruction mnemonic, did you mean: bit, cnt, hint, ins, not?
        int $3
        ^
make[2]: *** [lib/CMakeFiles/c.segy.dir/test/testsuite.cpp.o] Error 1
make[1]: *** [lib/CMakeFiles/c.segy.dir/all] Error 2
make: *** [all] Error 2

Here is my cmake command: cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=~/ -DPYTHON_EXECUTABLE=/Users/oscarmojica/miniforge3/bin/python -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 and its respective output.

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/bin/gcc-11 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/bin/g++-11 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could not find version, guessing 0.0.0
-- segyio version 0.0.0
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for getopt_long
-- Looking for getopt_long - found
-- Looking for _fstati64
-- Looking for _fstati64 - not found
-- Looking for _ftelli64
-- Looking for _ftelli64 - not found
-- Looking for ftello
-- Looking for ftello - found
-- Found PythonInterp: /Users/oscarmojica/miniforge3/bin/python (found version "3.9.10") 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/oscarmojica/Downloads/segyio-1.9.9/build

does anyone have some advice?

tasansal commented 1 year ago

I am able to build on M1 Max. I believe this issue is resolved. Here is my build script.

Assuming you're at the source dir of segyio:

PYTHONPATH=<your-interpreter-path>
VIRTUAL_ENV=<your-env-root>

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
make -j10
make install

If using conda environment, $CONDA_PYTHON_EXE is your PYTHONPATH and $CONDA_PREFIX is your VIRTUAL_ENV

tasansal commented 1 year ago

I built ARM64 wheels for the latest segyio 1.9.11 for MacOS 11 cpython3.8-3.11 manually and posted them to this PR if anyone wants to use it or upload to PyPI given permission: https://github.com/equinor/segyio/pull/536#issuecomment-1532280601

ajaust commented 7 months ago

I can also build segyio on M1 Max. Additionally, as mentioned in https://github.com/equinor/segyio/issues/534, we now have builds that natively support Mac M1.

sebastianvitterso commented 1 month ago

This issue can be closed, as the problem no longer persists @sveinung-r.