Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Erlang 16B segfaults when built with wxmac dependency #18291

Closed
happy4crazy opened this Issue · 27 comments

10 participants

@happy4crazy

TL;DR: Installing Erlang directly from source on Mountain Lion (not brew) produces working wxWidgets support. Installing with brew does not. I'm not sure why :(

The current Erlang formula doesn't have a depends_on 'wxmac' directive, so it builds an Erlang that, while functional, doesn't have an wxWidgets support:

Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V5.10.1  (abort with ^G)
1> observer:start().
{error,{{load_driver,"No driver found"},
        [{wxe_server,start,1,[{file,"wxe_server.erl"},{line,64}]},
         {wx,new,1,[{file,"wx.erl"},{line,114}]},
         {observer_wx,init,1,[{file,"observer_wx.erl"},{line,87}]},
         {wx_object,init_it,6,[{file,"wx_object.erl"},{line,299}]},
         {proc_lib,init_p_do_apply,3,
                   [{file,"proc_lib.erl"},{line,239}]}]}}

=ERROR REPORT==== 6-Mar-2013::16:36:23 ===
ERROR: Could not find 'wxe_driver.so' in: /usr/local/Cellar/erlang/R16B/lib/erlang/lib/wx-1.0/priv

If I add depends_on 'wxmac' to the formula and reinstall from source (e.g. brew install erlang --build-from-source), Erlang will now segfault as soon as I try to use anything involving wxWidgets, e.g. observer:start() or wx:demo().

However, if I install Erlang directly from source (following the brew steps, using the same options for configure, etc.), I get a fully-functioning Erlang. I don't understand what's different between my manual install and the brew install, hence this issue :)

Notes: I'm on Mountain Lion and I have a clean brew doctor.

@eugene-eeo

Maybe you could try "brew update".

@happy4crazy

I'm fully updated.

@jvalduvieco

The same here.
Here you'll find the crash report.
https://gist.github.com/jvalduvieco/5185938

@adamv
Owner

We've reverted to R15B03-1 in the meantime for other reasons.

@felixbuenemann

Hmm, I have the same crash as @jvalduvieco with R16B01 with my updated erlang-r16 formula: https://gist.github.com/felixbuenemann/e40d0cd9a0d1c15904c5

I do however have the wx_driver.so so it doesn't really match the problem at the top of the issue.

@adamv What where the main reasons fro reverting to R15B03-1? I do have a R16B01 formula ready, so I would keep it back or try to verify those other issues.

@felixbuenemann felixbuenemann referenced this issue in Homebrew/homebrew-versions
Closed

erlang-r16: Bump to version R16B01 #150

@adamv
Owner

The reason for staying with Erlang R15* is that CouchDB doesn't work with R16*.

@adamv
Owner

We will probably need gists of the full install output from compiling under Homebrew and compiling from source without Homebrew, to look for differences.

@felixbuenemann

Btw. this relly should be two different issues. One's about missing wx_driver.so, which means wxwidgtes support wasn't properly compiled in and the other one is about segfaulting inside libunwind.dylib.

@MSch

I can confirm the segfault when building with wxmac. Any updates on or ideas how to track down what's going on?

@felixbuenemann

It's also crashing for me if I build standalone:

Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
@adamv
Owner

Pushed two fixes to the wxMac formula today; might be worth testing against this (plus other upstream Homebrew fixes.)

@MSch

@adamv I tried again and now I'm getting a linker error. https://gist.github.com/MSch/6396964

@MSch

built with -v

mkdir -p ../priv/x86_64-apple-darwin12.4.0
c++ -bundle -flat_namespace -undefined warning -fPIC -m64  x86_64-apple-darwin12.4.0/wxe_driver.o x86_64-apple-darwin12.4.0/wxe_ps_init.o x86_64-apple-darwin12.4.0/wxe_impl.o x86_64-apple-darwin12.4.0/wxePrintout.o x86_64-apple-darwin12.4.0/wxe_return.o x86_64-apple-darwin12.4.0/wxe_gl.o  x86_64-apple-darwin12.4.0/wxe_funcs.o x86_64-apple-darwin12.4.0/wxe_events.o x86_64-apple-darwin12.4.0/wxe_init.o  -L/usr/local/Cellar/wxmac/2.9.4.0/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -framework QuickTime -lwx_osx_cocoau_stc-2.9 -lwx_osx_cocoau_gl-2.9 -lwx_osx_cocoau_aui-2.9 -lwx_osx_cocoau-2.9  -o ../priv/x86_64-apple-darwin12.4.0/wxe_driver.so
brew: superenv removed: -m64
ld: library not found for -lwx_osx_cocoau_stc-2.9
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [../priv/x86_64-apple-darwin12.4.0/wxe_driver.so] Error 1
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [libs] Error 2
@felixbuenemann

