opencog / attention

OpenCog Attention Allocation Subsystem
Other
12 stars 19 forks source link

OpenCogAtomTypes.cmake not found #11

Closed rekado closed 4 years ago

rekado commented 4 years ago

I'm trying to build the latest commit (87d4367) of attention with the latest commits of cogutil (b07b41b2eaf01627c78b27f1f28bb09ef7086f8e), atomspace (ed1d316a44ddca5791712ebdc291770905a72f05), and cogserver (c8ad85fef446819e6bd711f0791887a5aa6a41f9). The build almost immediately aborts:

/gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -S/tmp/guix-build-attention-0-1.87d4367.drv-0/source -B/tmp/guix-build-attention-0-1.87d4367.drv-0/build --check-build-system CMakeFiles/Makefile.cmake 0
/gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_progress_start /tmp/guix-build-attention-0-1.87d4367.drv-0/build/CMakeFiles /tmp/guix-build-attention-0-1.87d4367.drv-0/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/CMakeFiles/SCM_CONFIG.dir/build.make opencog/CMakeFiles/SCM_CONFIG.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/CMakeFiles/SCM_CONFIG.dir/DependInfo.cmake --color=
Scanning dependencies of target SCM_CONFIG
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/CMakeFiles/SCM_CONFIG.dir/build.make opencog/CMakeFiles/SCM_CONFIG.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[2]: Nothing to be done for 'opencog/CMakeFiles/SCM_CONFIG.dir/build'.
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
[  0%] Built target SCM_CONFIG
make -f opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build.make opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/DependInfo.cmake --color=
Scanning dependencies of target COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build.make opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E copy /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank/scm//attention-bank.scm /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/scm//opencog/attention-bank.scm
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
[  0%] Built target COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank
make -f opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build.make opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank/types /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/types /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/DependInfo.cmake --color=
Scanning dependencies of target attention_atom_types
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build.make opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[2]: *** No rule to make target '/gnu/store/a21dzdwc2xvyz8wmlkq16jw0x34wpwrm-attention-0-1.87d4367/share/opencog/cmake/OpenCogAtomTypes.cmake', needed by 'opencog/attentionbank/types/atom_types.h'.  Stop.
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:439: opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make: *** [Makefile:155: all] Error 2
command "make" failed with status 2

This line here:

make[2]: *** No rule to make target '/gnu/store/a21dzdwc2xvyz8wmlkq16jw0x34wpwrm-attention-0-1.87d4367/share/opencog/cmake/OpenCogAtomTypes.cmake', needed by 'opencog/attentionbank/types/atom_types.h'. Stop.

shows that OpenCogAtomTypes.cmake, which is provided by atomspace is somehow expected to be found in the current project's target directory.

(Guix installs every package to its own prefix directory under /gnu/store/...-name-version/.)

linas commented 4 years ago

I'm looking now.

In the non-guix builds, it works as follows:

I am currently imagining that the CMakefile for `attention has cut-n-paste errors in it.

linas commented 4 years ago

I just pushed 86f0bfb2da3d4e9913e89edbe9c97700a6762bf9 but I am 99.9% sure that will not fix this problem.

linas commented 4 years ago

Oh, I think I see ... the macro /usr/local/share/opencog/cmake/OpenCogMacros.cmake:MACRO(OPENCOG_ADD_ATOM_TYPES is getting the dependency wrong. it should not have looked for a dependency in the source tree. let me fiddle with it.

linas commented 4 years ago

Yes, I'm 95% certain that the core problem is this:

In /usr/local/share/opencog/cmake/OpenCogMacros.cmake (which is mis-named, it should be called AtomSpaceMacros.cmake, but that's for some future rainy day.) I see the following:

    IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/OpenCogAtomTypes.cmake)
        SET(OC_ATOM_TYPES_PATH ${CMAKE_SOURCE_DIR}/cmake/OpenCogAtomTypes.cmake)
    ELSE()
        SET(OC_ATOM_TYPES_PATH ${DATADIR}/cmake/OpenCogAtomTypes.cmake)
    ENDIF()

Clear, the IF cannot be taken, so the ELSE is taken. But what's $DATADIR ? Well, in attention/Cmakefile I see this:

IF (NOT DEFINED DATADIR)
   SET (DATADIR "${CMAKE_INSTALL_PREFIX}/share/opencog")
ENDIF (NOT DEFINED DATADIR)

which would resolve into /usr/local/share/opencog and everything works.

I bet that in guix, that you have $DATADIR set to .. the source directory.

I'm guessing that the correct fix is to modify OpenCogMacros.cmake to not look at $DATADIR and to instead just look at it's own install path. Let me see if I can figure out how to do that.

linas commented 4 years ago

(Yes, all these IFs are ugly .. people kind of come in and hack on things and it gets crufty after a while).

linas commented 4 years ago

I am guessing that opencog/atomspace#2463 will fix this problem. It's not terribly elegant, but it seems to be in the spirit of the other path mangling being done. If you have a better fix, let me know; none of this is sacrosanct.

rekado commented 4 years ago

Thank you, this fixed the build of the Attention package.