본문 바로가기
Embedded OS

Mac OS 환경에서 crosstool-ng 문제 기록

by 코딩스미스 2023. 3. 9.

https://www.sakishum.com/2022/01/22/Mac-OSX%E4%B8%8B%E6%89%A7%E8%A1%8Ccrosstool-ng%E9%97%AE%E9%A2%98%E8%AE%B0%E5%BD%95/#/%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95-1

 

Mac OSX下执行crosstool-ng问题记录

环境系统:MacOS Big Sur 11.6.1 ct-ng:GNU Make 4.3 / Built for x86_64-apple-darwin20.1.0 前言在Mac下面使用HomeBrew安装了crosstool-ng来编译aarch64上的代码,结果在执行的时候报告如下错误: 12345ct-ng source[INFO ] Perfor

sakishum.com

환경

계통: macos ventura version 13.2.1

ct-ng: GNU Make 4.4.1 Built for aarch64-apple-darwin22.3.0

 

머리말

homebrew로 설치한 crosstool-ng를 사용하여 크로스 툴체인 빌드하는 과정에서 아래와 같은 문제 발생하였다.

❯ ct-ng build
[INFO ]  Performing some trivial sanity checks
[WARN ]  Number of open files 256 may not be sufficient to build the toolchain; increasing to 2048
[ERROR]  Your file system in '/Users/hjkim1228/Developments/crosstoolchain/.build' is *not* case-sensitive!
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_Abort[scripts/functions@487]
[ERROR]  >>        called from: CT_TestAndAbort[scripts/functions@507]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@122]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      https://crosstool-ng.github.io/docs/known-issues/
[ERROR]  >>
[ERROR]  >>  If you feel this is a bug in crosstool-NG, report it at:
[ERROR]  >>      https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR]  >>
[ERROR]  >>  Make sure your report includes all the information pertinent to this issue.
[ERROR]  >>  Read the bug reporting guidelines here:
[ERROR]  >>      http://crosstool-ng.github.io/support/
[ERROR]
[ERROR]  (elapsed: 27972880:59.00)
[00:00] / gmake: *** [/opt/homebrew/bin/ct-ng:261: build] Error 1

발생한 문제

Number of open files 256 may not be sufficient to build the toolchain; increasing to 2048

 

문제원인

질문 프롬프트의 문자적 의미

 

해결책

컴파일 디렉터리에서 다음 명령을 실행합니다.

# 이렇게 하면 열린 파일(-n)에 대한 소프트 제한이 4096으로 늘어납니다. 
ulimit -S -n 4096

발생한 문제

Your file system in '/Users/hjkim1228/Developments/crosstoolchain/.build' is *not* case-sensitive!

 

문제원인

기본적으로 Mac의 시스템 드라이브가 Mac OS 확장(HFS+) 또는 APFS로 포맷되었는지 여부에 관계없이 대소문자를 구분하지 않는 드라이브로 포맷됩니다.

 

해결책

비교적 간단한 해결책은 대소문자 구분을 지원하는 파일을 생성하고 파티션으로 마운트한 다음 이 파티션에 코드를 복사하여 컴파일을 실행하는 것입니다.

 

파티션 파일 생성

hdiutil create -volname "Aarch64" -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 20g aarch64.dmg

마운트 파티션

hdiutil attach aarch64.dmg.sparseimage -mountpoint /Volumes/aarch64 
# 마운트 디렉토리로 전환 
cd /Volumes/aarch64/

ct-ng menuconfig 실행

1.Paths and misc options"를 선택하고 " Select"를 선택한 다음 Enter 버튼을 클릭합니다.

2. 아래쪽 방향 버튼을 클릭하고 " (${Home}/src) Local tarballs directory", 이 항목을 찾아 " Select"를 선택하고 Enter 버튼을 클릭하여 " /Volumes/aarch64/src "로 수정한 다음, 

계속 아래로 내려가서 " " (${Home}/x-tools/${CT_TARGET}) Prefix directory, 이 항목을 찾고 선택한 Select다음 를 클릭합니다 . 키를 입력하고 " /Volumes/aarch64/x-tools/${CT_TARGET}" 로 변경

작업 완료 후 버튼을 계속 빠르게 누르면 Esc아래 그림과 같이 마지막에 팝업되는 확인 저장 창에서 저장을 선택합니다.

 

파티션 마운트 해제

hdiutil detach /Volumes/aarch64

'Embedded OS' 카테고리의 다른 글

cross compile 참고자료  (0) 2023.03.14
리눅스 커널/드라이버 개발을 위한 맥 셋팅  (0) 2023.03.11
크로스 툴체인 준비하기  (0) 2023.03.09