Hi all,
apologies for a long post, it’s mostly to show what I tried and how it fails.
I am trying to build, from source, ROOT 6.24/06 using arch x86_64
on an M1 pro 14" macbook running MacOS Monterey 12.1 with xCode Version 13.2.1 (13C100).
I need this, afaict, because I want to run G4 with Qt5 and integrate that with ROOT functionality in my code. I have built G4 and Qt5 with x86_64 and can run them successfully. (I have not managed to compile Qt5 with arm64. This might be different for Qt6, but I have not looked into G4 with Qt6.)
I can build ROOT 6.24/06 using arch arm64
without problems. I have two brew
locations for x86_64 and arm64 in /usr/local and /opt/, respectively. Since I can successfully compile ROOT with arm64, and since I successfully compiled G4 and Qt5 with x86_64, I think I have all the relevant command line tools installed.
I have tried many approaches to build ROOT with arch x86_64, e.g.
cmake -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_CXX_STANDARD=17 -Dxrootd=OFF -Dminuit2=on -Droofit=on -DCMAKE_INSTALL_PREFIX=/opt/local/root-062406-x86_64
The problem is that with this x86_64 build attempt there are still traces of arm64 appearing (and I think this blocks successful building), e.g.
make -j8 VERBOSE=1
.. snip ..
cd /opt/software/root-062406/_build-x86_64/net/net && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/Net.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -O0 -std=c++17 -fPIC -Wno-return-type -std=c++17 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -dynamiclib -Wl,-headerpad_max_install_names -m64 -single_module -Wl,-dead_strip_dylibs -L/opt/homebrew/lib -o ../../lib/libNet.so -install_name @rpath/libNet.so CMakeFiles/Net.dir/src/NetErrors.cxx.o CMakeFiles/Net.dir/src/TApplicationRemote.cxx.o CMakeFiles/Net.dir/src/TApplicationServer.cxx.o CMakeFiles/Net.dir/src/TFileStager.cxx.o CMakeFiles/Net.dir/src/TFTP.cxx.o CMakeFiles/Net.dir/src/TGrid.cxx.o CMakeFiles/Net.dir/src/TGridJDL.cxx.o CMakeFiles/Net.dir/src/TGridJob.cxx.o CMakeFiles/Net.dir/src/TGridJobStatus.cxx.o CMakeFiles/Net.dir/src/TGridJobStatusList.cxx.o CMakeFiles/Net.dir/src/TGridResult.cxx.o CMakeFiles/Net.dir/src/TMessage.cxx.o CMakeFiles/Net.dir/src/TMonitor.cxx.o CMakeFiles/Net.dir/src/TNetFile.cxx.o CMakeFiles/Net.dir/src/TNetFileStager.cxx.o CMakeFiles/Net.dir/src/TParallelMergingFile.cxx.o CMakeFiles/Net.dir/src/TPServerSocket.cxx.o CMakeFiles/Net.dir/src/TPSocket.cxx.o CMakeFiles/Net.dir/src/TSecContext.cxx.o CMakeFiles/Net.dir/src/TServerSocket.cxx.o CMakeFiles/Net.dir/src/TSocket.cxx.o CMakeFiles/Net.dir/src/TSQLColumnInfo.cxx.o CMakeFiles/Net.dir/src/TSQLMonitoring.cxx.o CMakeFiles/Net.dir/src/TSQLResult.cxx.o CMakeFiles/Net.dir/src/TSQLRow.cxx.o CMakeFiles/Net.dir/src/TSQLServer.cxx.o CMakeFiles/Net.dir/src/TSQLStatement.cxx.o CMakeFiles/Net.dir/src/TSQLTableInfo.cxx.o CMakeFiles/Net.dir/src/TUDPSocket.cxx.o CMakeFiles/Net.dir/src/TWebFile.cxx.o CMakeFiles/Net.dir/src/TSSLSocket.cxx.o CMakeFiles/Net.dir/src/TS3HTTPRequest.cxx.o CMakeFiles/Net.dir/src/TS3WebFile.cxx.o CMakeFiles/G__Net.dir/G__Net.cxx.o -Wl,-rpath,/opt/software/root-062406/_build-x86_64/lib ../../lib/libRIO.so ../../builtins/openssl/OPENSSL-prefix/lib/libssl.a ../../builtins/openssl/OPENSSL-prefix/lib/libcrypto.a ../../lib/libThread.so ../../lib/libCore.so
ld: warning: ignoring file ../../builtins/openssl/OPENSSL-prefix/lib/libssl.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file ../../builtins/openssl/OPENSSL-prefix/lib/libcrypto.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_OPENSSL_init_ssl", referenced from:
TSSLSocket::WrapWithSSL() in TSSLSocket.cxx.o
Note the occurrence of -arch arm64
above. I can get rid of that using
cmake -DCMAKE_EXE_LINKER_FLAGS=-L/usr/local/homebrew -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_CXX_STANDARD=17 -Dxrootd=OFF -Dminuit2=on -Droofit=on -DCMAKE_INSTALL_PREFIX=/opt/local/root-062406-x86_64 ..
However, with that setup I get stuck at
[ 49%] Generating G__Core.cxx, ../lib/Core.pcm cd /opt/software/root-062406/_build-x86_64/core && /Applications/CMake.app/Contents/bin/cmake -E env LD_LIBRARY_PATH=/opt/software/root-062406/_build-x86_64/lib: /opt/software/root-062406/_build-x86_64/core/rootcling_stage1/src/rootcling_stage1 -v2 -f G__Core.cxx -cxxmodule -s /opt/software/root-062406/_build-x86_64/lib/libCore.so -excludePath /opt/software/root-062406 -excludePath /opt/software/root-062406/_build-x86_64/ginclude -excludePath /opt/software/root-062406/_build-x86_64/externals -excludePath /opt/software/root-062406/_build-x86_64/builtins -writeEmptyRootPCM -m _Builtin_intrinsics -mByproduct _Builtin_intrinsics -mByproduct ROOT_Foundation_Stage1_NoRTTI -mByproduct ROOT_Foundation_C -mByproduct ROOT_Rtypes -D__STDC_NO_COMPLEX__ -D__COMPLEX_H__ -D_COMPLEX_H -D__CLANG_STDATOMIC_H -I/opt/software/root-062406/_build-x86_64/include -I/opt/software/root-062406/_build-x86_64/ginclude -I/opt/software/root-062406/core/base/inc -I/opt/software/root-062406/core/foundation/inc -I/opt/software/root-062406/core/cont/inc -I/opt/software/root-062406/core/gui/inc -I/opt/software/root-062406/core/meta/inc -I/opt/software/root-062406/core/clib/inc -I/opt/software/root-062406/core/rint/inc -I/opt/software/root-062406/core/zip/inc -I/opt/software/root-062406/core/thread/inc -I/opt/software/root-062406/core/textinput/inc -I/opt/software/root-062406/core/clingutils/inc -I/opt/software/root-062406/core/base/v7/inc -I/opt/software/root-062406/core/foundation/v7/inc -I/opt/software/root-062406/core/unix/inc -I/opt/software/root-062406/core/macosx/inc -I/opt/homebrew/include -I/opt/software/root-062406/builtins/xxhash -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include -I/opt/software/root-062406/builtins/zstd ROOT/TErrorDefaultHandler.hxx ROOT/TSequentialExecutor.hxx ROOT/StringConv.hxx Buttons.h Bytes.h Byteswap.h KeySymbols.h MessageTypes.h Riostream.h Rtypes.h TApplication.h TAtt3D.h TAttAxis.h TAttBBox2D.h TAttBBox.h TAttFill.h TAttLine.h TAttMarker.h TAttPad.h TAttText.h TBase64.h TBenchmark.h TBuffer3D.h TBuffer3DTypes.h TBuffer.h TColor.h TColorGradient.h TDatime.h TDirectory.h TEnv.h TException.h TExec.h TFileCollection.h TFileInfo.h TFolder.h TInetAddress.h TMacro.h TMathBase.h TMD5.h TMemberInspector.h TMessageHandler.h TNamed.h TNotifyLink.h TObject.h TObjString.h TParameter.h TPluginManager.h TPoint.h TPRegexp.h TProcessID.h TProcessUUID.h TQClass.h TQCommand.h TQConnection.h TQObject.h TRedirectOutputGuard.h TRefCnt.h TRef.h TRegexp.h TRemoteObject.h TROOT.h TRootIOCtor.h TStopwatch.h TStorage.h TString.h TStringLong.h TStyle.h TSysEvtHandler.h TSystemDirectory.h TSystemFile.h TSystem.h TTask.h TThreadSlots.h TTime.h TTimer.h TTimeStamp.h TUri.h TUrl.h TUUID.h TVersionCheck.h TVirtualAuth.h TVirtualFFT.h TVirtualGL.h TVirtualMonitoring.h TVirtualMutex.h TVirtualPadEditor.h TVirtualPad.h TVirtualPadPainter.h TVirtualPerfStats.h TVirtualPS.h TVirtualQConnection.h TVirtualRWMutex.h TVirtualTableInterface.h TVirtualViewer3D.h TVirtualX.h ROOT/RDirectoryEntry.hxx ROOT/RIndexIter.hxx strlcpy.h snprintf.h strtok.h ROOT/TSeq.hxx TArrayC.h TArrayD.h TArrayF.h TArray.h TArrayI.h TArrayL64.h TArrayL.h TArrayS.h TBits.h TBtree.h TClassTable.h TClonesArray.h TCollection.h TCollectionProxyInfo.h TExMap.h THashList.h THashTable.h TIterator.h TList.h TMap.h TObjArray.h TObjectTable.h TOrdCollection.h TRefArray.h TRefTable.h TSeqCollection.h TSortedList.h TVirtualCollectionProxy.h ESTLType.h RStringView.h TClassEdit.h TError.h ROOT/RIntegerSequence.hxx ROOT/RLogger.hxx ROOT/RMakeUnique.hxx ROOT/RNotFn.hxx ROOT/RSpan.hxx ROOT/RStringView.hxx ROOT/span.hxx ROOT/TypeTraits.hxx TMacOSXSystem.h TUnixSystem.h root_std_complex.h GuiTypes.h TApplicationImp.h TBrowser.h TBrowserImp.h TCanvasImp.h TClassMenuItem.h TContextMenu.h TContextMenuImp.h TControlBarImp.h TGuiFactory.h TInspectorImp.h TObjectSpy.h TToggleGroup.h TToggle.h TBaseClass.h TClassGenerator.h TClass.h TClassRef.h TClassStreamer.h TDataMember.h TDataType.h TDictAttributeMap.h TDictionary.h TEnumConstant.h TEnum.h TFileMergeInfo.h TFunction.h TFunctionTemplate.h TGenericClassInfo.h TGlobal.h TInterpreter.h TInterpreterValue.h TIsAProxy.h TListOfDataMembers.h TListOfEnums.h TListOfEnumsWithLock.h TListOfFunctions.h TListOfFunctionTemplates.h TMemberStreamer.h TMethodArg.h TMethodCall.h TMethod.h TProtoClass.h TRealData.h TSchemaHelper.h TSchemaRule.h TSchemaRuleSet.h TStatusBitsChecker.h TStreamerElement.h TStreamer.h TVirtualIsAProxy.h TVirtualRefProxy.h TVirtualStreamerInfo.h TVirtualArray.h TVirtualObject.h Getline.h /opt/software/root-062406/core/base/inc/LinkDef.h
error: unknown target triple 'unknown-apple-macosx10.17.0', please use -triple or -arch
Could not determine compiler target.
Compiler instance could not be created.
0 rootcling_stage1 0x000000010563c5c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37`
`1 rootcling_stage1 0x000000010563b777 llvm::sys::RunSignalHandlers() + 39`
`2 rootcling_stage1 0x000000010563cbf6 SignalHandler(int) + 294`
`3 libsystem_platform.dylib 0x00007ff80560ee2d _sigtramp + 29`
`4 libsystem_platform.dylib 0x000000000000001a _sigtramp + 18446603370490696202`
`5 libsystem_platform.dylib 0x00000003104c1588 _sigtramp + 18446603383649019768
(sorry for the line breaking formatting)
What would be the proper cmake invocation to build ROOT with x86_64 on an M1 MPB?
Any hint would be much appreciated.
Cheers,
–U.