Installing xv6 on a macOSX 10.15 - macos

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

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!!!

How do I build the Firebird database extension (ext-interbase) for PHP on a MacOS M1 Monterey?

Firebird Extension for PHP on MacOS M1
I have PHP7.4 installed with homebrew and the Xcode command line tools.
I followed the instructions as per the source repository here https://github.com/FirebirdSQL/php-firebird using the following methodology, I have changed the Linux formula to suite the MacOS library locations as per this answer here
Issues compiling firebird driver for PHP-7.4 on macos:
git clone https://github.com/FirebirdSQL/php-firebird.git
cd php-firebird
phpize
CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Resources/lib ./configure
make
The error I get is
configure: error: libfbclient, libgds or libib_util not found! Check config.log for more information.
In the log file it refers to the following which is the crux of the issue
ld: warning: ignoring file /opt/firebird/lib/libib_util.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
The problem is that the Firebird package for Mac is only built for the 64bit architecture and not the ARM architecture.
Solution
I always seem to struggle building the extension for Firebird on MacOS (Intel or M1) and after a month of leaving the problem I discovered the solution which I leave here for myself all of you who have hit this wall, until ARM is supported on MacOS for Firebird we probably have to run the 64 bit version with 64 bit PHP. The steps below should get you up and running. I came up with 2 solutions, the first most obvious one was to make a docker build.
Docker Solution
docker run -v $(pwd):/app tina4stack/php -ini | grep interbase
Home brew solution
The second solution (more complicated) was to follow these steps, I don't always like to run a docker engine for simple things.
Install latest Firebird for MacOS
First, make sure you have installed the latest Firebird MacOS package, Firebird 3.0 at the time of writing has only one you can install.
The next problem I ran into was home-brew had installed an ARM version of PHP which made the linking to the x86_64 architecture impossible. Kudos to the documentation here https://austencam.com/posts/setting-up-an-m1-mac-for-laravel-development-with-homebrew-php-mysql-valet-and-redis
Install Rosetta
First I installed Rosetta (helps run 64 bit apps on MacOS ARM)
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Install Home-brew for 64bit architecture
Next I removed homebrew and reinstalled it with the arch -x86_64 bit flag
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install PHP7.4
Then installed a fresh php#7.4
arch -x86_64 brew install php#7.4
Compile the extension
git clone https://github.com/FirebirdSQL/php-firebird.git
cd php-firebird
phpize
CFLAGS='-arch x86_64' CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Resources/lib ./configure
make
sudo make install
Tying it all together
I added the following to my php.ini file
extension=interbase
If you don't know where to edit your ini file, run the following command:
php -ini | grep php.ini
When I ran php -ini | grep interpose I got errors about not finding the firebird libraries. In the end I copied the libraries to the PHP bin and lib folders
cp /Library/Frameworks/Firebird.framework/Resources/lib/* /usr/local/Cellar/php#7.4/7.4.25/lib
cp /Library/Frameworks/Firebird.framework/Resources/lib/* /usr/local/Cellar/php#7.4/7.4.25/bin
I'm sure someone could comment on making the above a bit neater but I was happy to find that the ini command returns now as expected.
php -ini | grep interbase
interbase
Let me know if you hit issues I didn't find, there were some other things I tried for the Firebird library resolution but I'm not sure they worked.
Installing modules with PECL
As an addition the the above solution, easily install other PHP modules using the following command
arch -x86_64 pecl install <module>
Example
arch -x86_64 pecl install openswoole

brew install OpenCV for macOS arm

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 .

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.

Home brew failing on “command ‘gcc’ failed with exit status 1″ error

I want to get started with geodjango and for this I have to install gdal. I am using MacOS 10.8.3
In order to do so with brew as advised in the geodjango documentation but I get the following error :
$brew install gdal
==> Downloading http://download.osgeo.org/gdal/1.10.0/gdal-1.10.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/gdal-1.10.0.tar.gz
==> ./configure --prefix=/usr/local/Cellar/gdal/1.10.0 --mandir=/usr/local/Cellar/gdal/1.10.0/share/man --with-local=/usr/local/Cellar/gdal/1.10.0 --with-threads --with-libtool -
==> make
==> make install
==> /Users/Lucas/.virtualenvs/geotest/bin/python setup.py install --prefix=/usr/local/Cellar/gdal/1.10.0 --record=installed.txt --single-version-externally-managed
gcc-4.2 -bundle -undefined dynamic_lookup -g -L/usr/local/opt/sqlite/lib -lsqlite3 -I/usr/local/opt/sqlite/include -arch x86_64 build/temp.macosx-10.6-intel-2.7/extensions/gdalconst_wrap.o -L../../.libs -L../../ -L/private/tmp/gdal-gOux/gdal-1.10.0/lib -lgdal -o build/lib.macosx-10.6-intel-2.7/osgeo/_gdalconst.so
Your Xcode and or CLT are mis-configured. Try some or all of the following:
xcodebuild -license
sudo xcode-select -switch /path/to/Xcode.app
error: command 'gcc-4.2' failed with exit status 1
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
These open issues may also help:
https://github.com/mxcl/homebrew/issues/19845
https://github.com/mxcl/homebrew/issues/20373
https://github.com/mxcl/homebrew/pull/20457
As advised, I did :
xcodebuild -license
and agreed to the licence, then :
sudo xcode-select -switch /Applications/Xcode.app
I also checked the issues but none of them was helpfull.
I have Xcode 4.6.3 installed and have brewed lots of other formulaes in the past without any problem.
When I run brew doctor, I get :
$brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
/Applications/Postgres.app/Contents/MacOS/bin/gdal-config
/Applications/Postgres.app/Contents/MacOS/bin/geos-config
/Applications/Postgres.app/Contents/MacOS/bin/uuid-config
/Applications/Postgres.app/Contents/MacOS/bin/xml2-config
I don't want to remove postgres.app from my path as it is necessary for the CLI of postgres.app configuration as explained here : http://postgresapp.com/documentation#toc_1
About the python from library, I tried to remove them using :
PATH=$(echo $PATH |sed 's/\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/bin//')
as advised here :https://www.linuxquestions.org/questions/linux-newbie-8/how-to-remove-directory-from-%24path-483463/. But it did not removed anything from the path.
So here I am not installing gdal ...
I found a workaround on SO, I can't find the original post but similar info is given on this one : Installing Scipy on Mac OS X Lion 10.7.5
So I added the following lines to my .bashrc and I then managed to brew install gdal.
export CC=gcc
export CXX=g++
Be aware that this did not solved my problem entirely as I still have config issue with geodjango, but at least I have gdal installed.

Resources