Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorganize cmake files(issue #113) #120

Merged
merged 8 commits into from
Jul 20, 2018
Merged

reorganize cmake files(issue #113) #120

merged 8 commits into from
Jul 20, 2018

Conversation

noskill
Copy link
Contributor

@noskill noskill commented Jul 11, 2018

It's my attempt at reorganizing cmake files #113

  1. move Find*.cmake files from atomspace to cogutil for installation
  2. generate CogUtilConfig.cmake so that FindCogUtil.cmake is not necessary

@linas
Copy link
Member

linas commented Jul 11, 2018

Some fixes are needed; the comments are similar to those of opencog/atomspace#1832

  • Don't remove the COPYING file, it pertains to the files in this directory.

  • The valgrind, vagrant, buildbot, conf and spec files have nothing to do with cmake. They belong in some other, appropriately-named directory.

@noskill
Copy link
Contributor Author

noskill commented Jul 12, 2018

updated

@ngeiswei
Copy link
Member

It seems to make sense (although,with the exception of cmake/CMakeLists.txt, I didn't carefully review it).

I suppose one of us need to test it on a fresh system before merging (I'll test it early next week if none of us has done it by then).

@vsbogd
Copy link
Contributor

vsbogd commented Jul 13, 2018

On my machine make install copied files CogUtilConfig.cmake CogUtilConfigVersion.cmake into root directory. I have passed installation path to cmake manually via CMAKE_INSTALL_PREFIX:

$ cmake -DCMAKE_INSTALL_PREFIX=$OPENCOG/test/build $OPENCOG/test/cogutils
$ make install
$ ls $OPENCOG/test/build
CogUtilConfig.cmake  CogUtilConfigVersion.cmake  include  lib  share

Copy link
Contributor

@vsbogd vsbogd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above #120 (comment)
Solved by change #120 (review)

${CMAKE_CURRENT_BINARY_DIR}/CogUtilConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/CogUtilConfig.cmake
DESTINATION
${CMAKE_INSTALL_PREFIX})
Copy link
Contributor

@vsbogd vsbogd Jul 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be ${LIB_INSTALL_DIR}/CogUtil/cmake

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

@vsbogd vsbogd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot make clean build after CogUtil is installed. Cmake finds CogUtilConfig.cmake file but include paths doesn't work:

 [  2%] Building CXX object opencog/truthvalue/CMakeFiles/truthvalue.dir/AttentionValue.cc.o
/home/vital/projects/opencog/test/atomspace/opencog/truthvalue/AttentionValue.cc:25:10: fatal error: opencog/util/exceptions.h: No such file or directory
 #include <opencog/util/exceptions.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/vital/projects/opencog/test/atomspace/opencog/atoms/proto/FloatValue.cc:23:10: fatal error: opencog/util/exceptions.h: No such file or directory
 #include <opencog/util/exceptions.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~

@noskill
Copy link
Contributor Author

noskill commented Jul 13, 2018

@vsbogd Thanks, i fixed include path, it should work now with custom prefix.

@vsbogd
Copy link
Contributor

vsbogd commented Jul 13, 2018

Checked again, CogUtil buils succesfully. I also can build atomspace but cannot build atomspace unit tests. See linkage error:

[ 17%] Linking CXX executable DefineLinkUTest
CMakeFiles/TVMergeUTest.dir/TVMergeUTest.cpp.o: In function `TVMergeUTest::testMerge()':
/home/vital/projects/opencog/test/atomspace-build/tests/truthvalue/../../../atomspace/tests/truthvalue/TVMergeUTest.cxxtest:96: undefined reference to `opencog::logger()'
...

@vsbogd
Copy link
Contributor

vsbogd commented Jul 14, 2018

CogUtil build successful, unit tests passed. Atomspace build successful, unit tests failed, but this is equal to baseline (opencog/atomspace master branch):

96% tests passed, 4 tests failed out of 113

Total Test time (real) = 233.34 sec

The following tests FAILED:
	 49 - MultiAtomSpaceUTest (Failed)
	 53 - VectorAPIUTest (Failed)
	 99 - NestedPutUTest (Failed)
	110 - BackwardChainerUTest (Failed)

@linas
Copy link
Member

linas commented Jul 14, 2018

Um, these unit tests never-ever fail for me; they've been passing just fine for years (well two of them are newer than that, but they always pass) For me, 121 tests total run, and they always pass.

We need a distinct bug report for each, to track down the problems. VectorAPI might be failing for the same reason that Nil has already reported.

@amebel
Copy link
Contributor

amebel commented Jul 16, 2018

Master branch unit test states

cogutil master sha = d789e4c                                          
100% tests passed, 0 tests failed out of 12                       
                                                                  
-----------------------                                           
atomspace master sha = ac76f43                                        
100% tests passed, 0 tests failed out of 120                      
                                                                  
-----------------------                                           
opencog master sha = cc9e331                                          
80% tests passed, 4 tests failed out of 20                        
                                                                  
Total Test time (real) = 225.43 sec                               
                                                                  
The following tests FAILED:                                       
          3 - CogServerUTest (SEGFAULT)                           
          6 - AtomOcTreeUTest (SEGFAULT)                          
          7 - TimeSpaceAtomUTest (SEGFAULT)                       
         11 - PLNRulesUTest (Failed)                              
                                                                  

Pull request's unit test states

cogutil pr 120 sha = 8f7c7e5                                          
100% tests passed, 0 tests failed out of 12                       
                                                                  
-----------------------                                           
atomspace pr 1832 sha= f9809df                                       
atomspace pr 1823 rebased on master sha = 62701cd                                     
100% tests passed, 0 tests failed out of 120                      
                                                                  
-----------------------                                           
opencog master = cc9e331                                          
80% tests passed, 4 tests failed out of 20                        
                                                                  
Total Test time (real) = 225.76 sec                               
                                                                  
The following tests FAILED:                                       
          3 - CogServerUTest (SEGFAULT)                           
          6 - AtomOcTreeUTest (SEGFAULT)                          
          7 - TimeSpaceAtomUTest (SEGFAULT)                       
         11 - PLNRulesUTest (Failed)                              
                                                                  

@vsbogd
Copy link
Contributor

vsbogd commented Jul 17, 2018

Raised issue opencog/atomspace#1834 on VectorAPIUTest failure. Looks like it fails on clean build because there are no OpenCog node types which are used in test data.

@vsbogd
Copy link
Contributor

vsbogd commented Jul 17, 2018

Other tests fail because I didn't do make install before running. Raised separate issue opencog/atomspace#1835 on this

IF ("${MODULE_NAME}.scm" STREQUAL "${FILE_NAME}")
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E make_directory ${GUILE_SYMLINK_DIR}/${MODULE_FILE_DIR_PATH}
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}" "${GUILE_SYMLINK_DIR}/${MODULE_FILE_DIR_PATH}/${FILE_NAME}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not this PR issue but rather an issue that exists in opencog/atomspace master branch.

EXECUTE_PROCESS chaining make_directory and create_symlink actions fails sporadically because directory is not created at the moment when symlinks is being created:

failed to create symbolic link '/tmp/test/atomspace-build/opencog/scm//opencog/matrix.scm': No such file or directory

Can be fixed by replacing one EXECUTE_PROCESS with two commands by two EXECUTE_PROCESS lines with one command in each:

IF ("${MODULE_NAME}.scm" STREQUAL "${FILE_NAME}")
    EXECUTE_PROCESS(
        COMMAND ${CMAKE_COMMAND} -E make_directory ${GUILE_SYMLINK_DIR}/${MODULE_FILE_DIR_PATH}
    )
    EXECUTE_PROCESS(
        COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}" "${GUILE_SYMLINK_DIR}/${MODULE_FILE_DIR_PATH}/${FILE_NAME}"
    )
    SET(FILE_INSTALL_PATH "${GUILE_INSTALL_DIR}/${MODULE_FILE_DIR_PATH}"
        PARENT_SCOPE
    )
ELSE()
    EXECUTE_PROCESS(
        COMMAND ${CMAKE_COMMAND} -E make_directory ${GUILE_SYMLINK_DIR}/${MODULE_DIR_PATH}
    )
    EXECUTE_PROCESS(
        COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CURRENT_SOURCE_DIR}/${FILE_NAME}" "${GUILE_SYMLINK_DIR}/${MODULE_DIR_PATH}/${FILE_NAME}"
    )
    SET(FILE_INSTALL_PATH "${GUILE_INSTALL_DIR}/${MODULE_DIR_PATH}"
        PARENT_SCOPE
    )
