This repository has been archived by the owner. It is now read-only.

Erlang 16B segfaults when built with wxmac dependency #18291

Closed
cqfd opened this Issue Mar 6, 2013 · 27 comments

Comments

Projects
None yet
10 participants
@cqfd

cqfd commented Mar 6, 2013

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

This comment has been minimized.

Show comment
Hide comment
@eugene-eeo

eugene-eeo Mar 6, 2013

Maybe you could try "brew update".

eugene-eeo commented Mar 6, 2013

Maybe you could try "brew update".

@cqfd

This comment has been minimized.

Show comment
Hide comment
@cqfd

cqfd Mar 6, 2013

I'm fully updated.

cqfd commented Mar 6, 2013

I'm fully updated.

@jvalduvieco

This comment has been minimized.

Show comment
Hide comment
@jvalduvieco

jvalduvieco Mar 17, 2013

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

jvalduvieco commented Mar 17, 2013

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

@adamv

This comment has been minimized.

Show comment
Hide comment
@adamv

adamv Apr 13, 2013

Contributor

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

Contributor

adamv commented Apr 13, 2013

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

@felixbuenemann

This comment has been minimized.

Show comment
Hide comment
@felixbuenemann

felixbuenemann Jun 23, 2013

Contributor

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.

Contributor

felixbuenemann commented Jun 23, 2013

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.

@adamv

This comment has been minimized.

Show comment
Hide comment
@adamv

adamv Jun 23, 2013

Contributor

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

Contributor

adamv commented Jun 23, 2013

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

@adamv

This comment has been minimized.

Show comment
Hide comment
@adamv

adamv Jun 23, 2013

Contributor

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

Contributor

adamv commented Jun 23, 2013

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

This comment has been minimized.

Show comment
Hide comment
@felixbuenemann

felixbuenemann Jun 24, 2013

Contributor

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.

Contributor

felixbuenemann commented Jun 24, 2013

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

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Jul 24, 2013

Contributor

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

Contributor

MSch commented Jul 24, 2013

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

@felixbuenemann

This comment has been minimized.

Show comment
Hide comment
@felixbuenemann

felixbuenemann Jul 24, 2013

Contributor

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]
Contributor

felixbuenemann commented Jul 24, 2013

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

This comment has been minimized.

Show comment
Hide comment
@adamv

adamv Aug 31, 2013

Contributor

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

Contributor

adamv commented Aug 31, 2013

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

@MSch

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Aug 31, 2013

Contributor

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

Contributor

MSch commented Aug 31, 2013

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

@MSch

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Aug 31, 2013

Contributor

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
Contributor

MSch commented Aug 31, 2013

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

This comment has been minimized.

Show comment
Hide comment
@felixbuenemann

felixbuenemann Aug 31, 2013

Contributor

@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.

Contributor

felixbuenemann commented Aug 31, 2013

@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

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Aug 31, 2013

Contributor

@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

Contributor

MSch commented Aug 31, 2013

@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

This comment has been minimized.

Show comment
Hide comment
@felixbuenemann

felixbuenemann Aug 31, 2013

Contributor

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.

Contributor

felixbuenemann commented Aug 31, 2013

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

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Aug 31, 2013

Contributor

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

Contributor

MSch commented Aug 31, 2013

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

@adamv

This comment has been minimized.

Show comment
Hide comment
@adamv

adamv Aug 31, 2013

Contributor
Contributor

adamv commented Aug 31, 2013

@jschrewe

This comment has been minimized.

Show comment
Hide comment
@jschrewe

jschrewe Sep 12, 2013

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.

jschrewe commented Sep 12, 2013

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

This comment has been minimized.

Show comment
Hide comment
@felixbuenemann

felixbuenemann Sep 12, 2013

Contributor

Thanks for the feedback, that should be fixable.

Contributor

felixbuenemann commented Sep 12, 2013

Thanks for the feedback, that should be fixable.

@jschrewe

This comment has been minimized.

Show comment
Hide comment
@jschrewe

jschrewe Sep 12, 2013

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...

jschrewe commented Sep 12, 2013

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

This comment has been minimized.

Show comment
Hide comment
@sumerman

sumerman Sep 21, 2013

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).

sumerman commented Sep 21, 2013

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

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Oct 3, 2013

Contributor

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

Contributor

MSch commented Oct 3, 2013

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

@MSch

This comment has been minimized.

Show comment
Hide comment
@MSch

MSch Oct 5, 2013

Contributor

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/

Contributor

MSch commented Oct 5, 2013

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

This comment has been minimized.

Show comment
Hide comment
@adamv

adamv Nov 29, 2013

Contributor

Are there any pull requests forthcoming?

Contributor

adamv commented Nov 29, 2013

Are there any pull requests forthcoming?

@leoliu

This comment has been minimized.

Show comment
Hide comment
@leoliu

leoliu Jan 9, 2014

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

leoliu commented Jan 9, 2014

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

@cris

This comment has been minimized.

Show comment
Hide comment
@cris

cris Jan 27, 2014

Contributor

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).

Contributor

cris commented Jan 27, 2014

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 Feb 27, 2014

@adamv adamv closed this in f95e5bc Mar 1, 2014

spkane added a commit to spkane/homebrew that referenced this issue Mar 3, 2014

ehershey added a commit to ehershey/homebrew that referenced this issue Apr 4, 2014

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.