Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 249. Visual Studio 2013에서 Mono 컴파일하는 방법 [링크 복사], [링크+제목 복사],
조회: 17724
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

Visual Studio 2013에서 Mono 컴파일하는 방법

모노(Mono) 프로젝트는 오픈 소스이기 때문에 다음의 경로에서 다운로드 받을 수 있습니다.

Mono open source ECMA CLI, C# and .NET implementation.
; https://github.com/mono/mono

압축을 푼 후 "\mono-master\msvc" 폴더에 가면 "mono.sln" 파일이 있습니다. 이것은 Visual Studio 2012용으로 맞춰져 있으므로 가장 좋은 것은 2012에서 로드하는 것이 좋습니다. 저는 2012가 없고 2013이 있는데, mono.sln을 Visual Studio 2013에서 로드하면 마이그레이션 여부를 묻는다는 차이만 있을 뿐 그대로 진행하면 됩니다.

만약, 마이그레이션을 하지 않고 진행하면 Visual Studio 2012가 설치되지 않은 경우 다음과 같은 컴파일 오류를 만나게 됩니다.

error MSB8020: The build tools for Visual Studio 2012 (Platform Toolset = 'v110') cannot be found. To build using the v110 build tools, please install Visual Studio 2012 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...". C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets


그럼, Visual Studio 2012를 설치하든지, 아니면 다시 수작업으로 해당 프로젝트들을 모두 2013용 툴셋으로 업그레이드 해야 합니다. (솔루션 탐색기에서 마우스 우측 버튼으로 "Upgrade VC++ Projects..." 메뉴를 선택하면 됩니다.)

자, 이제 빌드하면 다른 프로젝트는 모두 잘 컴파일이 되지만 "monoposixhelper"만 다음과 같은 오류가 발생합니다.

error C1189: #error :  "Mono requires WinXP SP2 or later"   e:\mono\mono-master\config.h

웬일인지, monoposixhelper 프로젝트에서 _WIN32_WINNT 상수가 정의되지 않았는데요. 오류가 발생한 "e:\mono\mono-master\config.h" 파일을 열어,

#if _WIN32_WINNT < 0x0502
#error "Mono requires WinXP SP2 or later"
#endif /* _WIN32_WINNT < 0x0502 */

_WIN32_WINNT 상수를 억지로 넣어줘도 여전히 컴파일 오류가 발생합니다. 왜냐하면 config.h 파일은 monoposixhelper 프로젝트가 의존하고 있는 genmdesc 프로젝트, 다시 그 프로젝트가 의존하고 있는 libmonoutils 프로젝트의 "PreBuildEvent"에 설정된 winsetup.bat 파일로부터 자동 생성되기 때문입니다. /mono-master/msvc/winsetup.bat 파일의 내용을 보면,

@echo off
cd ..
copy winconfig.h config.h
goto end
:error
echo fatal error: the VSDepenancies directory was not found in the "mono" directory
echo error: you must download and unzip that file
exit /b 100
goto end
:ok
echo OK
:end
exit /b 0

결국 winconfig.h 헤더 파일이 복사되는 것 뿐인데요. 따라서 그 파일의 내용에 _WIN32_WINNT 상수를 추가해 주면 됩니다.

#define _WIN32_WINNT 0x0503

#if _WIN32_WINNT < 0x0502
#error "Mono requires WinXP SP2 or later"
#endif /* _WIN32_WINNT < 0x0502 */

그런 다음 monoposixhelper 프로젝트를 Rebuild 해주시면 정상적으로 빌드됩니다. 빌드 결과물은 "\mono-master\msvc" 폴더의 하위에 x86 용인 Win32를 타겟으로 한 빌드의 경우 Win32 폴더로, x64 빌드는 x64 폴더로 저장됩니다.

