opencog / cogutil

Very low-level C++ programming utilities used by several components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MacOS: Some tests are failing

AnastasiaSulyagina opened this issue · comments

Hi,
After I built cogutil (looks like it was successfully built)

Scanning dependencies of target cogutil
[ 4%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/ansi.cc.o
[ 9%] Building C object opencog/util/CMakeFiles/cogutil.dir/backtrace-symbols.c.o
[ 13%] Building C object opencog/util/CMakeFiles/cogutil.dir/cluster.c.o
[ 18%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/Config.cc.o
[ 22%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/exceptions.cc.o
[ 27%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/files.cc.o
[ 31%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/lazy_normal_selector.cc.o
[ 36%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/lazy_random_selector.cc.o
[ 40%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/lazy_selector.cc.o
[ 45%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/log_prog_name.cc.o
[ 50%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/Logger.cc.o
/Users/anastasia/Development/GitHub/cogutil/opencog/util/Logger.cc: In member function 'void opencog::Logger::log(opencog::Logger::Level, const string&)':
/Users/anastasia/Development/GitHub/cogutil/opencog/util/Logger.cc:422:60: warning: format '%ld' expects argument of type 'long int', but argument 5 has type '__darwin_suseconds_t {aka int}' [-Wformat=]
"[%s:%03ld] ",timestamp, stv.tv_usec / 1000);
~~~~~~~~~~~~~~~~~~^
[ 54%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/misc.cc.o
[ 59%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/mt19937ar.cc.o
[ 63%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/oc_assert.cc.o
[ 68%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/oc_omp.cc.o
[ 72%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/octime.cc.o
[ 77%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/platform.cc.o
/Users/anastasia/Development/GitHub/cogutil/opencog/util/platform.cc: In function 'size_t opencog::getMemUsage()':
/Users/anastasia/Development/GitHub/cogutil/opencog/util/platform.cc:179:21: warning: 'void* sbrk(int)' is deprecated [-Wdeprecated-declarations]
void *p = sbrk(0);
^
In file included from /Users/anastasia/Development/GitHub/cogutil/opencog/util/platform.cc:172:0:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:587:7: note: declared here
void *sbrk(int);
^~~~
[ 81%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/StringTokenizer.cc.o
[ 86%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/tree.cc.o
[ 90%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/strndup.cc.o
[ 95%] Building CXX object opencog/util/CMakeFiles/cogutil.dir/strnlen.cc.o
[100%] Linking CXX shared library libcogutil.dylib
[100%] Built target cogutil

When I run 'make test'
Some tests are failing

[ 37%] Built target cogutil
[ 38%] Generating iostreamContainerUTest.cpp
Scanning dependencies of target iostreamContainerUTest
[ 40%] Building CXX object tests/util/CMakeFiles/iostreamContainerUTest.dir/iostreamContainerUTest.cpp.o
[ 42%] Linking CXX executable iostreamContainerUTest
[ 42%] Built target iostreamContainerUTest
[ 44%] Generating rankingUTest.cpp
Scanning dependencies of target rankingUTest
[ 45%] Building CXX object tests/util/CMakeFiles/rankingUTest.dir/rankingUTest.cpp.o
[ 47%] Linking CXX executable rankingUTest
[ 47%] Built target rankingUTest
[ 49%] Generating randomUTest.cpp
Scanning dependencies of target randomUTest
[ 50%] Building CXX object tests/util/CMakeFiles/randomUTest.dir/randomUTest.cpp.o
[ 52%] Linking CXX executable randomUTest
[ 52%] Built target randomUTest
[ 54%] Generating ConfigUTest.cpp
Scanning dependencies of target ConfigUTest
[ 55%] Building CXX object tests/util/CMakeFiles/ConfigUTest.dir/ConfigUTest.cpp.o
[ 57%] Linking CXX executable ConfigUTest
[ 57%] Built target ConfigUTest
[ 59%] Generating lazy_selectorUTest.cpp
Scanning dependencies of target lazy_selectorUTest
[ 61%] Building CXX object tests/util/CMakeFiles/lazy_selectorUTest.dir/lazy_selectorUTest.cpp.o
[ 62%] Linking CXX executable lazy_selectorUTest
[ 62%] Built target lazy_selectorUTest
[ 64%] Generating StringTokenizerUTest.cpp
Scanning dependencies of target StringTokenizerUTest
[ 66%] Building CXX object tests/util/CMakeFiles/StringTokenizerUTest.dir/StringTokenizerUTest.cpp.o
[ 67%] Linking CXX executable StringTokenizerUTest
[ 67%] Built target StringTokenizerUTest
[ 69%] Generating KLDUTest.cpp
Scanning dependencies of target KLDUTest
[ 71%] Building CXX object tests/util/CMakeFiles/KLDUTest.dir/KLDUTest.cpp.o
[ 72%] Linking CXX executable KLDUTest
[ 72%] Built target KLDUTest
[ 74%] Generating CounterUTest.cpp
Scanning dependencies of target CounterUTest
[ 76%] Building CXX object tests/util/CMakeFiles/CounterUTest.dir/CounterUTest.cpp.o
[ 77%] Linking CXX executable CounterUTest
[ 77%] Built target CounterUTest
[ 79%] Generating functionalUTest.cpp
Scanning dependencies of target functionalUTest
[ 81%] Building CXX object tests/util/CMakeFiles/functionalUTest.dir/functionalUTest.cpp.o
[ 83%] Linking CXX executable functionalUTest
[ 83%] Built target functionalUTest
[ 84%] Generating comprehensionUTest.cpp
Scanning dependencies of target comprehensionUTest
[ 86%] Building CXX object tests/util/CMakeFiles/comprehensionUTest.dir/comprehensionUTest.cpp.o
[ 88%] Linking CXX executable comprehensionUTest
[ 88%] Built target comprehensionUTest
[ 89%] Generating lru_cacheUTest.cpp
Scanning dependencies of target lru_cacheUTest
[ 91%] Building CXX object tests/util/CMakeFiles/lru_cacheUTest.dir/lru_cacheUTest.cpp.o
[ 93%] Linking CXX executable lru_cacheUTest
[ 93%] Built target lru_cacheUTest
[ 94%] Generating LoggerUTest.cpp
Scanning dependencies of target LoggerUTest
[ 96%] Building CXX object tests/util/CMakeFiles/LoggerUTest.dir/LoggerUTest.cpp.o
[ 98%] Linking CXX executable LoggerUTest
[ 98%] Built target LoggerUTest
Scanning dependencies of target tests
[ 98%] Built target tests
Scanning dependencies of target test
[100%] Running tests...
Test project /Users/anastasia/Development/GitHub/cogutil/build/tests
Start 1: ConfigUTest
1/12 Test #1: ConfigUTest ......................***Exception: Child aborted 0.03 sec
Start 2: LoggerUTest
2/12 Test #2: LoggerUTest ...................... Passed 1.02 sec
Start 3: StringTokenizerUTest
3/12 Test #3: StringTokenizerUTest ............. Passed 0.01 sec
Start 4: lazy_selectorUTest
4/12 Test #4: lazy_selectorUTest ............... Passed 0.01 sec
Start 5: lru_cacheUTest
5/12 Test #5: lru_cacheUTest ...................***Exception: Child aborted 0.01 sec
Start 6: iostreamContainerUTest
6/12 Test #6: iostreamContainerUTest ...........***Exception: Child aborted 0.01 sec
Start 7: functionalUTest
7/12 Test #7: functionalUTest .................. Passed 0.01 sec
Start 8: KLDUTest
8/12 Test #8: KLDUTest ......................... Passed 4.98 sec
Start 9: randomUTest
9/12 Test #9: randomUTest ...................... Passed 3.10 sec
Start 10: comprehensionUTest
10/12 Test #10: comprehensionUTest ............... Passed 0.01 sec
Start 11: CounterUTest
11/12 Test #11: CounterUTest ..................... Passed 0.01 sec
Start 12: rankingUTest
12/12 Test #12: rankingUTest ..................... Passed 0.01 sec

75% tests passed, 3 tests failed out of 12

Total Test time (real) = 9.24 sec

The following tests FAILED:
1 - ConfigUTest (Child aborted)
5 - lru_cacheUTest (Child aborted)
6 - iostreamContainerUTest (Child aborted)
Errors while running CTest
make[3]: *** [CMakeFiles/test] Error 8
make[2]: *** [CMakeFiles/test.dir/all] Error 2
make[1]: *** [CMakeFiles/test.dir/rule] Error 2
make: *** [test] Error 2

Would appreciate any help on how to fix\debug it
Thanks!

They all pass for me. @AnastasiaSulyagina what is your system (OS, gcc, RAM maybe)?

Oh, you may paste the output of cmake .. for instance.

@ngeiswei, OSX 10.13.1, RAM 8g

MacBook-Pro-Anastasia build $ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

MacBook-Pro-Anastasia build $ cmake ..
CMake Deprecation Warning at CMakeLists.txt:21 (CMAKE_POLICY):
The OLD behavior for policy CMP0005 will be removed from a future version
of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.

-- The C compiler identification is AppleClang 9.0.0.9000038
-- The CXX compiler identification is GNU 7.2.0
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/Cellar/gcc/7.2.0/bin/g++-7
-- Check for working CXX compiler: /usr/local/Cellar/gcc/7.2.0/bin/g++-7 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type: Release
-- Looking for include file bfd.h
-- Looking for include file bfd.h - not found
-- BFD not found
-- Binutils-dev missing: No pretty stack-trace printing.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Boost version: 1.65.1
-- Found the following Boost libraries:
-- date_time
-- filesystem
-- program_options
-- regex
-- serialization
-- system
-- thread
-- chrono
-- atomic
-- Boost version 106501 found.
-- Found PythonInterp: /Users/anastasia/Development/TOOLS/anaconda3/bin/python (found version "3.5.2")
-- Looking for include file libiberty.h
-- Looking for include file libiberty.h - not found
-- IBERTY not found
-- Libiberty-dev missing: No pretty stack-trace printing.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Doxygen not found, you won't be able to generate API documentation.

The following components will be built:

Unit tests - Unit tests.
Util - General utility library.

The following components WILL NOT be built:

Doxygen - Code documentation.
StackPrint - Pretty printing of stack traces.

-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.

MACOSX_RPATH is not specified for the following targets:

cogutil

This warning is for project developers. Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/anastasia/Development/GitHub/cogutil/build

Would appreciate any help on how to fix\debug it

These are standard c++ programs, so you would have to use standard c++ techniques to fix and debug them. That requires knowing how to program in C++ ...

The core problem is that you are using MacOS, and very few people (basically, no one at all) uses MacOS to develop opencog. So I would hope that all of these problems are "simple" and "easy to fix". but again, you'd need to know how to program to do that ...

@linas I used to do some c++ and can try to fix it but it could be easier for me if I knew at least source and scale of the problem. I want to use opencog for a long-term project and am not sure if it would be easier to work now to fix it for mac os or do everything in some other os.

Its certainly easier to do everything in Linux. Linux has a much much better software development environment than MacOS or Windows. Now, if you were absolutely devoted to macOS, then perhaps doing the port "can't possibly be that hard" but you'd probably need to understand what MacOS offers a much deeper level. The issues are all presumably compiler, linker-loader and shared library incompatibilities; on another project, we've already learned that e.g. anaconda on macOS is really hard to work with.

@AnastasiaSulyagina if you want to attempt to fix the unit tests under OSX you may try to run them individually

build/tests/util/ConfigUTest
build/tests/util/lru_cacheUTest
build/tests/util/iostreamContainerUTest

see what are the errors.

If you wish to use GNU/Linux, I suppose you may install it under a virtual machine, or dual boot. I think Ubuntu 16.04 is the distribution of choice because it is fully supported by ocpkg https://github.com/opencog/ocpkg . Personally prefer Debian Jessie because gdb is older and less buggy, it's really up to you.

After merging #174 and others, all tests pass for me on Mac. I suggest closing this.