root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.63k stars 1.26k forks source link

Issues building ROOT with homebrew #12648

Closed Josiah1 closed 1 year ago

Axel-Naumann commented 1 year ago

Master and v6-28-00-patches contain the needed fixes; we will release a new version of ROOT in about two weeks.

Josiah1 commented 1 year ago

Master and v6-28-00-patches contain the needed fixes; we will release a new version of ROOT in about two weeks.

I tried both, without success. Using v6-28-00-patches encountered the same bug as #12644.

Axel-Naumann commented 1 year ago

Thanks, I will see what's wrong then. This is a fresh build? Did you start up xcode once to allow it to download the macOS SDK?

Josiah1 commented 1 year ago

Thanks, I will see what's wrong then. This is a fresh build? Did you start up xcode once to allow it to download the macOS SDK?

Yes, I tried after you commented on this. I did start up xcode and allow the download and also update the command line tool to the same version before building.

cxwx commented 1 year ago

Just for temporary use if you don't need the gui, you could try https://root-forum.cern.ch/t/building-failed-after-upgrade-to-mac-os-13-3-1/54420/2 if you don't need to generate dictonary yourself, using homebrew to install precompiled root

cxwx commented 1 year ago

I have built successfully for the latest master version of root on the latest macOS 13.3.1, with the option root7=ON open gui with root --web=safari or other web browser works fine with new TCanvas;

tested 3 days, with root --web works fine on mac os 13.3.1, actually more stable than ever using cocoa.

Josiah1 commented 1 year ago

I have built successfully for the latest master version of root on the latest macOS 13.3.1, with the option root7=ON open gui with root --web=safari or other web browser works fine with new TCanvas;

tested 3 days, with root --web works fine on mac os 13.3.1, actually more stable than ever using cocoa.

What's your version of xcode and command line tool? I still can't build successfully. It may also be the enabled options.

Axel-Naumann commented 1 year ago

@Josiah1 which exact commit are you trying to build? What is your cmake invocation and what is cmake's output / CMakeCache.txt?

Josiah1 commented 1 year ago

@Axel-Naumann Yesterday's latetest build was tried. Commit 7e2d21d728050081650f7a6bcdfa416d545e9d70 was tried just now.

cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=../root_install_master -Dall=ON -Dpython3=ON -DPYTHON3_EXECUTABLE=/opt/homebrew/bin/python3 -Dminuit2_mpi=ON -Dmpi=ON -Dminuit2_omp=ON -Dcxxmodules=ON -Dasimage=ON -Dbuiltin_afterimage=ON -Dbuiltin_cppzmq=ON -Dbuiltin_davix=ON -Dbuiltin_fftw3=ON -Dbuiltin_freetype=ON -Dbuiltin_gsl=ON -Dbuiltin_gtest=ON -Dbuiltin_openui5=ON -Dbuiltin_pcre=ON -Dbuiltin_tbb=ON -Dbuiltin_unuran=ON -Dbuiltin_veccore=ON -Dbuiltin_xrootd=ON -Dbuiltin_zeromq=ON -Dbuiltin_xxhash=ON -Dbuiltin_zlib=ON -Dbuiltin_zstd=ON -Dccache=ON -Dcefweb=ON -Dfcgi=ON -Dfftw3=ON -Dgviz=ON -Droofit_multiprocess=ON -Dtmva-pymva=ON -Dwebgui=ON -Dbuiltin_glew=ON -DVecGeom=OFF ../root

Here is the CMakeCache.txt file CMakeCache.txt

The fails begins with errors about glew.

cxwx commented 1 year ago

till can't build successfully. It may also be the enabled options.

clang --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

xcode Version 14.3 (14E222b)

cxwx commented 1 year ago

try -Dcxxmodules=OFF

cxwx commented 1 year ago

@Axel-Naumann Yesterday's latetest build was tried. Commit 7e2d21d was tried just now.

cmake -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=../root_install_master -Dall=ON -Dpython3=ON -DPYTHON3_EXECUTABLE=/opt/homebrew/bin/python3 -Dminuit2_mpi=ON -Dmpi=ON -Dminuit2_omp=ON -Dcxxmodules=ON -Dasimage=ON -Dbuiltin_afterimage=ON -Dbuiltin_cppzmq=ON -Dbuiltin_davix=ON -Dbuiltin_fftw3=ON -Dbuiltin_freetype=ON -Dbuiltin_gsl=ON -Dbuiltin_gtest=ON -Dbuiltin_openui5=ON -Dbuiltin_pcre=ON -Dbuiltin_tbb=ON -Dbuiltin_unuran=ON -Dbuiltin_veccore=ON -Dbuiltin_xrootd=ON -Dbuiltin_zeromq=ON -Dbuiltin_xxhash=ON -Dbuiltin_zlib=ON -Dbuiltin_zstd=ON -Dccache=ON -Dcefweb=ON -Dfcgi=ON -Dfftw3=ON -Dgviz=ON -Droofit_multiprocess=ON -Dtmva-pymva=ON -Dwebgui=ON -Dbuiltin_glew=ON -DVecGeom=OFF ../root

