jupyter-xeus / xeus-cling

Jupyter kernel for the C++ programming language
BSD 3-Clause "New" or "Revised" License
3.02k stars 292 forks source link

trouble loading shared rapidcheck library from pragma similar to issue 299 #441

Closed armaninspace closed 2 years ago

armaninspace commented 2 years ago

EDIT: There is a trivial mistake in one of the Cell #2 -- this is not an issue.

Hi,

I've been trying to get rapidcheck running using the xeus-cling kernel -- but running into trouble -- it seems similar to issue Loading/Using a dynamic library in a Xeus-cling notebook #299 https://github.com/jupyter-xeus/xeus-cling/issues/299 and I followed some of the recommendations in it.

NOTE: I was able to get the code to run using the command line interactive Cling shell.

Any help much appreciated.

Thanks!!

Details below:

Contents of /usr/local/include

ls /usr/local/include
rapidcheck  rapidcheck.h

Contents of /usr/local/lib

ls -l
-rw-r--r-- 1 root root  3105352 Jun  6 16:47 librapidcheck.so

Here is the code I'm trying to run:

Cell 0:

#pragma cling add_include_path("/usr/local/include")

Cell 1:

#pragma cling add_library_path("/usr/local/bin")

Cell 2:

#pragma clind load("rapidcheck")

Cell 3:

#include <rapidcheck.h>
#include <vector>
#include <algorithm>

Cell 4:

rc::check("double reversal yields the original value",
          [](const std::vector<int> &l0) {
              auto l1 = l0;
              std::reverse(begin(l1), end(l1));
              std::reverse(begin(l1), end(l1));
              RC_ASSERT(l0 == l1);
          });

The resulting error is:


IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail3AnyC1Ev' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::Any::Any()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc3gen6detail8integralIiEENS_10ShrinkableIT_EERKNS_6RandomEi' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::Shrinkable<int> rc::gen::detail::integral<int>(rc::Random const&, int)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail8demangleB5cxx11EPKc' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::demangle[abi:cxx11](char const*)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail14AdapterContext12reportResultERKNS0_10CaseResultE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::AdapterContext::reportResult(rc::detail::CaseResult const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail14AdapterContextC1Ev' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::AdapterContext::AdapterContext()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc17GenerationFailureC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::GenerationFailure::GenerationFailure(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6Random5splitEv' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::Random::split()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail13ImplicitScope8m_scopesE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::ImplicitScope::m_scopes
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail13configurationEv' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::configuration()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6Random4nextEv' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::Random::next()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc3gen6detail12shrinkRecipeERKNS1_6RecipeE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::gen::detail::shrinkRecipe(rc::gen::detail::Recipe const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail20mapToCaseDescriptionENS_3GenISt4pairINS0_12TaggedResultENS_3gen6detail6RecipeEEEE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::mapToCaseDescription(rc::Gen<std::pair<rc::detail::TaggedResult, rc::gen::detail::Recipe> >)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZTVN2rc6detail14AdapterContextE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of vtable for rc::detail::AdapterContext
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZNK2rc6detail14AdapterContext6resultEv' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::AdapterContext::result() const
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc3gen6detail11ExecHandlerC1ERNS1_6RecipeE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::gen::detail::ExecHandler::ExecHandler(rc::gen::detail::Recipe&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail18printResultMessageERKNS0_7VariantINS0_13SuccessResultEJNS0_13FailureResultENS0_12GaveUpResultENS0_5ErrorEEEERSo' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::printResultMessage(rc::detail::Variant<rc::detail::SuccessResult, rc::detail::FailureResult, rc::detail::GaveUpResult, rc::detail::Error> const&, std::ostream&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc3gen6detail5param14CurrentHandler12defaultValueEv' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::gen::detail::param::CurrentHandler::defaultValue()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail21makeExpressionMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_S8_' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::makeExpressionMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6RandomC1Ev' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::Random::Random()
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail13checkPropertyERKNS_3GenINS0_15CaseDescriptionEEERKNS0_12TestMetadataE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::checkProperty(rc::Gen<rc::detail::CaseDescription> const&, rc::detail::TestMetadata const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN2rc6detail10CaseResultC1ENS1_4TypeENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE' unresolved while linking function '__cxx_global_var_initcling_module_6_'!
You are probably missing the definition of rc::detail::CaseResult::CaseResult(rc::detail::CaseResult::Type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
Maybe you need to load the corresponding shared library?

- double reversal yields the original value
​```
armaninspace commented 2 years ago

Sorry my bad -- I had a typo on the load pragma