在Mac OS X雪豹系统上运行mono 2.10.2 mkbundle时出现问题

4

这个页面提供了关于使用mkbundle创建Bundle的信息,但是当我在Mac上尝试使用时,出现了以下错误信息。

delegate> mkbundle delegate.exe -o delegate
OS is: Darwin
Sources: 1 Auto-dependencies: False
   embedding: /Users/smcho/Desktop/csharp/delegate/delegate.exe
Compiling:
as -o temp.o temp.s 
temp.s:2:unknown section type: symbol_stubs
temp.s:2:Rest of line ignored. 1st junk character valued 112 (p).
[Fail]

我在这个网站上得知可以运行export AS="as -arch i386",但是会出现另一个错误。

Compiling:
as -arch i386 -o temp.o temp.s 
cc -g -o a.out -Wall temp.c `pkg-config --cflags --libs mono-2`  temp.o
ld: warning: ignoring file /Library/Frameworks/Mono.framework/Versions/2.10.2/lib/libmono-2.0.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: ignoring file temp.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
  "_mono_register_bundled_assemblies", referenced from:
      _mono_mkbundle_init in cczw6Dmo.o
  "_mono_set_dirs", referenced from:
      _main in cczw6Dmo.o
  "_mono_main", referenced from:
      _main in cczw6Dmo.o
  "_assembly_data_ser_exe", referenced from:
      _assembly_bundle_ser_exe in cczw6Dmo.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
[Fail]

我看到这是32位/64位编译问题,那么如何消除这个错误消息?我尝试使用 export CC="cc -arch i386" 但它没有起作用。
1个回答

9
我必须执行以下步骤:
  1. 导出 AS="as -arch i386"
  2. 导出 CC="cc -arch i386"
  3. 不要使用 --static 选项运行。只需运行 mkbuild BINARY。使用 --deps 选项似乎会嵌入更多的dll。您可以使用 -z 选项压缩嵌入的库。
您可以从此处获取更多提示,以及此处。有关 Mono 的 mkbundle 的说明,请参见此处

这对我有用 - 你知道 "AS" 和 "CC" 是什么意思以及为什么这个修复方法有效吗? - Kirk Woll

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接