Bug 5871 - mkbundle should select correct architecture when running host 'as' and 'cc'
Summary: mkbundle should select correct architecture when running host 'as' and 'cc'
Alias: None
Product: Runtime
Classification: Mono
Component: Tools ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-06-26 15:53 UTC by Frank Somers
Modified: 2012-06-30 18:21 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Frank Somers 2012-06-26 15:53:45 UTC
This will probably occur on any platforms where the Mono build architecture differs from the default O/S architecture - eg, Mono built for x86, running on x86_64 or amd64.

An example architecture where this happens, is Mac OSX (eg Lion), which is 64-bit, but Mono is built 32-bit.

$ uname -a
Darwin enki.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64

$ mono -V
Mono JIT compiler version 2.11.1 (master/426188e Thu Apr 19 19:14:12 EDT 2012)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          debugger softdebug 
	LLVM:          yes(3.1svn-mono)
	GC:            Included Boehm (with typed GC)

This also occurred with Mono 2.10.8 which was the earliest version I tested this with.

Steps to reproduce:

Create sample program of your choice, and compile; eg: hello.fs containing:
   printfn "Hello"

$ fsharpc hello.fs --out:hello.exe
$ mkbundle hello.exe -o hello --deps -z
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).

Can work around using:
$ CC="cc -arch i386" AS="as -arch i386" mkbundle hello.exe -o hello --deps -z

IMHO, mkbundle should supply the appropriate -arch switch matching the architecture it was built with / matching the library architectures it requires.
Comment 1 Zoltan Varga 2012-06-30 18:21:34 UTC
This error is now fixed:

temp.s:2:unknown section type: symbol_stubs

However, mkbundles doesn't/shouldn't need to know about the target architecture, we call 'as', 'cc', and 'pkg-config', and the user needs to make sure they match up.