brew install OpenCV for macOS arm - macos

i am using macOS arm, and install OpenCV for c++ using this command:
brew install --build-from-source OpenCV
download packages completed, and then i get this error:
==> Installing OpenCV
Error: An exception occurred within a child process:
RuntimeError: Unexpected architecture: arm64. This only works with Intel architecture.
can you help me?

This command should work as well.
brew install opencv
If this command shows any error you may share.

Clone sources
git clone https://github.com/opencv/opencv.git
Create build directory
mkdir -p build && cd build
Configure
cmake ../opencv
Build
cmake --build .

Related

Getting this error message while installing solana: error: failed to run custom build command for `prost-build v0.10.1`

I'm got this error after running this command: ./scripts/cargo-install-all.sh .
error: failed to run custom build command for `prost-build v0.10.1`
I'm installing solana on m1 mac
Anyone please help me with this.
The prost-build crate compilation is failing because it can't find protocol-buffer implementation, and the crate build.rs tries to compile it via cmake (which you don't have installed).
I solved it by installing protocol-buffers directly, but since there are problems with the pre-compiled binary in M1 you have to compile it locally. It's simple:
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
brew install autoconf
brew install automake
brew install Libtool
autoreconf -i
./autogen.sh
./configure
make
make check
sudo make install
export PATH=/opt/usr/local/bin:$PATH
This works!!!

Error when importing XGBoost on Apple M1?

Has anyone figured out how to make XGboost work with Apple M1?
I have tried multiple things to fix it, but it does not work.
I have tried reinstalling it; pip and pip3 and python -m pip and conda install; brew install limpomp; brew install gcc#8; Downloading source code and compiling locally.
It seems XGboost does not work on Apple M1.
Here is the error, this occurs when I import xgboost in my script:
XGBoostError: XGBoost Library (libxgboost.dylib) could not be loaded.
Likely causes:
* OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libomp.dylib for Mac OSX, libgomp.so for Linux and other UNIX-like OSes). Mac OSX users: Run `brew install libomp` to install OpenMP runtime.
* You are running 32-bit Python on a 64-bit OS
Error message(s): ['dlopen(/opt/anaconda3/envs/msc-env/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib\n Referenced from: /opt/anaconda3/envs/msc-env/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib\n Reason: image not found']
i'd got the same issue on MacBook Pro (13-inch, M1, 2020) with chip Apple M1, fortunately after of hours of some researches i got the solution, you just follow the following instruction:
brew install libomp
conda install -c conda-forge py-xgboost
https://discuss.xgboost.ai/t/xgboost-on-apple-m1/2004/8
How to install xgboost in python on MacOS?
A combination of the answer from cherry (first) and Christoffer (second) work for me with miniforge interpreter:
Make sure gcc-11 (and g+±11) is installed, if not do so with
brew install gcc#11
brew install cmake
Then, do the following
git clone --recursive https://github.com/dmlc/xgboost
mkdir xgboost/my_build
cd xgboost/my_build
CC=gcc-11 CXX=g++-11 cmake ..
make -j4
cd ../python_package
/Users/xx/miniforge3/envs/MLEnv/bin/python setup.py install
With the path to you miniforge venv
I put Terminal in Rosetta mode first before installing brew. This way I'm essentially running intel version of the packages. I provided more details in this gist.

Installing xv6 on a macOSX 10.15

I've been trying to install xv6 on my macOSX through terminal.
I used the command brew install qemu to install qemu and have hit the codes:
sudo port install i386-elf-gcc
and after modifying the Makefile from i386-jos-elf to i386-elf- I'm receiving the following message on trying to run xv6 when I hit the code:
cd xv6-public
make
the following message:
Error: Couldn't find an i386--elf version of GCC/binutils.
Is the directory with i386-jos-elf-gcc in your PATH?
If your i386--elf toolchain is installed with a command
prefix other than 'i386-jos-elf-', set your TOOLPREFIX
environment variable to that prefix and run 'make' again.
To turn off this error, run 'gmake TOOLPREFIX= ...'.
gcc -m32 -gdwarf-2 -Wa,-divide -c -o usys.o usys.S
Any help would be greatly appreciated.
Maybe the xv6 version you downloaded is out of date. I also encountered this problem today. After updating to the latest version, it can be successfully compiled.
The version downloaded with this command seems to be more advanced.
git clone git://github.com/mit-pdos/xv6-riscv-fall19.git
You can try this tutorial. I succeeded by his method today.
This is the tutorial but written in Chinese
Installing pre-requisite libraries
brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat
Installing the RISC-V GNU toolchain
brew tap riscv/riscv
brew install riscv-tools
path=(/usr/local/opt/riscv-gnu-toolchain/bin ${path})
Installing QEMU
brew install qemu
Installing xv6
git clone --depth 1 --single-branch \
https://github.com/mit-pdos/xv6-riscv.git \
./xv6
Running xv6:
cd ./xv6
make qemu

What is this error `make.exe": no_c_compiler: Command not found`

I'm trying to build grpc from source on Windows 2012 Server edition. I downloaded and installed Python 3.5 from the Python website and installed the entire MinGW package as well as git along with git bash. Following the instructions for building from source:
$ git clone https://github.com/grpc/grpc.git
$ cd grpc
$ git submodule update --init
$ make
$ [sudo] make install
I get the aforementioned error after executing make. Here's the shell output for your perusal.
PS C:\Users\thunderboltsid\grpc> make
[MAKE] Generating /c/Users/thunderboltsid/grpc/libs/opt/pkgconfig/grpc.pc
[MAKE] Generating /c/Users/thunderboltsid/grpc/libs/opt/pkgconfig/grpc_unsecure.pc
[MAKE] Generating cache.mk
[C] Compiling third_party/zlib/adler32.c
make.exe": no_c_compiler: Command not found
make.exe": *** [/c/Users/thunderboltsid/grpc/objs/opt/third_party/zlib/adler32.o] Error 127
I really can't understand what is this error supposed to be. Tried googling but that didn't help. Any input will be appreciated.
you may need run apt-get install which
install build-base in your system, example:
apt-get install build-base
You may simply have no C compiler installed, not even gcc. If that's the reason then installing gcc resolves the issue:
apt get install gcc

h5py setup.py on Mac: hdf5.h file not found

I am building h5py on Mac, following instructions "Building against Parallel HDF5" in this link: http://docs.h5py.org/en/latest/build.html
$ export CC=mpicc
$ python setup.py configure --mpi
$ sudo python setup.py build
I get this error:
h5py-2.5.0/h5py/api_compat.h:27:10: fatal error: 'hdf5.h' file not found
What should I do? If I need to install some dev version of HDF5, how can I do it on Mac?
I was getting this same error message yesterday, doing a general installation of HDF5 (not building against parallel). I was able to get around it by using Homebrew (a package manager for OS X that can be found here: http://brew.sh/).
Once you've installed Homebrew (if you don't already have it), the command is brew install hdf5.
You can find hdf5.h lib in your Unix and set in CPATH varible
freebsd 11 example:
>> find /usr -iname "*hdf5.h*"
<< /usr/local/include/hdf5.h
>> export CPATH="/usr/local/include/"
Then you can compile that you need

Resources