그래도, 여타의 다른 규모 있는 오픈 소스보다는 빌드가 꽤나 간단한 편에 속하는 군요. ^^




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 7/10/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 16  17  [18]  19  20  21  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
13198정성태12/18/20224816.NET Framework: 2080. C# - Microsoft.XmlSerializer.Generator 처리 없이 XmlSerializer 생성자를 예외 없이 사용하고 싶다면?파일 다운로드1
13197정성태12/17/20224609.NET Framework: 2079. .NET Core/5+ 환경에서 XmlSerializer 사용 시 System.IO.FileNotFoundException 예외 발생하는 경우파일 다운로드1
13196정성태12/16/20224816.NET Framework: 2078. .NET Core/5+를 위한 SGen(Microsoft.XmlSerializer.Generator) 사용법
13195정성태12/15/20225300개발 환경 구성: 655. docker - bridge 네트워크 모드에서 컨테이너 간 통신 시 --link 옵션 권장 이유
13194정성태12/14/20225411오류 유형: 833. warning C4747: Calling managed 'DllMain': Managed code may not be run under loader lock파일 다운로드1
13193정성태12/14/20225520오류 유형: 832. error C7681: two-phase name lookup is not supported for C++/CLI or C++/CX; use /Zc:twoPhase-
13192정성태12/13/20225572Linux: 55. 리눅스 - bash shell에서 실수 연산
13191정성태12/11/20226479.NET Framework: 2077. C# - 직접 만들어 보는 SynchronizationContext파일 다운로드1
13190정성태12/9/20226965.NET Framework: 2076. C# - SynchronizationContext 기본 사용법파일 다운로드1
13189정성태12/9/20227836오류 유형: 831. Visual Studio - Windows Forms 디자이너의 도구 상자에 컨트롤이 보이지 않는 문제
13188정성태12/9/20226424.NET Framework: 2075. C# - 직접 만들어 보는 TaskScheduler 실습 (SingleThreadTaskScheduler)파일 다운로드1
13187정성태12/8/20226371개발 환경 구성: 654. openssl - CA로부터 인증받은 새로운 인증서를 생성하는 방법 (2)
13186정성태12/6/20224906오류 유형: 831. The framework 'Microsoft.AspNetCore.App', version '...' was not found.
13185정성태12/6/20225878개발 환경 구성: 653. Windows 환경에서의 Hello World x64 어셈블리 예제 (NASM 버전)
13184정성태12/5/20225059개발 환경 구성: 652. ml64.exe와 link.exe x64 실행 환경 구성
13183정성태12/4/20225079오류 유형: 830. MASM + CRT 함수를 사용하는 경우 발생하는 컴파일 오류 정리
13182정성태12/4/20225806Windows: 217. Windows 환경에서의 Hello World x64 어셈블리 예제 (MASM 버전)
13181정성태12/3/20225199Linux: 54. 리눅스/WSL - hello world 어셈블리 코드 x86/x64 (nasm)
13180정성태12/2/20225274.NET Framework: 2074. C# - 스택 메모리에 대한 여유 공간 확인하는 방법파일 다운로드1
13179정성태12/2/20224613Windows: 216. Windows 11 - 22H2 업데이트 이후 Terminal 대신 cmd 창이 뜨는 경우
13178정성태12/1/20225169Windows: 215. Win32 API 금지된 함수 - IsBadXxxPtr 유의 함수들이 안전하지 않은 이유파일 다운로드1
13177정성태11/30/20225854오류 유형: 829. uwsgi 설치 시 fatal error: Python.h: No such file or directory
13176정성태11/29/20224738오류 유형: 828. gunicorn - ModuleNotFoundError: No module named 'flask'
13175정성태11/29/20226567오류 유형: 827. Python - ImportError: cannot import name 'html5lib' from 'pip._vendor'
13174정성태11/28/20224980.NET Framework: 2073. C# - VMMap처럼 스택 메모리의 reserve/guard/commit 상태 출력파일 다운로드1
13173정성태11/27/20225757.NET Framework: 2072. 닷넷 응용 프로그램의 스레드 스택 크기 변경
... 16  17  [18]  19  20  21  22  23  24  25  26  27  28  29  30  ...