ENDIF()

Raising it here because it should be fixed either in this PR or after this PR is merged.

@ngeiswei
Copy link
Member

Testing this is proving more difficult. I could persevere but it seems it has been sufficiently tested by you guy (thanks a lot for your effort!).

I'll wait 24h in case you have something else to say about it and I'll merge.

@noskill
Copy link
Contributor Author

noskill commented Jul 19, 2018

@ngeiswei I moved some opencog cmake files here as well.

@vsbogd
Copy link
Contributor

vsbogd commented Jul 19, 2018

@noskill, I would prefer raising next PR to move .cmake files from opencog/opencog to opencog/cogutil to not test this PR twice.

@ngeiswei
Copy link
Member

@vsbogd I've sent you an invite so you have merging rights, to share a bit the burden :-) hopefully nobody has something against that and I trust you'll use your rights wisely.

@vsbogd
Copy link
Contributor

vsbogd commented Jul 19, 2018

Thanks, @ngeiswei, will do my best to do the things right.

@noskill
Copy link
Contributor Author

noskill commented Jul 19, 2018

@vsbogd I removed commit with opencog cmake files..

@linas
Copy link
Member

linas commented Jul 19, 2018

merging rights

Yeah, OK.

@vsbogd vsbogd merged commit a338378 into opencog:master Jul 20, 2018
@ngeiswei
Copy link
Member

