Skip to content

Compilation on Ubuntu 22.04 WSL2 fails #341

Open

Description

@yemsb

Hello, I'm unsure how actively the C++ version of BAT is still being maintained. Basically, I run Ubuntu 22.04 on WSL2. I installed ROOT version 6.28/10 without problems. After downloading and extracting BAT-1.0.0, I ran ./configure --enable-parallel --with-cuba=download without errors.

When trying to run make, I get the following error message:

...
/home/yams/root/bin/rootcling -f libBAT_rdict.cxx.tmp -s libBAT.so -rml libBAT.so -rmf libBAT.rootmap -c  -fopenmp -I.includes -I/usr/local/include .includes/BAT/BCHistogramBase.h .includes/BAT/BCLog.h .includes/BAT/BCMath.h .includes/BAT/BCVariable.h .includes/BAT/BCDataPoint.h .includes/BAT/BCDataSet.h .includes/BAT/BCH1D.h .includes/BAT/BCH2D.h .includes/BAT/BCParameter.h .includes/BAT/BCAux.h .includes/BAT/BCPrior.h .includes/BAT/BCVariableSet.h .includes/BAT/BCConstantPrior.h .includes/BAT/BCGaussianPrior.h .includes/BAT/BCSplitGaussianPrior.h .includes/BAT/BCCauchyPrior.h .includes/BAT/BCObservable.h .includes/BAT/BCTF1Prior.h .includes/BAT/BCTF1LogPrior.h .includes/BAT/BCTH1Prior.h .includes/BAT/BCPositiveDefinitePrior.h .includes/BAT/BCParameterSet.h .includes/BAT/BCEngineMCMC.h .includes/BAT/BCIntegrate.h .includes/BAT/BCModel.h .includes/BAT/BCEmptyModel.h .includes/BAT/BCPriorModel.h .includes/BAT/BCModelManager.h LinkDef.h
rootcling: for the -f option: may only occur zero or one times!
make[2]: *** [Makefile:872: libBAT_rdict.cxx] Error 1
make[2]: Leaving directory '/home/yams/BAT-1.0.0/src'
make[1]: *** [Makefile:598: all-recursive] Error 1
make[1]: Leaving directory '/home/yams/BAT-1.0.0'
make: *** [Makefile:445: all] Error 2

I have previously successfully installed BAT on Ubuntu 20.04 and ROOT 6.22/06. Any help is appreciated.

Activity

  1. YiHui-Liu commented on Jul 15, 2024

    @YiHui-Liu

    i have the same question in WSL2 + Ubuntu 22.04

  2. YiHui-Liu commented on Jul 15, 2024

    @YiHui-Liu

    I remove the -f option and got:

    BCIntegrate.cxx:36:19: error: ‘ROOT::Math::Util’ has not been declared
       36 | using ROOT::Math::Util::ToString;
          |                   ^~~~
    In file included from ../BAT/BCEngineMCMC.h:28,
                     from ../BAT/BCIntegrate.h:26,
                     from BCIntegrate.cxx:12:
    BCIntegrate.cxx: In member function ‘void BCMinimizer::Wrapper::Init(const std::vector<double>&, int)’:
    BCIntegrate.cxx:114:74: error: ‘ToString’ was not declared in this scope; did you mean ‘TString’?
      114 |                 BCLOG_ERROR(std::string("Cannot add fixed parameter ") + ToString(i) + " to minuit");
          |                                                                          ^~~~~~~~
    ../BAT/BCLog.h:31:50: note: in definition of macro ‘BCLOG_INTERNAL_OUT’
       31 |       (std::string(__PRETTY_FUNCTION__) + ": " + s); \
          |                                                  ^
    BCIntegrate.cxx:114:17: note: in expansion of macro ‘BCLOG_ERROR’
      114 |                 BCLOG_ERROR(std::string("Cannot add fixed parameter ") + ToString(i) + " to minuit");
          |                 ^~~~~~~~~~~
    BCIntegrate.cxx:122:68: error: ‘ToString’ was not declared in this scope; did you mean ‘TString’?
      122 |                 BCLOG_ERROR(std::string("Cannot add parameter ") + ToString(i) + " to minuit");
          |                                                                    ^~~~~~~~
    ../BAT/BCLog.h:31:50: note: in definition of macro ‘BCLOG_INTERNAL_OUT’
       31 |       (std::string(__PRETTY_FUNCTION__) + ": " + s); \
          |                                                  ^
    BCIntegrate.cxx:122:17: note: in expansion of macro ‘BCLOG_ERROR’
      122 |                 BCLOG_ERROR(std::string("Cannot add parameter ") + ToString(i) + " to minuit");
          |                 ^~~~~~~~~~~
    

    i add #include <Math/Util.h> in src/BCIntegrate.cxx to fix it and a new error occur:

    /usr/bin/ld: /opt/BAT/external/Cuba/lib/libcuba.a(Suave.o): relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
    
  3. oschulz commented on Jul 15, 2024

    @oschulz
    Member

    BAT (written in C++) ist not very actively maintained anymore, though pull requests to fix build issues and similar are of course welcome.

    We suggest to use it's successor BAT.jl (written in Julia), it has a lot more sampling algorithms and other new features. I'm happy to assist with porting use cases over to BAT.jl.

  4. YiHui-Liu commented on Jul 16, 2024

    @YiHui-Liu

    We suggest to use it's successor BAT.jl (written in Julia), it has a lot more sampling algorithms and other new features. I'm happy to assist with porting use cases over to BAT.jl.

    thanks for your advice. I have an old project needed in C++ environment. I will try BAT.jl in the future.

    i add #include <Math/Util.h> in src/BCIntegrate.cxx to fix it and a new error occur:

    now i try the following steps and fix it:

    1. download cuba (in my pc is Cuba-4.2.2)
    2. export CFLAGS="-fPIC"
    3. cd to Cuba source directory, and run ./configure --prefix=/path/to/Cuba
    4. make and make install
    5. add #include <Math/Util.h> in src/BCIntegrate.cxx
    6. cd to BAT source directory, and run configure, make and make install
  5. oschulz commented on Jul 16, 2024

    @oschulz
    Member

    Thanks for the information @YiHui-Liu - would you like to make a pull request with your changes to BAT?

  6. YiHui-Liu commented on Aug 16, 2024

    @YiHui-Liu

    Thanks for the information @YiHui-Liu - would you like to make a pull request with your changes to BAT?

    The same situation happened in Ubuntu 22.04 (not in WSL), so maybe this issue is related to the ubuntu version. I don't have an old version of ubuntu so that I can't verify it. I'm not sure if it will cause new problem when i remove the -f option in other version, so people who have problems can refer to my solution without submitting a PR.

  7. oschulz commented on Aug 16, 2024

    @oschulz
    Member

    Yes, the significant work load of maintaining the build system across multiple Linux versions and OS-X was a major factor in moving to Julia (https://github.com/bat/BAT.jl).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions