Bug 31761 - Starting Xamarin Studio returns error: "could not discover the mach TLS offset"
Summary: Starting Xamarin Studio returns error: "could not discover the mach TLS offset"
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 4.0.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-08 16:14 UTC by Michael Henke
Modified: 2016-07-31 16:40 UTC (History)
8 users (show)

Tags:
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 for Bug 31761 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Michael Henke 2015-07-08 16:14:49 UTC
When I start Xamarin Studio on Mac OS X 10.11 beta-3 it errors out with the following message:

Last login: Wed Jul  8 13:07:10 on ttys000
Jarvis:~ michaelhenke$ /Users/michaelhenke/Applications/Xamarin\ Studio.app/Contents/MacOS/XamarinStudio ; exit;
could not discover the mach TLS offset
Thread 0xa10ca000 may have been prematurely finalized
Comment 1 Michael Henke 2015-07-08 16:15:51 UTC
Jarvis:~/Applications/Xamarin Studio.app/Contents/MacOS michaelhenke$ mono --version
Mono JIT compiler version 4.0.2 ((detached/c99aa0c Thu Jun 11 18:53:01 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.6.0svn-mono-(detached/a173357)
	GC:            sgen
Comment 2 Felix Deimel 2015-07-08 17:04:29 UTC
I'm also seeing this in my own application which is using Mono 4.0.2.
Comment 3 Fulvio 2015-07-08 21:20:39 UTC
Receiving the same problem after upgrading to 10.11 Beta 3.
Comment 4 Fulvio 2015-07-08 22:45:08 UTC
This is after doing the following:

PATH=$PREFIX/bin:$PATH
git clone https://github.com/mono/mono.git
cd mono
CC='cc -m32' ./autogen.sh --prefix=$PREFIX --disable-nls --build=i386-apple-darwin11.2.0
make
make install

...
:4"'" "$@"' >> _tmpinst/bin/dmcs ; \
	chmod +x _tmpinst/bin/dmcs
echo '#! /bin/sh' > _tmpinst/bin/al2 ; \
	r=`pwd`; m=`cd /Users/fulvio/mono/mcs && pwd`; \
	echo 'exec "'"$r/_tmpinst/bin/mono"'" "'"$m/class/lib/net_2_0/al.exe"'" "$@"' >> _tmpinst/bin/al2 ; \
	chmod +x _tmpinst/bin/al2
echo '#! /bin/sh' > _tmpinst/bin/al ; \
	r=`pwd`; m=`cd /Users/fulvio/mono/mcs && pwd`; \
	echo 'exec "'"$r/_tmpinst/bin/mono"'" "'"$m/class/lib/net_4_5/al.exe"'" "$@"' >> _tmpinst/bin/al ; \
	chmod +x _tmpinst/bin/al
if test -w /Users/fulvio/mono/mcs; then :; else chmod -R +w /Users/fulvio/mono/mcs; fi
cd /Users/fulvio/mono/mcs && /Applications/Xcode.app/Contents/Developer/usr/bin/make --no-print-directory -s NO_DIR_CHECK=1 PROFILES='binary_reference_assemblies net_4_5 xbuild_12 xbuild_14   ' CC='cc -m32' all-profiles
mkdir -p -- build/deps
**could not discover the mach TLS offset
Thread 0xa1b62000 may have been prematurely finalized**

The source code in "mach-support-amd64.c" has a variable: "#define TLS_VECTOR_OFFSET_10_11 0x100" has the offset location changed?
Comment 6 Felix Buenemann 2015-07-09 11:26:52 UTC
Same issue as Fulvio when trying to upgrade mono to 4.0.25 using homebrew on OS X 10.11 Beta 3 (15A216g) and Xcode 7 Beta 3.

It happens during make and completely hangs after this error, so killall -KILL mono is required to abort the build.

--snip--
cd /private/tmp/mono20150709-94183-12ffqog/mono-4.0.2/mcs && /Applications/Xcode.app/Contents/Developer/usr/bin/make --no-print-directory -s NO_DIR_CHECK=1 PROFILES='binary_reference_assemblies net_4_5 xbuild_12 xbuild_14   ' CC='clang' all-profiles
mkdir -p -- build/deps
make[6]: mcs: No such file or directory
make[6]: *** [build/deps/basic-profile-check.exe] Error 1
*** The compiler 'mcs' doesn't appear to be usable.
*** Trying the 'monolite' directory.
could not discover the mach TLS offset
(build hangs here, chewing cpu time forever)
--snip--
Comment 7 Felix Deimel 2015-07-09 11:30:05 UTC
@Fulvio @Felix Buenemann: Like mentioned here (https://github.com/mono/mono/commit/c8a3c4fd36a69d039d0adb7da02de61e5e8df5f7#commitcomment-12086877), have you tried compiling on an older version of OS X? I usually still compile from OS X 10.7 Lion to get the best compatibility with older OS versions.
Comment 8 Michael Henke 2015-07-09 13:16:31 UTC
Due to the nature of the bootstrap process as part of the mono compiling step you can not build the mono version from the git repository on a 10.11 beta-3. You would need to build mono on a machine that has a version prior to that.
Comment 9 Felix Buenemann 2015-07-09 14:35:46 UTC
I've not tried compiling on 10.7. But I can confirm that the fix from PR 1919
(https://github.com/mono/mono/pull/1919) works and backports fine to 4.0.2.5.

In order for compile of mono to work, one must ensure that the bootstrap mono
also includes the fix. I tried to compile master and it failed until I unlinked
my existing homebrew install of mono 4.0.1 to remove it from the PATH.

I've created a PR for homebrew
(https://github.com/Homebrew/homebrew/pull/41537) to get a fix out asap.
Comment 10 Felix Deimel 2015-07-09 16:42:46 UTC
I can also confirm that this commit fixes 10.11 Beta 3 compatibility.
https://github.com/bosmacs/mono/commit/c8a3c4fd36a69d039d0adb7da02de61e5e8df5f7
Comment 11 jonlbauer 2015-07-09 20:52:13 UTC
Hi All,

Sorry for the newbie question, but can y'all give me easy to follow instructions for getting mono to work? I installed the Public Beta of El Capitan today (10.11, 15A215h btw) and am having the same issues.

Also, I need to figure out how to make the path persistent in Mac Terminal... How do I do that?!

Sorry, I know this is terribly newbie, but please?! :-)

- Jon
Comment 12 Fulvio 2015-07-11 01:40:14 UTC
After using the commit that Felix provided I still get that TLS error:

Last login: Sat Jul 11 02:02:54 on ttys001
/Applications/Xamarin\ Studio.app/Contents/MacOS/XamarinStudio ; exit;
fulvio@Fulvios-MacBook-Pro:~$ /Applications/Xamarin\ Studio.app/Contents/MacOS/XamarinStudio ; exit;
could not discover the mach TLS offset
Thread 0xa1b62000 may have been prematurely finalized

I can confirm that `mcs` and `mono` exist and execute fine:

fulvio@Fulvios-MacBook-Pro:~$ which mono
/usr/local/bin/mono
fulvio@Fulvios-MacBook-Pro:~$ which mcs
/usr/local/bin/mcs
fulvio@Fulvios-MacBook-Pro:~$ 

Proof that the `mcs` is executing properly:

fulvio@Fulvios-MacBook-Pro:~$ mcs
error CS2008: No files to compile were specified
Compilation failed: 1 error(s), 0 warnings
Comment 13 Fulvio 2015-07-11 01:40:43 UTC
Any idea where XamarinStudio looks for the mcs and mono executables?