IT 개발 관련

Protobuf Installation script for Macbook M1

SeanYoon 2021. 10. 14. 19:02

Macbook M1에서 GRPC를 위한 Protobuf 설치에 문제가 있습니다.

따라서 소스를 내려 받은 후에 로컬에서 컴파일 하는 과정을 거치는 것이 안전한 방법입니다.

 

아래 스크립트를 따라 하시면 homebrew 부터 차근 차근 설치합니다.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

export PATH=/opt/homebrew/bin:$PATH
git clone https://github.com/protocolbuffers/protobuf.git
arch -arm64 brew install autoconf
arch -arm64 brew install automake
arch -arm64 brew install Libtool

cd protobuf
autoreconf -i
./autogen.sh
./configure
make
make check
sudo make install
export PATH=/opt/usr/local/bin:$PATH

Go 언어로 개발하시는 분들은 다음의 두개를 추가로 설치해주시면 됩니다.

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

참고로 protoc에서 기본 제공하는 라이브러리들을 못 읽어오는 경우들이 있습니다. 이런 경우에는 디렉토리 권한을 사용하시는 유저에게 주셔야 합니다.

에러 메시지는 임포트 하시는 라이브러리에 따라서 다른데...

"google.protobuf.Timestamp" is not defined.

이런 메시지가 뜹니다.

 

그러시면 아래의 작업을 한번 해주세요. [user] 부분에 현재 사용중인 맥 사용자 아이디를 넣어줍니다.

sudo chown -R [user] /usr/local/include/google

 

2021.07.30 - [프로그래밍] - Pub-Sub 구현 : Go + Google Protocol Buffers + Nats + Github.com

 

끝~~

 

https://developers.google.com/protocol-buffers

 

Protocol Buffers  |  Google Developers

Protocol buffers are a language-neutral, platform-neutral extensible mechanism for serializing structured data.

developers.google.com

 

반응형