xeus-cling
xeus-cling copied to clipboard
make && make install error while using cpp-argparse 3.0
(xeus-cling) anutosh491@spbhat68:~/QuantStack/xeus-cling/build$ make && make install
[ 9%] Building CXX object CMakeFiles/xeus-cling.dir/src/xinterpreter.cpp.o
[ 18%] Building CXX object CMakeFiles/xeus-cling.dir/src/xoptions.cpp.o
[ 27%] Building CXX object CMakeFiles/xeus-cling.dir/src/xmagics/executable.cpp.o
/home/anutosh491/QuantStack/xeus-cling/src/xmagics/executable.cpp: In member function 'xcpp::argparser xcpp::executable::get_options()':
/home/anutosh491/QuantStack/xeus-cling/src/xmagics/executable.cpp:70:16: error: use of deleted function 'xcpp::argparser::argparser(const xcpp::argparser&)'
70 | return argpars;
| ^~~~~~~
In file included from /home/anutosh491/QuantStack/xeus-cling/src/xmagics/executable.cpp:37:
/home/anutosh491/QuantStack/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: note: 'xcpp::argparser::argparser(const xcpp::argparser&)' is implicitly deleted because the default definition would be ill-formed:
21 | struct argparser : public argparse::ArgumentParser
| ^~~~~~~~~
/home/anutosh491/QuantStack/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: error: use of deleted function 'argparse::ArgumentParser::ArgumentParser(const argparse::ArgumentParser&)'
In file included from /home/anutosh491/QuantStack/xeus-cling/include/xeus-cling/xoptions.hpp:15,
from /home/anutosh491/QuantStack/xeus-cling/src/xmagics/executable.cpp:37:
/home/anutosh491/conda_root/envs/xeus-cling/include/argparse/argparse.hpp:1477:3: note: declared here
1477 | ArgumentParser(const ArgumentParser &other) = delete;
| ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/xeus-cling.dir/build.make:146: CMakeFiles/xeus-cling.dir/src/xmagics/executable.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:166: CMakeFiles/xeus-cling.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
I think the readme can specify the version to be below 3.0
(currently it says that the version can be somewhere around 2.9
)
on gentoo linux i have a problem compiling with cpp-argparse v2.9 or v3.0
this is with 3.0:
/home/ufk/src/xeus-cling/src/xmagics/executable.cpp: In member function 'xcpp::argparser xcpp::executable::get_options()':
/home/ufk/src/xeus-cling/src/xmagics/executable.cpp:70:16: error: use of deleted function 'xcpp::argparser::argparser(const xcpp::argparser&)'
70 | return argpars;
| ^~~~~~~
In file included from /home/ufk/src/xeus-cling/src/xmagics/executable.cpp:37:
/home/ufk/src/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: note: 'xcpp::argparser::argparser(const xcpp::argparser&)' is implicitly deleted because the default definition would be ill-formed:
21 | struct argparser : public argparse::ArgumentParser
| ^~~~~~~~~
/home/ufk/src/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: error: use of deleted function 'argparse::ArgumentParser::ArgumentParser(const argparse::ArgumentParser&)'
In file included from /home/ufk/src/xeus-cling/include/xeus-cling/xoptions.hpp:15,
from /home/ufk/src/xeus-cling/src/xmagics/executable.cpp:37:
/home/ufk/miniforge3/envs/xeus-cling/include/argparse/argparse.hpp:1477:3: note: declared here
1477 | ArgumentParser(const ArgumentParser &other) = delete;
| ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/xeus-cling.dir/build.make:146: CMakeFiles/xeus-cling.dir/src/xmagics/executable.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:166: CMakeFiles/xeus-cling.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
and v2.9:
/home/ufk/src/xeus-cling/src/xmagics/executable.cpp: In member function ‘xcpp::argparser xcpp::executable::get_options()’:
/home/ufk/src/xeus-cling/src/xmagics/executable.cpp:70:16: error: use of deleted function ‘xcpp::argparser::argparser(xcpp::argparser&&)’
70 | return argpars;
| ^~~~~~~
In file included from /home/ufk/src/xeus-cling/src/xmagics/executable.cpp:37:
/home/ufk/src/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: note: ‘xcpp::argparser::argparser(xcpp::argparser&&)’ is implicitly deleted because the default definition would be ill-formed:
21 | struct argparser : public argparse::ArgumentParser
| ^~~~~~~~~
/home/ufk/src/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: error: use of deleted function ‘argparse::ArgumentParser::ArgumentParser(argparse::ArgumentParser&&)’
In file included from /home/ufk/src/xeus-cling/include/xeus-cling/xoptions.hpp:15:
/home/ufk/miniforge3/envs/xeus-cling/include/argparse/argparse.hpp:1479:3: note: declared here
1479 | ArgumentParser(ArgumentParser &&) noexcept = delete;
| ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/xeus-cling.dir/build.make:146: CMakeFiles/xeus-cling.dir/src/xmagics/executable.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:166: CMakeFiles/xeus-cling.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
me too in Arch Linux https://aur.archlinux.org/packages/xeus-cling#comment-947511
Thank you for forwarding this @carlosal1015. I have now learned a little more about C++ and am trying to solve this problem. The &&
symbol in the error messages is essentially referring to the moving of objects in C++. The README of argparse mentions that copying and moving are forbidden (see also https://github.com/p-ranav/argparse/issues/260). My first instinct is now to wrap argparser
in a unique_ptr
so it can be returned without copying.
(In the event that this solution cause undefined behavior [e.g. maybe due to things being freed when going out of scope], one could add another layer of indirection by using callbacks in order to keep things on the stack for a longer period of time. I made a sketch of this kind of solution as well but hopefully it won't be necessary to use it.)
For any arch linux user wishing to build and install xeus-cling with my changes:
-
git clone https://aur.archlinux.org/xeus-cling.git
-
makepkg
inside the downloaded folder (it will give the error discussed above) - copy over the new contents of
src/xmagics
from my branch -
makepkg --noextract -si
Many thanks @JoelSjogren. ~I will push soon~. Pushed,
@anutosh491 I am also facing the same build error. Did you figure out how to solve this? There's a PR #512 too but not being merged yet. I am using Ubuntu 22.04.4.
(xeus-cling) ukiyo@ukiyo-Nitro-AN515-44:~/xeus-cling/build$ cmake && make install
Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
cmake [options] -S <path-to-source> -B <path-to-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
Run 'cmake --help' for more information.
[ 9%] Building CXX object CMakeFiles/xeus-cling.dir/src/xmagics/executable.cpp.o
/home/ukiyo/xeus-cling/src/xmagics/executable.cpp: In member function 'xcpp::argparser xcpp::executable::get_options()':
/home/ukiyo/xeus-cling/src/xmagics/executable.cpp:70:16: error: use of deleted function 'xcpp::argparser::argparser(const xcpp::argparser&)'
70 | return argpars;
| ^~~~~~~
In file included from /home/ukiyo/xeus-cling/src/xmagics/executable.cpp:37:
/home/ukiyo/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: note: 'xcpp::argparser::argparser(const xcpp::argparser&)' is implicitly deleted because the default definition would be ill-formed:
21 | struct argparser : public argparse::ArgumentParser
| ^~~~~~~~~
/home/ukiyo/xeus-cling/include/xeus-cling/xoptions.hpp:21:12: error: use of deleted function 'argparse::ArgumentParser::ArgumentParser(const argparse::ArgumentParser&)'
In file included from /home/ukiyo/xeus-cling/include/xeus-cling/xoptions.hpp:15,
from /home/ukiyo/xeus-cling/src/xmagics/executable.cpp:37:
/home/ukiyo/miniforge3/envs/xeus-cling/include/argparse/argparse.hpp:1477:3: note: declared here
1477 | ArgumentParser(const ArgumentParser &other) = delete;
| ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/xeus-cling.dir/build.make:146: CMakeFiles/xeus-cling.dir/src/xmagics/executable.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:166: CMakeFiles/xeus-cling.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Hey @JoelSjogren @chococandy63 @carlosal1015
I believe #522 should be the correct fix for this. Y'all can have a look
Looks fine to me if it works. I don't know exactly what the versioning constraints are for but your approach with references is technically simpler than my unique_ptr
approach.
Exactly. It's a simpler approach and supports compatibility with cpp-argparse 3.xx
Hey @JoelSjogren @chococandy63 @carlosal1015
I believe #522 should be the correct fix for this. Y'all can have a look
Thanks, I replaced old PR with this one in AUR package.
Hi @JoelSjogren @chococandy63 looks like that this patch is not working for argparse 3.0-2.
https://aur.archlinux.org/packages/xeus-cling#comment-968030
I'm facing the same error, with cling 0.9 , argparse 3.0 and nlohmann-json 3.11.2
Hi @JoelSjogren @chococandy63 looks like that this patch is not working for argparse 3.0-2.
https://aur.archlinux.org/packages/xeus-cling#comment-968030
But this ticket is closed. Should a new one be opened? @carlosal1015 Which fix has been used in Arch?