mkbundle을 사용하여 Mono로 Linux 실행 파일 생성

mkbundle을 사용하여 Mono로 Linux 실행 파일 생성

모노의 AC# 파일은 명령을 사용하여 컴파일할 수 있습니다 gmcs. 그러면 파일이 생성됩니다 hello.exe.

$ gmcs hello.cs
$ ls
hello.cs  hello.exe
$ ./hello.exe
Hello from Mono!

Linux 실행 파일을 생성하기 위해 이 명령을 시도했지만 오류가 발생합니다.

$ gmcs /t:exe hello.cs /out:hello

Unhandled Exception: System.ArgumentException: Module file name 'hello' must have file extension.

실행할 수 있도록 독립 실행형 실행 파일을 만들고 싶습니다. 다음과 같이 말하여 실행하면 원하는 결과를 얻을 수 있습니다.

$ ./hello
Hello from Mono!

나는 다음과 같은 도구를 언급하는 솔루션을 검색하고 찾았습니다.mkbundle:

$ mkbundle -o hello hello.exe --deps
Sources: 1 Auto-dependencies: True
embedding: /home/ed/Projects/hello_world/hello.exe
embedding: /mono/lib/mono/1.0/mscorlib.dll
Compiling:
as -o /tmp/tmp54ff73e6.o temp.s
cc -o hello -Wall temp.c `pkg-config --cflags --libs mono` /tmp/tmp54ff73e6.o
Done

$ ls -l
total 3
-rwxr-xr-x  1 ed users 1503897 2005-04-29 11:07 hello
-rw-r--r--  1 ed users     136 2005-04-29 11:06 hello.cs
-rwxr-xr-x  1 ed users    3072 2005-04-29 11:06 hello.exe

이 유틸리티는 내 Mono 설치에 존재하지 않는 것 같습니다. 찾아보니 mono-devel패키지로도 가능하더라구요. 이 패키지를 설치하려면 약 82개의 다른 패키지를 설치해야 했습니다. 내 목표는 언젠가까지 모노 설치를 최소화하는 것이었습니다.

mkbundle독립형 으로 설치하는 방법이 있나요 ?

답변1

나는 매우 조바심이 났고 패키지에 mono-2.0-develmkbundle이 있을 수도 있다고 느꼈습니다. 그래서 저는 mono-2.0-devel18개의 추가 패키지만 필요로 하는 설치를 진행했습니다 . 내가 타이핑하고 탭을 쳤을 때 mkb, 그것은 나에게 보여주었다 mkbundle2.

나는 시도했다:

$ mkbundle2 -o hello hello.exe --deps
OS is: Linux
Sources: 1 Auto-dependencies: True
   embedding: /home/minato/Projects/Practice/mono/hello.exe
   embedding: /usr/lib/mono/2.0/mscorlib.dll
Compiling:
as -o temp.o temp.s 
cc -ggdb -o hello -Wall temp.c `pkg-config --cflags --libs mono`  temp.o
Done

$ ls
hello  hello.cs  hello.e  hello.exe

$ ./hello
Hello from Mono!

이것이 처음에 나에게 필요한 것이었습니다.

도구 덕분입니다 command-not-found.

관련 정보