Here is the CMakeCache.txt file CMakeCache.txt

The fails begins with errors about glew.

errors glew, you can try

-Dcocoa=ON -Dopengl=ON

although I cannot open root gui with cocoa, But I need to open cocoa to build successfully

Axel-Naumann commented 1 year ago

Thanks @Josiah1 . No need to try what cxwx suggests, I will be back later today with an update.

Axel-Naumann commented 1 year ago

The fails begins with errors about glew.

What are these errors?

Does this PR help?

Josiah1 commented 1 year ago

@Axel-Naumann Hi, it seems I got very similar errors as yesterday. Here is the information. build_err.log

Josiah1 commented 1 year ago

@Axel-Naumann Hi, it seems I got very similar errors as yesterday. Here is the information. build_err.log

Commit a5754ae51f70ab2b6ae87671a69aa95189c717d9 was used.

cxwx commented 1 year ago

@Axel-Naumann Hi, it seems I got very similar errors as yesterday. Here is the information. build_err.log

I've build it success without mpi on the lastest mac with the nightly version 6.29.01

it seems you have 2 problem, one is

/Users/macbook/WORK/Tools/root/roofit/roofitZMQ/src/ppoll.cpp:21:13: error: use of undeclared identifier 'zmq_ppoll'    int rc = zmq_ppoll(items_, static_cast<int>(nitems_), timeout_, sigmask_);
            ^
1 error generated.

not sure if it is caused by mpi if MPI is not necessary needed building with XXXmpi=OFF also remove -Dall=ON

another is a bug of glew,cocoa,opengl.

/Users/macbook/WORK/Tools/root/builtins/glew/inc/GL/glew.h:19860:17: error: missing '#include <OpenGL/gl3.h>'; 'PFNGLCOPYTEXSUBIMAGE3DPROC' must be declared before it is used
GLEW_FUN_EXPORT PFNGLCOPYTEXSUBIMAGE3DPROC __glewCopyTexSubImage3D;
                ^
In module 'OpenGL' imported from /Users/macbook/WORK/Tools/root/builtins/glew/inc/GL/glew.h:1203:

add -Dbuiltin_glew=ON -Dcocoa=ON -Dopengl=ON

Axel-Naumann commented 1 year ago

@cxwx please do not try to find workarounds when I try to find the source of the issues; we really don't want our users to pile up workarounds.

@Josiah1 thanks for the output, this is helpful. CMakeCache.txt tells me that GIF_INCLUDE_DIR:PATH=/opt/homebrew/include (and others) pull in homebrew. This can easily cause conflicts with ROOT's buildins such as glew. I would recommend to avoid pulling in homebrew libraries - or going all the way and taking ROOT from homebrew directly.

These packages are likely pulled from homebrew because the CMake you use is from homebrew. You can install the native macOS binary from https://cmake.org and use that: /Applications/CMake.app/Contents/bin/cmake -D... - this should fix your build, if you do not want to install ROOT from homebrew.

Josiah1 commented 1 year ago

@Axel-Naumann Should I directly remove all homebrew-related envs? I updated the CMake on my Mac as you said. But it seems only some warnings disappeared, those errors are still here.

Axel-Naumann commented 1 year ago

When using the non-homebrew cmake, make sure you removed the previous CMakeCache.txt. As a brutal measure you can temporarily rename/ops/homebrew; that should also move it out of the way...

Can you explain why you don't want to use homebrew's build of ROOT? This seems much simpler than building ROOT yourself - unless you want to help develop ROOT, of course! ;-)

cxwx commented 1 year ago

@cxwx please do not try to find workarounds when I try to find the source of the issues; we really don't want our users to pile up workarounds.

sorry for that

Can you explain why you don't want to use homebrew's build of ROOT? This seems much simpler than building ROOT yourself - unless you want to help develop ROOT, of course! ;-)

I thought Josiah1 may meet the same problem, The home-brew root is still ver6.26.06(not upgrade), brew install --build-from-source also failed with the old version. when using rootcling to generate DICTIONARY, it cause

In file included from input_line_1:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/new:93:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/cstdlib:135:9: error: no member named 'at_quick_exit' in the global namespace
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/cstdlib:136:9: error: no member named 'quick_exit' in the global namespace
using ::quick_exit _LIBCPP_USING_IF_EXISTS;
      ~~^
