Std::string linkage problem

Hello,
I found some linkage problem when I’m trying to execute macro which contains std::string.
Example macro:

#include <string>
void test() {std::string st{"test"};}

And error log:

[ROOT/v6-18-04-40] ~ > root -l
root [0] .x test.C 
root [1] .x test.C 
IncrementalExecutor::executeFunction: symbol '_ZStL19__constant_string_pIcEbPKT_' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::__constant_string_p<char>(char const*)
Maybe you need to load the corresponding shared library?

Cheers,
Artur.


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


I do not see this problem on Mac with ROOT master (even without the #include):

% cat ar.C
void ar() {std::string st{"test"};}
% root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.25/01                        https://root.cern |
  | (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Mar 09 2021, 09:09:23                      |
  | From heads/master@v6-25-01-72-gb4566d45f8                        |
  | With Apple clang version 12.0.0 (clang-1200.0.32.29)             |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] .x ar.C
root [1] .q

On with machine are you running ?

Try to run it twice. Second run causes linkage error.
I executed it on lxplus.

Cheers,
Artur.

Ah yes I did not noticed you ran it twice, sorry. I see the error now on Mac with the latest ROOT version. It seems a Cling issue therefore our Cling experts @Axel and @vvassilev should know the answer.

Indeed, one of the usual unloading issues :-/ @jalopezg can you add this to your test arsenal?

Hi! Sure; taking note of it! :slight_smile:

About running macros twice not working, see:

Possible workaround: root -l -b -q test.C && root -l -b -q test.C.

Cheers,
Enrico

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