- Model : MacBook Pro (14-inch, 2021)
- CPU : Apple M1 Pro
- MENORY : 16GB
- DISK : 512 GB SSD
- OS : macOS 13.2.4 (22F66)
- TOOLS : Visual Studio Code, Java 11, Gradle, Docker
- Version Control : GitHub
- Programming Language : Java
- Framework : Spring Boot 2.7.12
- DBMS : MySql 8.0.33
- Step 1: Homebrew and Xcode Command Line Tools Installation
- Step 2: Install Miniforge
- Step 3: Create a virtual environment with python3.8
- Step 4: Install necessary dependencies
- Step 5: Compile and Build OpenCV
Step 1: Homebrew and Xcode Command Line Tools Installation
xcode-select --install
Step2: Install Miniforge
conda config --set auto_activate_base false
Step3: Create a virtual environment with python3.8
conda create --name testcv python=3.8
% conda create --name testcv python=3.8
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.1.0
latest version: 23.7.2
Please update conda by running
$ conda update -n base -c conda-forge conda
Or to minimize the number of packages updated during conda update use
conda install conda=23.7.2
## Package Plan ##
environment location: /miniforge3/envs/testcv
added / updated specs:
- python=3.8
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2023.7.22 | hf0a4a13_0 146 KB conda-forge
openssl-3.1.2 | h53f4e23_0 2.1 MB conda-forge
pip-23.2.1 | pyhd8ed1ab_0 1.3 MB conda-forge
python-3.8.17 |h3ba56d0_0_cpython 13.1 MB conda-forge
wheel-0.41.1 | pyhd8ed1ab_0 56 KB conda-forge
------------------------------------------------------------
Total: 16.8 MB
The following NEW packages will be INSTALLED:
bzip2 conda-forge/osx-arm64::bzip2-1.0.8-h3422bc3_4
ca-certificates conda-forge/osx-arm64::ca-certificates-2023.7.22-hf0a4a13_0
libffi conda-forge/osx-arm64::libffi-3.4.2-h3422bc3_5
libsqlite conda-forge/osx-arm64::libsqlite-3.42.0-hb31c410_0
libzlib conda-forge/osx-arm64::libzlib-1.2.13-h53f4e23_5
ncurses conda-forge/osx-arm64::ncurses-6.4-h7ea286d_0
openssl conda-forge/osx-arm64::openssl-3.1.2-h53f4e23_0
pip conda-forge/noarch::pip-23.2.1-pyhd8ed1ab_0
python conda-forge/osx-arm64::python-3.8.17-h3ba56d0_0_cpython
readline conda-forge/osx-arm64::readline-8.2-h92ec313_1
setuptools conda-forge/noarch::setuptools-68.0.0-pyhd8ed1ab_0
tk conda-forge/osx-arm64::tk-8.6.12-he1e0b03_0
wheel conda-forge/noarch::wheel-0.41.1-pyhd8ed1ab_0
xz conda-forge/osx-arm64::xz-5.2.6-h57fd34a_0
Proceed ([y]/n)?
conda activate testcv
Step4: Install necessary dependencies
conda install -c apple tensorflow-deps
Step5: Compile and Build OpenCV
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.8.0.zip
unzip opencv.zip && unzip opencv_contrib.zip
❸ opencv 소스 폴더에 build 폴더를 생성하고 이동한다.
cd opencv-4.8.0/
mkdir build && cd build
❹ cmake 을 실행하여 소스를 빌드한다. 실행 옵션은 아래와 같다.
Cmake 를 실행하면 아래와 같은 화면이 보여진다. 컴파일에는 그리 많은 시간이 소요되지 않는다.
❺ make 명령 사용 CMake가 생성한 Makefile을 기반으로 빌드 실행한다. 여기서 M1 맥의 경우 8코어 CPU 이기 때문에 j8은 옵션을 사용하여 make를 실행했다.
make[2]: *** No rule to make target `zlib', needed by `lib/libopencv_imgcodecs.4.8.0.dylib'. Stop
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install wget cmake
⑵ fatal error: 'ft2build.h' file not found
아래 명령을 입력하여 설치된 자바 경로를 확인하였다.
/usr/libexec/java_home --verbose
% /usr/libexec/java_home --verbose
Matching Java Virtual Machines (2):
17.0.8 (x86_64) "Amazon.com Inc." - "Amazon Corretto 17" /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
11.0.11 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home
댓글 없음:
댓글 쓰기