mac 에서 cmake 빌드시 -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ 로 llvm clang 을 사용하면 다음과 같은 에러가 발생한다.
rapidjson/document.h:319:82: error: cannot assign to
non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')
rapidjson/document.h:319:82: error: cannot assign to
non-static data member 'length' with const-qualified type 'const SizeType' (aka 'const unsigned int')
DCMAKE_CXX_COMPILER 옵션을 제거해 기본 apple clang 을 사용하도록 하면 된다.
Apple Clang
- 출처: Apple이 Xcode에 포함하여 배포
- 버전: 독자적 버전 체계 (예: Apple clang 16.x)
- 업데이트: Xcode 업데이트에 종속, 느림
- 기능: Apple 플랫폼 최적화 (Obj-C, Metal, arm64e 등)
- 엄격함: 상대적으로 관대
- libc++: Apple 자체 패치된 libc++
- 경로
/usr/bin/clang --version
/usr/bin/c++ --version
/Library/Developer/CommandLineTools/usr/bin/c++ --version
Apple clang version 17.0.0 (clang-1700.6.4.2)
Target: arm64-apple-darwin25.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
LLVM Clang (Homebrew)
- 출처: llvm.org 공식 릴리스
- 버전: 업스트림 버전 그대로 (예: clang 19.x)
- 업데이트: 최신 LLVM 릴리스 바로 반영
- 기능: 최신 C++ 표준, sanitizer, 경고 규칙 반영 빠름
- 엄격함: 더 엄격한 경고/에러 정책
- libc++: 업스트림 libc++
- 경로
/opt/homebrew/opt/llvm/bin/clang --version
/opt/homebrew/opt/llvm/bin/clang++ --version
Homebrew clang version 22.1.0
Target: arm64-apple-darwin25.3.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/22.1.0/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin25.cfg
comments:
댓글 쓰기