Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formula 'mono' fails to install 32-bit binaries, breaks e.g. running KeePass #4332

Closed
Dr-Big-Man opened this issue Aug 29, 2016 · 8 comments

Comments

Projects
None yet
6 participants
@Dr-Big-Man
Copy link

commented Aug 29, 2016

When installing "Mono" framework thru brew install mono, only 64-bit binaries are installed in /usr/local/Cellar/mono/4.4.2.11/bin. Therefore password manager "KeePass" will not run, when started thru mono binary as installed by homebrew:

[mfroehlich: KeePass-2.34 :( ]$ brew upgrade
brew upgrade
[mfroehlich: KeePass-2.34 :) ]$ brew update
Already up-to-date.
[mfroehlich: KeePass-2.34 :) ]$ brew update
Already up-to-date.
[mfroehlich: KeePass-2.34 :) ]$ brew doctor
brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: The filesystem on / appears to be case-sensitive.
The default OS X filesystem is case-insensitive. Please report any apparent problems.

Warning: Putting non-prefixed coreutils in your path can cause gmp builds to fail.
[mfroehlich: KeePass-2.34 :) ]$ which mono
/usr/local/bin/mono
[mfroehlich: KeePass-2.34 :) ]$ mono -V
Mono JIT compiler version 4.4.2 (Stable 4.4.2.11/f72fe45 Thu Aug 11 06:03:25 BST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen
[mfroehlich: KeePass-2.34 :) ]$ mono KeePass.exe
WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at all
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Windows.Forms.CarbonInternal.Pasteboard.PasteboardPutItemFlavor (intptr,uint,uint,intptr,uint) <0x00077>
  at System.Windows.Forms.CarbonInternal.Pasteboard.Store (intptr,object,int) <0x000bb>
[ .... complete output attached ....]

It will however run flawlessly thru mono binary installed in /Library/Frameworks/Mono.framework/Commands from .pkg installer provided by Mono project itself:

[mfroehlich: KeePass-2.34 :( ]$ /Library/Frameworks/Mono.framework/Commands/mono -V
Mono JIT compiler version 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45 Wed Jul 27 16:20:13 EDT 2016)
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-master/a173357)
    GC:            sgen
[mfroehlich: KeePass-2.34 :) ]$ /Library/Frameworks/Mono.framework/Commands/mono KeePass.exe
[mfroehlich: KeePass-2.34 :) ]$ 

As can be seen by comparing both outputs of mono -V, command defaults to 64-bit architecture when installed thru homebrew, while defaulting to 32-bit architecture in original installer.

Unfortunately the 32-bit binaries are not available at all in installation of homebrew, as option --arch advertised by mono fails to execute (non-existing) 32-bit binary:

[mfroehlich: KeePass-2.34 :) ]$ mono
Usage is: mono [options] program [program-options]

Development:
    --aot[=<options>]      Compiles the assembly to native code
    --debug[=<options>]    Enable debugging support, use --help-debug for details
    --debugger-agent=options Enable the debugger agent
    --profile[=profiler]   Runs in profiling mode with the specified profiler module
    --trace[=EXPR]         Enable tracing, use --help-trace for details
    --jitmap               Output a jit method map to /tmp/perf-PID.map
    --help-devel           Shows more options available to developers

Runtime:
    --config FILE          Loads FILE as the Mono config
    --verbose, -v          Increases the verbosity level
    --help, -h             Show usage information
    --version, -V          Show version information
    --runtime=VERSION      Use the VERSION runtime, instead of autodetecting
    --optimize=OPT         Turns on or off a specific optimization
                           Use --list-opt to get a list of optimizations
    --security[=mode]      Turns on the unsupported security manager (off by default)
                           mode is one of cas, core-clr, verifiable or validil
    --attach=OPTIONS       Pass OPTIONS to the attach agent in the runtime.
                           Currently the only supported option is 'disable'.
    --llvm, --nollvm       Controls whenever the runtime uses LLVM to compile code.
    --gc=[sgen,boehm]      Select SGen or Boehm GC (runs mono or mono-sgen)
    --arch=[32,64]         Select architecture (runs mono32 or mono64)
[mfroehlich: KeePass-2.34 :( ]$ mono --arch=32
Error: --arch=32 Failed to switch to 'mono32'.
[mfroehlich: KeePass-2.34 :( ]$ 

This may be due to the fact, that homebrew formula mono.rb appears to only install 64-bit version thru definition in line 47:

 args << "--build=" + (MacOS.prefer_64_bit? ? "x86_64": "i686") + "-apple-darwin"

Unfortunately I do not fully understand code as to provide pull request in order to fix this issue, sorry. Would be grateful, if this could be added by maintainer(s) of formula. Many thanks in advance.

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented Sep 3, 2016

Therefore password manager "KeePass" will not run, when started thru mono binary as installed by homebrew

This is an issue with KeePass rather than Homebrew, I'm afraid, so you're better to deal with that with them, sorry!

@MikeMcQuaid MikeMcQuaid closed this Sep 3, 2016

@threkk

This comment has been minimized.

Copy link

commented Sep 15, 2016

The same bug reported on KeePass forums claim that it is a problem with Mono, not KeePass. Given that it works with the version of Mono downloaded from the official website, it seems a problem from the brew version rather than KeePass as @Dr-Big-Man pointed.

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented Sep 15, 2016

Regardless, it needs reported to Mono and/or KeePass and someone needs to make a pull request to fix it.

@100ideas

This comment has been minimized.

Copy link

commented Sep 23, 2016

I ran into the same error message while trying to run a different app with brew mono.

Perhaps this relatively-old (circa 2011) discussion from the mono mailing list will shed some light on the problem:

Winform on 64 bit OSX

It will work on both 32 bit and 64 bit MacOS systems.

What it means is that it would not run with a 64-bit build of Mono (at
this point in time, we have never shipped one, and we merely enabled
it for bold and courageous developers to try out).

It is in that scenario, where you run a 64-bit Mono, that
Windows.Forms would not run.

Miguel

I can't be sure, but it does seem as if mono winforms don't work with the 64-bit mono runtime cask.

@jaraco

This comment has been minimized.

Copy link

commented Mar 16, 2017

I also encountered this issue. It seems pretty obvious that homebrew should be building mono for 32-bit for maximal compatibility and only opt-in to a 64-bit build and not force users to the "bold and courageous" option.

Although it is an "upstream-issue" to support a 64-bit build at some point, the current state of the art doesn't effectively support it. Can Homebrew provide a version that's comparable to what someone would download from the Mono project and not a courageous but known-broken build?

@arisada

This comment has been minimized.

Copy link
Contributor

commented May 17, 2017

Sorry, this is clearly not an upstream issue. I'm using homebrew to make the management of my computer easier, if I need to install upstream installers of mono to work around problems in homebrew, I might as well not use homebrew at all.

@jaraco

This comment has been minimized.

Copy link

commented May 17, 2017

@MikeMcQuaid Are you still suggesting that the resolution of this ticket is "wait until Mono has 64-bit support" instead of re-opening this ticket with the goal of having a functional build of Mono for Homebrew?

@MikeMcQuaid

This comment has been minimized.

Copy link
Member

commented May 17, 2017

I don't appreciate the tone in this thread so I'm going to lock it. We'll review pull requests that address this issue. As a general comment, if the tone of the preceding comments had been better then you'd have been more likely to see work happening here.

@Homebrew Homebrew locked and limited conversation to collaborators May 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.