Loading a script twice fails finding a shared library

I get this error on a MacBook Air and a MacBook Pro (both 10.14.5) but it works OK on another MacBook Pro (10.14.5). Any idea?


ROOT Version: 6.16/00
Platform: macOS 10.14.5
Compiler: Apple LLVM version 10.0.1 (clang-1001.0.46.3)


$ cat test.C
void test() {
  std::cout << "test\n";
}
$ root
   ------------------------------------------------------------
  | Welcome to ROOT 6.16/00                  https://root.cern |
  |                               (c) 1995-2018, The ROOT Team |
  | Built for macosx64 on Jun 19 2019, 14:05:00                |
  | From tag , 23 January 2019                                 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] .x test.C
root [1] .x test.C
test¥nIncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9use_facetINS_5ctypeIcEEEERKT_RKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9addressofIKcEEPT_RS2_' unresolved while linking [cling interface function]!
You are probably missing the definition of char const* std::__1::addressof<char const>(char const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L16__to_raw_pointerIKcEEPT_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of char const* std::__1::__to_raw_pointer<char const>(char const*)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base5flagsEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::flags() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base5widthEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::width() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__18ios_base5widthEl' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::width(long)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__18ios_base8setstateEj' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::setstate(unsigned int)
Maybe you need to load the corresponding shared library?
$ brew list
autoconf	freetype	glib		libpng		openssl		python@2
automake	fribidi		graphite2	libspiro	pango		readline
cairo		gdbm		harfbuzz	libtiff		pcre		ricty
cmake		gettext		icu4c		libtool		pixman		sqlite
fontconfig	ghostscript	jpeg		libuninameslist	pkg-config	xz
fontforge	giflib		libffi		lz4		python

brew list on the MacBook Pro on which the script runs OK.

$ brew list
aspell		emacs		glib		jasper		libpng		lynx		pkg-config	wdiff
autoconf	ffmpeg		gmp		jpeg		libtasn1	md5deep		python		webp
boost		fontconfig	gnuplot		lame		libtiff		nettle		qpdf		wget
c-ares		freetype	gnutls		latexdiff	libtool		openjpeg	readline	wireshark
cairo		fribidi		graphite2	libffi		libunistring	openssl		sdl2		x264
cfitsio		gd		graphviz	libgcrypt	libvorbis	opus		snappy		x265
clang-format	gdbm		harfbuzz	libgpg-error	libvpx		p11-kit		sqlite		xvid
cmake		gettext		icu4c		libidn2		little-cms2	pango		swig		xz
dcraw		ghostscript	imagemagick	libmaxminddb	lua		pcre		testdisk	zeromq
doxygen		gifsicle	ispell		libogg		lua@5.1		pixman		theora

Only the Python 3 option is fed when building ROOT

$ cmake ../ -DPYTHON_EXECUTABLE=/usr/local/bin/python3

I prepared a clean macOS 10.14.5 running on VMWare, on which I did only

The problem I reported in the first post was not reproduced on this environment.

$ cat test.C
void test() {
  std::cout << "test" << std::endl;
}

$ root
   ------------------------------------------------------------
  | Welcome to ROOT 6.16/00                  https://root.cern |
  |                               (c) 1995-2018, The ROOT Team |
  | Built for macosx64 on Jan 23 2019, 09:06:13                |
  | From tags/v6-16-00@v6-16-00                                |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] .x test.C 
test
root [1] .x test.C 
test

However, if I build ROOT 6.16/00 myself using the same environment and additional CMake installation via Homebrew, the example scripts fails when being executed twice.

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
$ brew install cmake
$ brew list
cmake

$ cd root-6.16.00/obj
$ cmake ..
$ make -j8
$ root

   ------------------------------------------------------------
  | Welcome to ROOT 6.16/00                  https://root.cern |
  |                               (c) 1995-2018, The ROOT Team |
  | Built for macosx64 on Jun 20 2019, 18:44:00                |
  | From tag , 23 January 2019                                 |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0] .x test.C 
test
root [1] .x test.C 
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9use_facetINS_5ctypeIcEEEERKT_RKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9addressofIKcEEPT_RS2_' unresolved while linking [cling interface function]!
You are probably missing the definition of char const* std::__1::addressof<char const>(char const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L16__to_raw_pointerIKcEEPT_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of char const* std::__1::__to_raw_pointer<char const>(char const*)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base5flagsEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::flags() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNKSt3__18ios_base5widthEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::width() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L4endlIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__18ios_base5widthEl' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::width(long)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__18ios_base8setstateEj' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::ios_base::setstate(unsigned int)
Maybe you need to load the corresponding shared library?

Compiling the script first and executing them twice is OK.

root [0] .x test.C+
test
root [1] .x test.C
test
root [2] .x test.C
test

Yeah sorry, reloading is still in a terrible state. I still hope that we can make progress this year…

I thought that the reloading issue only appeared when I used my own library because I reported a similar issue last year.


I did not expect this could also happen with basic STL classes, because I have never seen it on my main machine.

Why does the pre-compiled binary work?

Likely because we are not trying to unload its declarations.

I meant to ask why the pre-compiled ROOT distribution oot_v6.16.00.macosx64-10.14-clang100.tar.gz works. It seems that the loading/unloading procedures are different in the pre-compiled ROOT binary and self-cmake-built one on my Mac.

More strangely, one of my Macs works fine with std::cout and std::endl.

$ cat tmp.C
void tmp() {
  std::cout << "test" << std::endl;
}
$ root
root [0] .x tmp.C
test
root [1] .x tmp.C
test

But it does not with std::ifstream.

$ cat tmp2.C
void tmp2() {
  std::ifstream fin("tmp.C");
}
$ root
root [0] .x tmp2.C
root [1] .x tmp2.C
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L4moveIRPFiP7__sFILEEEEONS_16remove_referenceIT_E4typeEOS7_' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::remove_reference<int (*&)(__sFILE*)>::type&& std::__1::move<int (*&)(__sFILE*)>(int (*&&&)(__sFILE*))
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L3minImEERKT_S3_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of unsigned long const& std::__1::min<unsigned long>(unsigned long const&, unsigned long const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L7forwardIRP7__sFILEEEOT_RNS_16remove_referenceIS4_E4typeE' unresolved while linking [cling interface function]!
You are probably missing the definition of __sFILE*&&& std::__1::forward<__sFILE*&>(std::__1::remove_reference<__sFILE*&>::type&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L3maxIlEERKT_S3_S3_' unresolved while linking [cling interface function]!
You are probably missing the definition of long const& std::__1::max<long>(long const&, long const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L16__throw_bad_castEv' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::__throw_bad_cast()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9use_facetINS_7codecvtIcc11__mbstate_tEEEERKT_RKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of std::__1::codecvt<char, char, __mbstate_t> const& std::__1::use_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L9has_facetINS_7codecvtIcc11__mbstate_tEEEEbRKNS_6localeE' unresolved while linking [cling interface function]!
You are probably missing the definition of bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t> >(std::__1::locale const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNSt3__1L7forwardIPFiP7__sFILEEEEOT_RNS_16remove_referenceIS5_E4typeE' unresolved while linking [cling interface function]!
You are probably missing the definition of int (*&&std::__1::forward<int (*)(__sFILE*)>(std::__1::remove_reference<int (*)(__sFILE*)>::type&))(__sFILE*)
Maybe you need to load the corresponding shared library?

The former does not work either on another (virtual) Mac with clean installation.

This is unstable, whether it works or not depends on tons of things, e.g. where the first declaration comes from. This needs some time to get fixed, else I’d have done it long time ago :slight_smile:

Thank you again. I will wait.

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