In file included from input_line_1:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/new:94:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/exception:85:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/type_traits:485:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/__type_traits/is_pod.h:29:38: error: no template named 'is_trivially_default_constructible'; did you mean
      'is_nothrow_default_constructible'?
    : public integral_constant<bool, is_trivially_default_constructibl...
                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk/usr/include/c++/v1/__type_traits/is_nothrow_default_constructible.h:22:50: note: 'is_nothrow_default_constructible' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_co...

the APPLE system SDK has changed.

Josiah1 commented 1 year ago

the APPLE system SDK has changed.

@cxwx I agree. But I can't figure out why you can build successfully by turning off some options, but I can't. I also updated the command line tool to 14.3, did you?

When using the non-homebrew cmake, make sure you removed the previous CMakeCache.txt. As a brutal measure you can temporarily rename/ops/homebrew; that should also move it out of the way...

@Axel-Naumann Sure. I cleared all files when I built. It may work but I need to install the dependencies manually, which is also an annoying thing. And I do think there is something new happening for these building errors other than homebrew things. rootfit and glew errors are always there no matter if I use external dependencies or builtins. I have never encountered these errors before.

Can you explain why you don't want to use homebrew's build of ROOT? This seems much simpler than building ROOT yourself - unless you want to help develop ROOT, of course! ;-)

It really isn't necessary, it's just a habit. In addition to macos, I also use root on various versions of linux servers. For the latter, in most cases, I can only compile it myself. And we have many codes that depend on root, so we hope that root's compilation options can be mastered by ourselves. As for contributing to the development of root, I hope that I can do it in the future, but at present more is to use root to complete physical analysis. Thank you for your invaluable contributions!

cxwx commented 1 year ago

@cxwx I agree. But I can't figure out why you can build successfully by turning off some options, but I can't. I also updated the command line tool to 14.3, did you?

Xcode and command line tool upgrade to the latest 14.3

Josiah1 commented 1 year ago

It seems that, turning off the cxxmodules option makes the world clean again. cxxmodules option is definitely incompatible with glew.

Josiah1 commented 1 year ago

Unfortunately, when trying to create a TCanvas, a break occurs every time. Both master and 6-28-00-patches have this problem. @Axel-Naumann

root.exe(5184,0x1effe9b40) malloc: Heap corruption detected, free list is damaged at 0x600001c18da0 Incorrect guard value: 0 root.exe(5184,0x1effe9b40) malloc: set a breakpoint in malloc_error_break to debug

cxwx commented 1 year ago

Unfortunately, when trying to create a TCanvas, a break occurs every time. Both master and 6-28-00-patches have this problem. @Axel-Naumann

root.exe(5184,0x1effe9b40) malloc: Heap corruption detected, free list is damaged at 0x600001c18da0 Incorrect guard value: 0 root.exe(5184,0x1effe9b40) malloc: set a breakpoint in malloc_error_break to debug

https://root-forum.cern.ch/t/open-gui-failed-on-latest-macos-13-3-1/54474/11

Axel-Naumann commented 1 year ago

cxxmodules option is definitely incompatible with glew.

It cannot be so definitely because we build with glew and runtime_cxxmodules just fine. I still suspect that homebrew is playing tricks on you. You can check by looking at CMakeCache.txt which should not mention homebrew.

Unfortunately, when trying to create a TCanvas, a break occurs every time

Thanks for confirming the problem reported by @cxwx - I will take a look later.

Cheers, Axel

Josiah1 commented 1 year ago

@Axel-Naumann

It cannot be so definitely because we build with glew and runtime_cxxmodules just fine.

I also opened "runtime_cxxmodules", but "cxxmodules" must be turned off in my case.

Axel-Naumann commented 1 year ago

Ha interesting! Is there a reason why you turned cxxmodules on initially?

Josiah1 commented 1 year ago

Ha interesting! Is there a reason why you turned cxxmodules on initially?

No particular reason, just a random test. But I'm not going to worry about this anymore, because I can't make plots even if the compilation is successful.

Axel-Naumann commented 1 year ago

OK so can we consider this "dealt with"? The GUI issue was fixed in master, the fix will be applied to v6-28-00-patches today.

cxwx commented 1 year ago

gui issue fixed now

Axel-Naumann commented 1 year ago

What is fixed now? @Josiah1 's homebrew build issue? That's what this ticket is about - the GUI part is unrelated, please don't mix topics to avoid confusion.

Josiah1 commented 1 year ago

homebrew build issue and issue when cxxmodules and builtin_glew/glew are both turned on while building

Axel-Naumann commented 1 year ago

homebrew build issue

As far as I understand that's resolved / we cannot do much about an inconsistent set of libraries (macOS SDK vs homebrew).

and issue when cxxmodules and builtin_glew/glew are both turned on while building

We will likely just deprecate cxxmodules.

Axel-Naumann commented 1 year ago

Deprecation of cxxmodules happens in https://github.com/root-project/root/pull/12746

github-actions[bot] commented 1 year ago

Hi @Axel-Naumann,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely, :robot: