Crash when using TApplication on new macOS ROOT build

ROOT Version: 6.18
Platform: macOS
Compiler: Not Provided

I recently followed the instructions to build ROOT 6.18 on my mac laptop, and everything worked perfectly fine, but when I compiled the following code as a stand-alone c++ executable, it crashed after closing the blank canvas I created with the following error code.

void func(bool showApp){
	TApplication *app;
	TCanvas *blank;
	if (showApp){
		app = new TApplication("myApp", 0, 0);
		blank = new TCanvas("blank","Close Window to Quit");
		blank->Connect(blank, "Closed()", "TApplication", app, "Terminate()");
	TCanvas *c1 = new TCanvas("c1", "Histogram Canvas");
	TH1I *hist = new TH1I("hist", "Testing", 100, -4, 4);

	if (showApp) app->Run(true);
2019-07-19 10:31:44.919 main[87157:3157441] Fatal error: requested non-existing drawable 49
2019-07-19 10:31:44.919 main[87157:3157441] This window not found among allocated/deleted drawables

 *** Break *** segmentation violation
[/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info)
[<unknown binary>] (no debug info)
[/Users/Justin/root/build/lib/] TCanvas::SetDoubleBuffer(int) /Users/Justin/root/root-6.18.00/graf2d/gpad/src/TCanvas.cxx:1946
[/Users/Justin/root/build/lib/] TCanvas::Close(char const*) /Users/Justin/root/root-6.18.00/graf2d/gpad/src/TCanvas.cxx:1083
[/Users/Justin/root/build/lib/] TCanvas::~TCanvas() /Users/Justin/root/root-6.18.00/graf2d/gpad/src/TCanvas.cxx:685
[/Users/Justin/root/build/lib/] TCanvas::~TCanvas() /Users/Justin/root/root-6.18.00/graf2d/gpad/src/TCanvas.cxx:652
[/Users/Justin/root/build/lib/] TList::Delete(char const*) /Users/Justin/root/root-6.18.00/core/cont/src/TList.cxx:505
[/Users/Justin/root/build/lib/] TROOT::EndOfProcessCleanups() /Users/Justin/root/root-6.18.00/core/base/src/TROOT.cxx:1268
[/usr/lib/system/libsystem_c.dylib] __cxa_finalize_ranges (no debug info)
[/usr/lib/system/libsystem_c.dylib] exit (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)

(To clarify, on the server I work on usually this crash never occurs and closing the blank canvas connected to the TApplication successfully closes it.)
Is this a problem with how ROOT was built? I used x11=ON as one of the options when building.
Thank you!

Can you please make sure that indeed the final configuration is x11=ON and cocoa=OFF ? In some cases, the current system might toggle these options to make cocoa enabled. What does root-config --features say? Cheers,

Just checked, for some reason those flags were not set when I built ROOT (despite using the command). I may have done something wrong, so I’ll try this and see if the issues are fixed. Thank you!

Everything was working fine with the options -Dx11=ON -Dcocoa=OFF, but then near the end I received this error.

[ 87%] Building C object graf3d/glew/CMakeFiles/GLEW.dir/src/glew.c.o
In file included from /Users/Justin/root/root-6.18.00/graf3d/glew/src/glew.c:49:
/Users/Justin/root/build/include/GL/glxew.h:94:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
1 error generated.
make[2]: *** [graf3d/glew/CMakeFiles/GLEW.dir/src/glew.c.o] Error 1
make[1]: *** [graf3d/glew/CMakeFiles/GLEW.dir/all] Error 2
make: *** [all] Error 2

I do have XQuartz and X11 on this computer. Is there any reason why files may be missing that ROOT needs to finish building?

Edit: I needed to add an include library for X11, but now I’m receiving linker errors in glew.c.o for “_glXGetClientString” and “_glXQueryVersion”

Try with -Dmacos_native=OFF. That option forces CMake to ignore some system directories where you may have X11 installed. Let me know if that doesn’t work.

Same linker error as before:

[ 90%] Linking C shared library ../../lib/
Undefined symbols for architecture x86_64:
  "_glXGetClientString", referenced from:
      _glxewGetExtension in glew.c.o
  "_glXQueryVersion", referenced from:
      _glxewContextInit in glew.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/] Error 1
make[1]: *** [graf3d/glew/CMakeFiles/GLEW.dir/all] Error 2
make: *** [all] Error 2

Compiled with cmake ../root-6.18.00/ -Dx11=ON -Dcocoa=OFF -DCMAKE_C_FLAGS="-I/opt/X11/include" -DCMAKE_CXX_FLAGS="-I/opt/X11/include" -DCMAKE-CXX_COMPILER="clang++" -DCMAKE_C_COMPILER="clang" -Dmacos_native=OFF

It seems the builtin_glew is missing a link to OpenGL::GL or something to that effect. I will try to reproduce this and fix it tomorrow. Cheers,

1 Like

I think I may have found the problem. My version of XCode has been messed with in some ways, and it’s possible that cmake wasn’t able to locate the dependencies. Thank you for your help!

Edit: Despite the re-download of XCode, I am receiving the same linker errors.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.