heal-research / operon

C++ Large Scale Genetic Programming
https://operongp.readthedocs.io
MIT License
144 stars 26 forks source link

Building operon fails with a compiler error #30

Closed NiklasKappel closed 1 year ago

NiklasKappel commented 1 year ago

Hi, I am a PhD student interested in building and trying out operon. I tried the following (in a fresh Fedora 38 virtual machine):

sh <(curl -L https://nixos.org/nix/install) --no-daemon
# Log out and back in.
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
nix build github:heal-research/operon --no-write-lock-file

This fails with:

...
• Added input 'vstat/nixpkgs':
    'github:nixos/nixpkgs/be1e28024612051e1300b1ef7f325831185cad1a' (2023-04-26)
error: builder for '/nix/store/gnyv2phx4z5n9rblc6hs2j3ivfrxkjxc-operon.drv' failed with exit code 2;
       last 10 log lines:
       >       |                     ^~~
       > /build/source/include/operon/operators/evaluator.hpp: At global scope:
       > /build/source/include/operon/operators/evaluator.hpp:244:21: error: 'Map' in namespace 'Operon' does not name a template type
       >   244 |     mutable Operon::Map<size_t, size_t> divmap_;
       >       |                     ^~~
       > make[2]: *** [CMakeFiles/operon_operon.dir/build.make:104: CMakeFiles/operon_operon.dir/source/core/dataset.cpp.o] Error 1
       > make[2]: *** [CMakeFiles/operon_operon.dir/build.make:76: CMakeFiles/operon_operon.dir/source/algorithms/gp.cpp.o] Error 1
       > make[2]: *** [CMakeFiles/operon_operon.dir/build.make:90: CMakeFiles/operon_operon.dir/source/algorithms/nsga2.cpp.o] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/operon_operon.dir/all] Error 2
       > make: *** [Makefile:156: all] Error 2
       For full logs, run 'nix log /nix/store/gnyv2phx4z5n9rblc6hs2j3ivfrxkjxc-operon.drv'.

Then I cloned the repo and tried the instructions in BUILDING.md (on Fedora 38 Silverblue):

nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
cmake --build build

Which fails with the same error 'Map' in namespace 'Operon' does not name a template type. Full CMake outputs are here and here.

This confuses me a bit because I am pretty sure that I successfully built operon earlier this month and the last commit to the master branch seems to be over a month old.

foolnotion commented 1 year ago

Hi,

Thanks for reporting this. There was a change in one of the upstream deps and the fix was not yet ported to the main branch. Should be fixed now with 29e0cc9fe4138a035a9696cc7b017a7c086c7b35

All in all, if possible I recommend using the cpp20 branch: nix build github:heal-research/operon/cpp20 --no-write-lock-file

NiklasKappel commented 1 year ago

Thanks for the quick reply! The instructions in README.md, BUILDING.md and HACKING.md now all work for me in both the master and cpp20 branches.