arximboldi/immer

can't find guile inside nix-shell

Closed this issue · 2 comments

Hi! I'm interested in testing the guile bindings and creating bindings for ChezScheme, but currently I can't get CMake to find guile inside the nix-shell. I tried installing it with

nix-env -iA nixpkgs.guile

Outside the nix-shell CMake does find guile and all other development dependencies, but it generates a warning

-- Found GC library: /usr/lib/x86_64-linux-gnu/libgc.so
CMake Warning (dev) at /usr/local/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (Boehm_GC)
  does not match the name of the calling package (BoehmGC).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindBoehmGC.cmake:105 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:73 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

and make guile fails

$ make guile
Scanning dependencies of target guile-immer
Building CXX object extra/guile/CMakeFiles/guile-immer.dir/src/immer.cpp.o
In file included from /home/rigille/repositories/cpp/immer/extra/guile/scm/val.hpp:11,
                 from /home/rigille/repositories/cpp/immer/extra/guile/scm/scm.hpp:11,
                 from /home/rigille/repositories/cpp/immer/extra/guile/src/immer.cpp:13:
/home/rigille/repositories/cpp/immer/extra/guile/scm/detail/convert.hpp:28:62: error: extra ‘;’ [-Werror=pedantic]
   28 |         convert<std::decay_t<T>>::to_scm(std::forward<T>(v)));
      |                                                              ^
…

removing the warning flags in line 10 of CMakeLists.txt the errors are different

$ make guile
Scanning dependencies of target guile-immer
Building CXX object extra/guile/CMakeFiles/guile-immer.dir/src/immer.cpp.o
/home/rigille/repositories/cpp/immer/extra/guile/src/immer.cpp: In instantiation of ‘void {anonymous}::init_ivector(std::string) [with T = scm::val; std::string = std::__cxx11::basic_string<char>]’:
/home/rigille/repositories/cpp/immer/extra/guile/src/immer.cpp:137:18:   required from here
/home/rigille/repositories/cpp/immer/extra/guile/src/immer.cpp:88:41: error: no matching function for call to ‘immer::flex_vector<scm::val, immer::memory_policy<immer::heap_policy<{anonymous}::guile_heap>, immer::no_refcount_policy, immer::spinlock_policy, immer::gc_transience_policy, false>, 5, 5>::flex_vector(scm::list, scm::list)’
   88 |             [](scm::args rest) { return self_t(rest.begin(), rest.end()); })
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/rigille/repositories/cpp/immer/extra/guile/src/immer.cpp:10:
/home/rigille/repositories/cpp/immer/immer/flex_vector.hpp:121:5: note: candidate: ‘immer::flex_vector<T, MemoryPolicy, B, BL>::flex_vector(immer::flex_vector<T, MemoryPolicy, B, BL>::size_type, T) [with T = scm::val; MemoryPolicy = immer::memory_policy<immer::heap_policy<{anonymous}::guile_heap>, immer::no_refcount_policy, immer::spinlock_policy, immer::gc_transience_policy, false>; unsigned int B = 5; unsigned int BL = 5; immer::flex_vector<T, MemoryPolicy, B, BL>::size_type = long unsigned int]’ <near match>
  121 |     flex_vector(size_type n, T v = {})
      |     ^~~~~~~~~~~
…

i also tried to checkout cf752, which was the last commit that modified extra/guile outside the nix-shell and got the same errors, which makes me think it's a problem with my build environment and not the project. Any ideas on how to fix this?

I must admit that I haven't tried the Guile bindings in a long time... so it may be actually be related to the project. I have upgraded the compilers brought into the Nix shell since then. I would need to look deeper into this...

Hi!

Since the Guile bindings are experimental and not really supported, and the issues seem to be build-system/setup related, I am gonna close this issue for now. That provided code is anyway just an example and hopefully it helped you get some inspiration on how to make your own bindings for ChezScheme. If you are interested in this, I extracted some of the binding infrastructure into another project, which admitelly is also largely outdated, but may help you solve the setup issues you are finding when trying to build the bindings included alongside Immer: https://github.com/arximboldi/schmutz

Cheers!