Compiling issue with RDataFrame

Dear all,
I have been trying to add RDataFrame objects to take advantage of tree-filling parallelization to the software I’m developing. During compilation I get this error:

/usr/opt/root/root-6.22.06/include/ROOT/RDF/RCustomColumn.hxx:37:8: error: expected identifier before numeric constant
 struct None{};
        ^~~~
/usr/opt/root/root-6.22.06/include/ROOT/RDF/RCustomColumn.hxx:37:8: error: expected unqualified-id before numeric constant
In file included from /usr/opt/root/root-6.22.06/include/ROOT/RDF/InterfaceUtils.hxx:17,
                 from /usr/opt/root/root-6.22.06/include/ROOT/RDF/RInterface.hxx:18,
                 from /usr/opt/root/root-6.22.06/include/ROOT/RDataFrame.hxx:20,
                 from ../../Core/ZMQRDPatternClass.h:36,
                 from ../../Core/TCLRunFileHandler.cpp:42:
/usr/opt/root/root-6.22.06/include/ROOT/RDF/RCustomColumn.hxx:43:47: error: expected type-specifier
 template <typename F, typename ExtraArgsTag = CustomColExtraArgs::None>
                                               ^~~~~~~~~~~~~~~~~~
/usr/opt/root/root-6.22.06/include/ROOT/RDF/RCustomColumn.hxx:43:47: error: expected ‘>’
/usr/opt/root/root-6.22.06/include/ROOT/RDF/RCustomColumn.hxx:46:20: error: expected type-specifier
    using NoneTag = CustomColExtraArgs::None;
                    ^~~~~~~~~~~~~~~~~~
/usr/opt/root/root-6.22.06/include/ROOT/RDF/RCustomColumn.hxx:71:84: error: ‘NoneTag’ has not been declared
    void UpdateHelper(unsigned int slot, Long64_t entry, std::index_sequence<S...>, NoneTag)
                                                                                    ^~~~~~~

I just installed 6.22.06 following the instructions given on the webpage. FYI, for this version of ROOT, my code compiles and works fine with usual ROOT tree-filling operations. If it helps, ROOT is embedded in my configure.ac as follows:

######################################## Checks for Root

AC_CHECK_PROG(ROOTCONFIGDFLT, [root-config], [root-config], [], [$PATH])


# override of default version
AC_ARG_WITH([rootsys],
        AS_HELP_STRING([--with-rootsys], [Path to ROOT install directory (a.k.a. ROOTSYS)]))

AC_PATH_PROG([ROOTCONFIG], [root-config], [notfound], [$with_rootsys/bin:$PATH])

if test "x$ROOTCONFIG" = "xnotfound" ; then
  ROOTCONFIG=$ROOTCONFIGDFLT
  AC_MSG_NOTICE([Setting to $ROOTCONFIG])
fi

if test -z "$ROOTCONFIG" ; then
  AC_MSG_ERROR([Unable to locate root-config that is is required.])
else
  AC_MSG_NOTICE([Using root-config ... $ROOTCONFIG])
fi

ROOT_CFLAGS=`$ROOTCONFIG --cflags`
ROOT_LDFLAGS="`$ROOTCONFIG --glibs`  -Wl,-rpath=`$ROOTCONFIG --libdir` "
ROOT_LIBRARY_DIR=`$ROOTCONFIG --libdir`
AC_SUBST(ROOT_CFLAGS)
AC_SUBST(ROOT_LDFLAGS)
AC_SUBST(ROOT_LIBRARY_DIR)
AC_SUBST(ROOTCONFIG)

Am I missing something in the configuration?
Thank you in advance
Best wishes
giordano


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22.06
Platform: Debian Buster
Compiler: g++ 8.3/ std=C++11


Hi Giordano,
I don’t see anything wrong at first glance (except for the errors, of course :sweat: ). I am using ROOT v6.22.06 on Debian myself but I have never seen those compilation errors.
How did you install ROOT exactly? Did you unpack a pre-compiled binary, compile from source, or…?

Can you try compiling the following toy program directly from the command line, with g++ -o df_test df_test.cxx $(root-config --libs --cflags)?

#include <ROOT/RDataFrame.hxx>
#include <iostream>

int main() {
  std::cout
      << ROOT::RDataFrame(42).Define("x", [] { return 10; }).Count().GetValue()
      << std::endl;
  return 0;
}

If that works, try checking whether your configure.ac works for that toy program. If not, there is something wrong with the configure.ac. If yes, you will have to figure out what’s different between the toy reproducer and your actual usecase.

If that doesn’t work…I’ll have to think of something else to figure out what’s going on :grinning_face_with_smiling_eyes:

Cheers,
Enrico

Dear Enrico,
I am working on my configure.ac to see where things are different but let me give you an update with answers to your questions.

  1. I installed ROOT from github
  2. Your test program works correctly. I never had problems with standalone programs and/or macros.

Thanks for your reply. I’ll let you know.
Best wishes
giordano

Dear Enrico,
I used my full configure.ac just to compile your test program and I have no problems.
The ball is in my court for sure. Thanks for your help! You can close the ticket :slight_smile:

Best wishes
giordano

Dear Enrico,
I think you could be interested in what I found out. There a definition conflict between ROOT CustomColExtraArgs::None and None in X11.h (X.h source code [include/X11/X.h] - Woboq Code Browser) which caused my compilation error of the first post.
Temporary fix for me was adding an undefine preprocessor directive for None before including #include <ROOT/RDataFrame.hxx> but this could be something that will come to bite me later (I hope not).
Could you comment on this? Is there a way I can avoid using the undefine directive?

Thanks
Best wishes
giordano

1 Like

Hi Giordano,
thanks for reporting back!
Well, look at that beautiful

#ifndef None
#define None                 0L	/* universal null resource or null atom */
#endif

That’s…not good practice.

I don’t think ROOT/RDF/RCustomColumn.hxx is doing anything wrong here, we just define (in a reserved namespace, not at global scope) a helper type called None. That’s ok. What’s not ok is to #define None in a header and not un-define it before the end of the header…

In order to understand the potential impact of this…how does X.h get included in that compilation unit? Do you include it manually, does ROOT itself transitively include it…?

Dear Enrico,
X.h is the legacy part of the C++ analysis framework that my lab has been using for very long time. I guess I can keep the undefine None before including RDataFrame.hxx and move on.

Best wishes
giordano

1 Like

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