@MSch: I think it's a build problem with the wxmac formula, which should be built with stc suuport but apparently isn't. Check ls -hal /usr/local/lib/libwx_osx_cocoau*-2.9.dylib to see if it's missing.

I see the same error here, btw.

@MSch

@felixbuenemann yep it's missing for me too. But there's BUILD_STC=1 in the wxmac recipe? https://github.com/mxcl/homebrew/blob/master/Library/Formula/wxmac.rb#L36

@felixbuenemann

Yes, I noticed the same, don't know why it isn't build. Try older revisions of the formula to find which commit broke it.

@MSch

@felixbuenemann I edited the wxmac formula to include --enable-stc but it still didn't build a wx_osx_cocoau_stc-2.9 :/

@adamv
Owner
@jschrewe

After running into the same issue with wxWidgets and Erlang I played around with the build a bit. I managed to get it working. It's a bit hacky though and a 3 year old MacBook Air isn't really a good place to build either wxWidgets or Erlang many times. So I thought I just add the steps I did here and hope that someone witha better computer and more knowledge about Homebrew does some magic :)

To build wxWidgets I added the following options to configure:

"--enable-mediactrl",
"--enable-graphics_ctx",
"--enable-controls",
"--enable-dataviewctrl"

I think one of these options controls wether STC is built. At least my wx-config tells me the following after:

Available libraries in this build are:
  xrc webview stc richtext ribbon propgrid aui gl media html qa adv core xml net base

I build Erlang with install --debug and used an editor to remove the linkerflags -lwx_osx_cocoau_stc-2.9 -lwx_osx_cocoau_gl-2.9 (wxWidgets seems to include them in the core library now) in lib/wx/c_src/Makefile. After that the build went through clean and running wx:demo() from the Erlang shell works fine. I have never used wx with Erlang though and just need it to run the debugger. So there might be errors still hidden somewhere.

@felixbuenemann

Thanks for the feedback, that should be fixable.

@jschrewe

Oh, it's not -lwx_osx_cocoau_gl-2.9 but -lwx_osx_cocoau_aui-2.9 that must be removed. Copy & Paste seems to be hard...

@sumerman

There is no need to edit lib/wx/c_src/Makefile in --debug mode, if wxmac is built with --disable-monolithic. But wx:demo() keeps crashing the same way (I'm playing with R16B02 though).

@MSch

Yeah I also got it to work like @sumerman but it crashes too :/

@MSch

I wrote a step-by-step HOWTO on getting wx to work, can someone confirm that this works for them? http://featurebranch.com/howto-getting-wx-to-work-with-erlang-r16b02-on-os-x/

@adamv
Owner

Are there any pull requests forthcoming?

@leoliu

I am also wanting the wx support. The erlang debugger freezes often when fall back on tk. Thank you.

@cris

Installed 32-bit version from Erlang Solutions and it works. https://www.erlang-solutions.com/downloads/download-erlang-otp (64-bit version doesn't work).

@adamv adamv self-assigned this
@adamv adamv referenced this issue from a commit
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
d4ea57d
@BrewTestBot BrewTestBot referenced this issue from a commit in BrewTestBot/homebrew
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
67424aa
@adamv adamv referenced this issue from a commit
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
2276140
@adamv adamv referenced this issue from a commit
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
41961b5
@adamv adamv referenced this issue from a commit
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
440335f
@BrewTestBot BrewTestBot referenced this issue from a commit in BrewTestBot/homebrew
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
a2670e5
@adamv adamv closed this in f95e5bc
@spkane spkane referenced this issue from a commit in spkane/homebrew
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
6c7d86c
@ehershey ehershey referenced this issue from a commit in ehershey/homebrew
@adamv adamv erlang: build with wx support by default
Closes #26427.
Closes #18291.
d85258b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.