Build failure with nlohmann/json 3.11
- [x] Checked for duplicates
Describe the bug
(@pcanal determined that it's JSON at fault here)
Building with external nljson 3.11 causes CMake to emit an empty -D definition on the command line, breaking a root-cling call inside the build:
cd /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/io/io && /opt/homebrew/Cellar/cmake/3.24.1/bin/cmake -E env LD_LIBRARY_PATH=/private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/lib: /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/core/rootcling_stage1/src/rootcling_stage1 -v2 -f G__RIO.cxx -s /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/lib/libRIO.so -m libCore_rdict.pcm -m libThread_rdict.pcm -excludePath /var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src -excludePath /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/ginclude -excludePath /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/externals -excludePath /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/builtins -rml libRIO.so -rmf /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/lib/libRIO.rootmap -writeEmptyRootPCM -D -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/include -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/io/io/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/macosx/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/unix/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/foundation/v7/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/base/v7/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/clingutils/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/textinput/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/thread/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/zip/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/rint/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/clib/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/meta/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/gui/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/cont/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/foundation/inc -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/base/inc -I/private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-build-htsa7u5/ginclude -I/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/core/clib/res -I/opt/spack/opt/spack/monterey/nlohmann-json/3.11.2/onfre7c/include ROOT/RRawFile.hxx ROOT/RRawFileUnix.hxx ROOT/TBufferMerger.hxx TArchiveFile.h TBufferFile.h TBufferText.h TBufferIO.h TBufferJSON.h TCollectionProxyFactory.h TContainerConverters.h TEmulatedMapProxy.h TEmulatedCollectionProxy.h TDirectoryFile.h TFileCacheRead.h TFileMerger.h TFree.h TFileCacheWrite.h TFilePrefetch.h TFile.h TFPBlock.h TGenCollectionStreamer.h TGenCollectionProxy.h TKey.h TKeyMapFile.h TLockFile.h TMemFile.h TMapFile.h TMakeProject.h TStreamerInfoActions.h TVirtualCollectionIterators.h TStreamerInfo.h TZIPFile.h /var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src/io/io/inc/LinkDef.h
In file included from <built-in>:433:
<command line>:1:9: error: macro name must be an identifier
#define -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 1
^
Expected behavior
The -D shouldn't be emitted, so the build will work.
To Reproduce
I'm building with Spack:
Spack concretization
- [email protected]%[email protected]~aqua~davix~dcache~emacs~examples~fftw~fits~fortran+gdml+gminimal~graphviz~gsl~http~ipo~jemalloc~math~memstat+minuit~mlp~mysql~opengl~oracle~postgres~pythia6~pythia8+python~qt4~r+roofit~root7+rpath~shadow~spectrum~sqlite~ssl~table~tbb+threads~tmva+unuran~vc+vdt~veccore~vmc~x+xml~xrootd build_type=RelWithDebInfo cxxstd=17 patches=22af347 arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~doc+ncurses+ownlibs~qt build_type=Release arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~debug~pic+shared arch=darwin-monterey-m1 [+] ^gnuconfig@2021-08-14%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+optimize+pic+shared patches=0d38234 arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [-] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~doc+ncurses+ownlibs~qt build_type=Release arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~python arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] libs=shared,static arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~pic libs=shared,static arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] libs=shared,static arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~symlinks+termlib abi=5 patches=f84b270 arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~ipo+multiple_headers build_type=RelWithDebInfo arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~bignuma~consistent_fpcsr~ilp64+locking+pic+shared symbol_suffix=none threads=none arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~cpanm+shared+threads arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~jit+multibyte+utf arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93,4c24573,f2fd060 arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~libbsd arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+bzip2+curses+git~libunistring+libxml2+tar+xz arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~docs~shared certs=mozilla patches=3fdcf2d arch=darwin-monterey-m1 [+] ^ca-certificates-mozilla@2022-07-19%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+column_metadata+dynamic_extensions+fts~functions+rtree arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~gsl+rngstreams+shared arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~ipo~preload build_type=RelWithDebInfo arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93,4c24573,f2fd060 arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~debug~pic+shared arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~symlinks+termlib abi=5 patches=f84b270 arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+bzip2+curses+git~libunistring+libxml2+tar+xz arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]+column_metadata+dynamic_extensions+fts~functions+rtree arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~pic libs=shared,static arch=darwin-monterey-m1 [+] ^[email protected]%[email protected] arch=darwin-monterey-m1 [+] ^[email protected]%[email protected]~programs libs=shared,static arch=darwin-monterey-m1
which results in the cmake command:
cmake
'/opt/homebrew/bin/cmake' \ '-G' \ 'Unix Makefiles' \ '-DCMAKE_INSTALL_PREFIX:STRING=/opt/spack/opt/spack/monterey/root/6.26.06/htsa7u5' \ '-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo' \ '-DBUILD_TESTING:BOOL=OFF' \ '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' \ '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' \ '-DCMAKE_FIND_FRAMEWORK:STRING=LAST' \ '-DCMAKE_FIND_APPBUNDLE:STRING=LAST' \ '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' \ '-DCMAKE_INSTALL_RPATH:STRING=/opt/spack/opt/spack/monterey/root/6.26.06/htsa7u5/lib;/opt/spack/opt/spack/monterey/root/6.26.06/htsa7u5/lib64;/opt/spack/opt/spack/monterey/freetype/2.11.1/egbhjwc/lib;/opt/spack/opt/spack/monterey/libpng/1.6.37/6kpcuy2/lib;/opt/spack/opt/spack/monterey/zlib/1.2.12/ke4alug/lib;/opt/spack/opt/spack/monterey/libice/1.0.9/zvhhkxs/lib;/opt/spack/opt/spack/monterey/xproto/7.0.31/jflbhop/lib;/opt/spack/opt/spack/monterey/libjpeg-turbo/2.1.3/b5pgjdw/lib;/opt/spack/opt/spack/monterey/libxml2/2.10.1/kmve4xt/lib;/opt/spack/opt/spack/monterey/libiconv/1.16/fh6dfpn/lib;/opt/homebrew/lib;/opt/spack/opt/spack/monterey/lz4/1.9.3/bhvuert/lib;/opt/spack/opt/spack/monterey/openblas/0.3.20/bkxtz25/lib;/opt/spack/opt/spack/monterey/pcre/8.45/o6y4zfu/lib;/opt/spack/opt/spack/monterey/unuran/1.8.1/lqe2aod/lib;/opt/spack/opt/spack/monterey/rngstreams/1.0.1/fwwrbyt/lib;/opt/spack/opt/spack/monterey/vdt/0.4.3/ipjffyp/lib;/opt/spack/opt/spack/monterey/xxhash/0.8.1/g6qsrzy/lib;/opt/spack/opt/spack/monterey/zstd/1.5.2/r7rfcbo/lib' \ '-DCMAKE_PREFIX_PATH:STRING=/opt/spack/opt/spack/monterey/zstd/1.5.2/r7rfcbo;/opt/spack/opt/spack/monterey/xxhash/0.8.1/g6qsrzy;/opt/spack/opt/spack/monterey/vdt/0.4.3/ipjffyp;/opt/spack/opt/spack/monterey/unuran/1.8.1/lqe2aod;/opt/spack/opt/spack/monterey/rngstreams/1.0.1/fwwrbyt;/opt/spack/opt/spack/monterey/python/3.9.13/gtupo2h;/opt/spack/opt/spack/monterey/pcre/8.45/o6y4zfu;/opt/spack/opt/spack/monterey/openblas/0.3.20/bkxtz25;/opt/spack/opt/spack/monterey/nlohmann-json/3.11.2/onfre7c;/opt/spack/opt/spack/monterey/lz4/1.9.3/bhvuert;/opt/spack/opt/spack/monterey/libxml2/2.10.1/kmve4xt;/opt/spack/opt/spack/monterey/libiconv/1.16/fh6dfpn;/opt/spack/opt/spack/monterey/libjpeg-turbo/2.1.3/b5pgjdw;/opt/spack/opt/spack/monterey/libice/1.0.9/zvhhkxs;/opt/spack/opt/spack/monterey/xtrans/1.3.5/m6dh24j;/opt/spack/opt/spack/monterey/xproto/7.0.31/jflbhop;/opt/spack/opt/spack/monterey/freetype/2.11.1/egbhjwc;/opt/spack/opt/spack/monterey/pkgconf/1.8.0/ett7ygi;/opt/spack/opt/spack/monterey/libpng/1.6.37/6kpcuy2;/opt/spack/opt/spack/monterey/zlib/1.2.12/ke4alug;/opt/homebrew;/opt/homebrew' \ '-Dcxxmodules:BOOL=OFF' \ '-Dexceptions:BOOL=ON' \ '-Dexplicitlink:BOOL=ON' \ '-Dfail-on-missing:BOOL=ON' \ '-Dfortran:BOOL=OFF' \ '-Dgminimal:BOOL=ON' \ '-Dgnuinstall:BOOL=ON' \ '-Dlibcxx:BOOL=OFF' \ '-Dpch:BOOL=ON' \ '-Droottest:BOOL=OFF' \ '-Drpath:BOOL=ON' \ '-Druntime_cxxmodules:BOOL=OFF' \ '-Dshared:BOOL=ON' \ '-Dsoversion:BOOL=ON' \ '-Dtesting:BOOL=OFF' \ '-Dthread:BOOL=ON' \ '-DCLING_CXX_PATH:STRING=/usr/bin/clang++' \ '-Dbuiltin_afterimage:BOOL=OFF' \ '-Dbuiltin_cfitsio:BOOL=OFF' \ '-Dbuiltin_davix:BOOL=OFF' \ '-Dbuiltin_fftw3:BOOL=OFF' \ '-Dbuiltin_freetype:BOOL=OFF' \ '-Dbuiltin_ftgl:BOOL=OFF' \ '-Dbuiltin_gl2ps:BOOL=OFF' \ '-Dbuiltin_glew:BOOL=OFF' \ '-Dbuiltin_gsl:BOOL=OFF' \ '-Dbuiltin_llvm:BOOL=ON' \ '-Dbuiltin_lz4:BOOL=OFF' \ '-Dbuiltin_lzma:BOOL=OFF' \ '-Dbuiltin_nlohmannjson:BOOL=OFF' \ '-Dbuiltin_openssl:BOOL=OFF' \ '-Dbuiltin_pcre:BOOL=OFF' \ '-Dbuiltin_tbb:BOOL=OFF' \ '-Dbuiltin_unuran:BOOL=OFF' \ '-Dbuiltin_vc:BOOL=OFF' \ '-Dbuiltin_vdt:BOOL=OFF' \ '-Dbuiltin_veccore:BOOL=OFF' \ '-Dbuiltin_xrootd:BOOL=OFF' \ '-Dbuiltin_xxhash:BOOL=OFF' \ '-Dbuiltin_zlib:BOOL=OFF' \ '-Dafdsmrgd:BOOL=OFF' \ '-Dafs:BOOL=OFF' \ '-Dalien:BOOL=OFF' \ '-Darrow:BOOL=OFF' \ '-Dasimage:BOOL=ON' \ '-Dastiff:BOOL=ON' \ '-Dbonjour:BOOL=OFF' \ '-Dcastor:BOOL=OFF' \ '-Dccache:BOOL=OFF' \ '-Dchirp:BOOL=OFF' \ '-Dcling:BOOL=ON' \ '-Dcocoa:BOOL=OFF' \ '-Ddataframe:BOOL=ON' \ '-Ddavix:BOOL=OFF' \ '-Ddcache:BOOL=OFF' \ '-Dfftw3:BOOL=OFF' \ '-Dfitsio:BOOL=OFF' \ '-Dftgl:BOOL=OFF' \ '-Dgdml:BOOL=ON' \ '-Dgenvector:BOOL=OFF' \ '-Dgeocad:BOOL=OFF' \ '-Dgfal:BOOL=OFF' \ '-Dgl2ps:BOOL=OFF' \ '-Dglite:BOOL=OFF' \ '-Dglobus:BOOL=OFF' \ '-Dgsl_shared:BOOL=OFF' \ '-Dgviz:BOOL=OFF' \ '-Dhdfs:BOOL=OFF' \ '-Dhttp:BOOL=OFF' \ '-Dimt:BOOL=OFF' \ '-Djemalloc:BOOL=OFF' \ '-Dkrb5:BOOL=OFF' \ '-Dldap:BOOL=OFF' \ '-Dmathmore:BOOL=OFF' \ '-Dmemstat:BOOL=OFF' \ '-Dminimal:BOOL=OFF' \ '-Dminuit:BOOL=ON' \ '-Dminuit2:BOOL=ON' \ '-Dmlp:BOOL=OFF' \ '-Dmonalisa:BOOL=OFF' \ '-Dmysql:BOOL=OFF' \ '-Dodbc:BOOL=OFF' \ '-Dopengl:BOOL=OFF' \ '-Doracle:BOOL=OFF' \ '-Dpgsql:BOOL=OFF' \ '-Dpythia6:BOOL=OFF' \ '-Dpythia8:BOOL=OFF' \ '-Dqt:BOOL=OFF' \ '-Dqtgsi:BOOL=OFF' \ '-Dr:BOOL=OFF' \ '-Drfio:BOOL=OFF' \ '-Droofit:BOOL=ON' \ '-Droot7:BOOL=OFF' \ '-Druby:BOOL=OFF' \ '-Dsapdb:BOOL=OFF' \ '-Dshadowpw:BOOL=OFF' \ '-Dspectrum:BOOL=OFF' \ '-Dsqlite:BOOL=OFF' \ '-Dsrp:BOOL=OFF' \ '-Dssl:BOOL=OFF' \ '-Dtable:BOOL=OFF' \ '-Dtbb:BOOL=OFF' \ '-Dtcmalloc:BOOL=OFF' \ '-Dtmva:BOOL=OFF' \ '-Dunuran:BOOL=ON' \ '-Dvc:BOOL=OFF' \ '-Dvdt:BOOL=ON' \ '-Dveccore:BOOL=OFF' \ '-Dvmc:BOOL=OFF' \ '-Dx11:BOOL=OFF' \ '-Dxft:BOOL=OFF' \ '-Dxml:BOOL=ON' \ '-Dxrootd:BOOL=OFF' \ '-Dwebgui:BOOL=OFF' \ '-Dpyroot:BOOL=ON' \ '-DCMAKE_CXX_STANDARD:STRING=17' \ '-DPYTHON_EXECUTABLE:STRING=/opt/spack/opt/spack/monterey/python/3.9.13/gtupo2h/bin/python3.9' \ '/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-root-6.26.06-htsa7u5mmwachooyld7p55v6t3ooncqo/spack-src'
Setup
* **Spack:** 0.19.0.dev0 (08261af4ab00ac124b9680fbc9b2b277727b0299)
* **Python:** 3.8.9
* **Platform:** darwin-monterey-m2
* **Concretizer:** clingo
Additional context
I think this might have been fixed by https://github.com/root-project/root/pull/11111
Yes, it is albeit as similar patch still needs to be applied to the genreflex code path in ROOT's cmake.
On the surface the issue is that cmake produce rootcling command line for G__RIO.cxx which contains:
-writeEmptyRootPCM -D -compilerI/Application
Note the -D followed by nothing.
We noted this problem with a Spack build which is building ROOT with no builtin.
The one option on the cmake command line that triggered the problem is:
-DCMAKE_PREFIX_PATH:STRING="....//nlohmann-json-3.11.2-rasey7y53ec7uab3r6dhiktct52doyti"
Inside nlohmann the line of nlohmann_jsonTargets.cmake that caused the problem is:
INTERFACE_COMPILE_DEFINITIONS "\$<\$<NOT:\$<BOOL:ON>>:JSON_USE_GLOBAL_UDLS=0>;\$<\$<NOT:\$<BOOL:ON>>:JSON_USE_IMPLICIT_CONVERSIONS=0>;\$<\$<BOOL:OFF>:JSON_DISABLE_ENUM_SERIALIZATION=1>;\$<\$<BOOL:OFF>:JSON_DIAGNOSTICS=1>;\$<\$<BOOL:OFF>:JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1>"
This information is used in ROOT in ROOT_GENERATE_DICTIONARY:
set(module_defs $<TARGET_PROPERTY:${ARG_MODULE},COMPILE_DEFINITIONS>)
...
${definitions} "$<$<BOOL:${module_defs}>:-D$<JOIN:${module_defs},;-D>>"
Experimentally having INTERFACE_COMPILE_DEFINITIONS contains a single value:
"SOMETHING"
or a value plus one or more 'empty' generator expressions:
"SOMETHING;\$<\$<NOT:\$<BOOL:ON>>:JSON_USE_GLOBAL_UDLS=0>"
or a single 'empy' generator expressions:
"\$<\$<NOT:\$<BOOL:ON>>:JSON_USE_GLOBAL_UDLS=0>"
However if INTERFACE_COMPILE_DEFINITIONS contains 2 or more 'empty' generator expressions and no other values:
"\$<\$<NOT:\$<BOOL:ON>>:JSON_USE_GLOBAL_UDLS=0>;\$<\$<NOT:\$<BOOL:ON>>:JSON_USE_IMPLICIT_CONVERSIONS=0>;\$<\$<BOOL:OFF>:JSON_DISABLE_ENUM_SERIALIZATION=1>;\$<\$<BOOL:OFF>:JSON_DIAGNOSTICS=1>;\$<\$<BOOL:OFF>:JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON=1>"
It also appears to works if you don't quote the expressions:
$<$<NOT:$<BOOL:ON>>:JSON_USE_GLOBAL_UDLS=0> $<$<NOT:$<BOOL:ON>>:JSON_USE_IMPLICIT_CONVERSIONS=0> ..
However since those lines of cmake are generated by CMake as part of the install, we have to deal with the way they are.CMake
It is fixed on the ROOT side with:
commit 08ab7e03061e551647d707637957252d121f9c39 (HEAD)
Author: Jonas Rembser <[email protected]>
Date: Tue Sep 21 15:15:17 2021 +0200
[cmake] Protect against empty `COMPILE_DEFINITIONS` in rootcint command
but it should be applied also to REFLEX_GENERATE_DICTIONARY:
diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake
index a19ee4e363..22816fdc8e 100644
--- a/cmake/modules/RootMacros.cmake
+++ b/cmake/modules/RootMacros.cmake
@@ -174,12 +174,16 @@ function(REFLEX_GENERATE_DICTIONARY dictionary)
get_directory_property(defs COMPILE_DEFINITIONS)
foreach( d ${defs})
+ # Note: should we check for empty definitions here?
list(APPEND definitions ${d})
endforeach()
IF(TARGET ${dictionary})
LIST(APPEND include_dirs $<TARGET_PROPERTY:${dictionary},INCLUDE_DIRECTORIES>)
- LIST(APPEND definitions $<TARGET_PROPERTY:${dictionary},COMPILE_DEFINITIONS>)
+ # The COMPILE_DEFINITIONS list might contain empty elements. These are
+ # removed with the FILTER generator expression, excluding elements that
+ # match the ^$ regexp (only matches empty strings).
+ LIST(APPEND definitions "$<FILTER:$<TARGET_PROPERTY:${ARG_MODULE},COMPILE_DEFINITIONS>,EXCLUDE,^$>")
ENDIF()
add_custom_command(
Additional notes:
nlohmann_json v3.9 only had one COMPILE_DEFINITIONS so it was working nlohmann_json v3.10.5 had two COMPILE_DEFINITIONS but one of them defaulted to ON nlohmann_json v3.11.0 increase to 5 BUT more importantly they are now ALL off the option that default to ON still default to on but now lead to a define only when OFF
So ROOT without Jonas patch should be working with v3.10.5 and older but not with v3.11.0 and newer.