Thanks @noskill, and thanks @vsbogd for taking care of it.

@linas
Copy link
Member

linas commented Nov 29, 2018

FYI, in issue opencog/atomspace#1923, it has been observed that three files were moved from atomspace to cogutils by mistake: OpenCogAtomTypes.cmake, OpenCogFunctions.cmake and OpenCogMacros.cmake I'm encouraging the required pull reqs to move them back to the atomspace, and remove them from cogutils.

@noskill
Copy link
Contributor Author

noskill commented Nov 30, 2018

@linas OPENCOG_ADD_ATOM_TYPES defined in OpenCogMacros.cmake is used in other projects, not only in atomspace. I think that commonly used cmake files better stay in cogutil.

@smigad
Copy link
Member

smigad commented Nov 30, 2018

But that is only useful if the atomspace is installed. It makes sense to have it in the atomspace repo don't it.

@linas
Copy link
Member

linas commented Nov 30, 2018

@noskill Yes, I'm the one who designed it so that other projects use OPENCOG_ADD_ATOM_TYPES. :-) So @Dagiopia is correct, that macro only makes sense if the atomspace is installed; it references files that exist only in the atomspace, and requires glue code that exists only in the atomspace.

It really did get moved by accident; I just wasn't paying attention when your original pull req went through; and apparently no one else was, either. Accidents happen.

@linas
Copy link
Member

linas commented Nov 30, 2018

The point is: @Dagiopia please do go ahead to create a pull req to fix this. It will take a while to get through, as we need a cooling-off period to make sure that the other repos (opencog, as-moses and agi-bio) are not adversely affected. With a bit of luck, this change should be invisible to the other repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants