opencog / opencog

A framework for integrated Artificial Intelligence & Artificial General Intelligence (AGI)

Home Page:http://wiki.opencog.org/w/Development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Opencog repo: Cannot find lBoost::filesystem, lBoost::system

tobimichigan opened this issue · comments

Screenshot from 2020-07-25 01-40-59

Hi there please can any1 please proffer solution to lboost file/system not found?

I cloned this repo and tried building but the the "make" aspect truncates at lboost issue.
I have tried "sudo apt install libboost-all-dev" but the Ubuntu Linux says its already in its newest version.
Additionally,I successfully built atomspace, cogutil, opencog through ocpkg.

cd to project root dir [done]
mkdir build[done]
cd build[done]
cmake ..[issue of lboost truncates at 44%]

However, when I try to build this repo separately as a stand alone, it halts at the "make" section.
Any sharp pointers will be appreciated.

I'm fairly sure that this is because /usr/local/lib/opencog/libPythonEval.so was not correctly linked. I'm guessing that maybe you have an old/out-of-date copy of that library lying around -- try removing it. May need to rebuild the atomspace after that ..

To explain more fully -- the only users of boost-fliesyste, etc. is the atomspace python module. Nothing else uses boost. So .. somehow it was linked incorrectly.

It's possible that RPATH is not being set correctly ... you are not the first to complain about this ... any comments @Habush ? @noskill or @vsbogd

@linas This is beacuse the opencog CMakeLists.txt doesn't include the FIND_PACKAGE(Boost 1.46 REQUIRED COMPONENTS system filesystem) which is needed to import the Boost targets defined in FindBoost.cmake. cmake already gives the warning and tells you want to do. For example, while building agi-bio, I got the following warning from cmake:

 Target "bioscience" links to target "Boost::system" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

I'm sure @tobimichigan got a similar warning.

Adding FIND_PACKAGE(Boost 1.46 REQUIRED COMPONENTS system filesystem) fixes the issue. You don't have to link the boost libraries to your target as that is done by cmake due to the way it handles transitive dependencies by default. But you still need find_package call to get the IMPORTED TARGETS

Looks like cmake includes boost, when I look. So that is not the explanation: its right here: https://github.com/opencog/atomspace/blob/d9701f016a3ac602b1493caced91a431fe361ce6/CMakeLists.txt#L102-L103

I notice the error message says -lBoost::filtesystem instead of -lboost_filesystem which is what it should have said. According to /usr/share/cmake-3.13/Modules/FindBoost.cmake this happens when someone says IMPORTED but I cannot find anything that says IMPORTED anywhere....

I think either the atomspace has to export the imported Boost targets or the opencog repo should import the Boost targets using find_package

? Nothing in the opencog repo uses boost, as far as I can tell. ?? So this is not an opencog repo problem, this is a python bug of some kind...

@Habush yes, but that is irrelevant .. nothing whatsoever in opencog uses boost. So there is zero need to look for boost in a component that does not use boost. Boost is not any different than any other shared library. It's not "special" or "exceptional". It's just a plain-old ordinary shared library, just like any other plain-old ordinary shared library -- the linker-loader aka "glibc" aka "ldd" should know how to find it. We should not have to do anything more, or anything special, to give extra instructions or hints or commands to look for it and to find it. Locating it should be 100% automatic.

Placing an explicit work-around by altering the opencog repo is hack, a band-aid that hides/obscures some other, deeper bug. It is well-known from programming practice that patching around and hiding deep bugs only leads to even more trouble later on, when the bug finally does explode in it's full glory. It would be better to fix it now, than to pretend that it is somehow not there. The CMake hack is a hack. It's completely the wrong hack.

To be clear: the circle-ci tests don't have this problem. I don't have this problem. Most of the other developers don't have this problem. You DO have this problem, and so does @tobimichigan So what are you doing that is different from the rest of us? Well, you're using an Apple; no one else uses an Apple. This suggests that the bug has something to do with how Apple treats shared libraries, and, since you've had to dink with RPATH to make the shared libraries work, this suggests that maybe the RPATH settings still are not quite right, for Apple.

I have no clue how @tobimichigan 's system differs from everyone else's. I'm guessing that maybe he has older versions of the atomspace installed in his file-system, and that those older versions are incompatible with the current setup. When this has come up in the past, removing the older versions always solved the problem.

Anyway ... if you read the bug report carefully, you will see that @tobimichigan did install boost, and he still has a bug. So checking for boost in the cmakefile won't fix anything; he's already got boost installed.

@linas
@Habush
@ceefour

For the record, I need you guys to look at the following algorithm that cloned "opencog repo", and formally installed "lboost" respectively on my local linux system:
Cloning OpenCog:
(base) bash_sscript:~/Github/OpenCog$ git clone https://github.com/opencog/cogutil.git Cloning into 'cogutil'... remote: Enumerating objects: 126, done. remote: Counting objects: 100% (126/126), done. remote: Compressing objects: 100% (84/84), done. remote: Total 141925 (delta 67), reused 90 (delta 41), pack-reused 141799 Receiving objects: 100% (141925/141925), 58.07 MiB | 542.00 KiB/s, done. Resolving deltas: 100% (111403/111403), done.

lboost
(base) bash_sscript$ sudo apt-get install libboost-all-dev [sudo] pd: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: icu-devtools libboost-atomic-dev libboost-atomic1.71-dev libboost-atomic1.71.0 libboost-chrono-dev libboost-chrono1.71-dev libboost-chrono1.71.0 libboost-container-dev libboost-container1.71-dev libboost-container1.71.0 libboost-context-dev libboost-context1.71-dev libboost-context1.71.0 libboost-coroutine-dev libboost-coroutine1.71-dev libboost-coroutine1.71.0 libboost-date-time-dev libboost-date-time1.71-dev libboost-dev libboost-exception-dev libboost-exception1.71-dev libboost-fiber-dev libboost-fiber1.71-dev libboost-fiber1.71.0 libboost-filesystem-dev libboost-filesystem1.71-dev libboost-graph-dev libboost-graph-parallel-dev libboost-graph-parallel1.71-dev libboost-graph-parallel1.71.0 libboost-graph1.71-dev libboost-graph1.71.0 libboost-iostreams-dev libboost-iostreams1.71-dev libboost-locale-dev libboost-locale1.71-dev libboost-log-dev libboost-log1.71-dev libboost-log1.71.0 libboost-math-dev libboost-math1.71-dev libboost-math1.71.0 libboost-mpi-dev libboost-mpi-python-dev libboost-mpi-python1.71-dev libboost-mpi-python1.71.0 libboost-mpi1.71-dev libboost-mpi1.71.0 libboost-numpy-dev libboost-numpy1.71-dev libboost-numpy1.71.0 libboost-program-options-dev libboost-program-options1.71-dev libboost-program-options1.71.0 libboost-python-dev libboost-python1.71-dev libboost-python1.71.0 libboost-random-dev libboost-random1.71-dev libboost-random1.71.0 libboost-regex-dev libboost-regex1.71-dev libboost-regex1.71.0 libboost-serialization-dev libboost-serialization1.71-dev libboost-serialization1.71.0 libboost-stacktrace-dev libboost-stacktrace1.71-dev libboost-stacktrace1.71.0 libboost-system-dev libboost-system1.71-dev libboost-system1.71.0 libboost-test-dev libboost-test1.71-dev libboost-test1.71.0 libboost-thread-dev libboost-thread1.71-dev libboost-timer-dev libboost-timer1.71-dev libboost-timer1.71.0 libboost-tools-dev libboost-type-erasure-dev libboost-type-erasure1.71-dev libboost-type-erasure1.71.0 libboost-wave-dev libboost-wave1.71-dev libboost-wave1.71.0 libboost1.71-dev libboost1.71-tools-dev libicu-dev mpi-default-bin mpi-default-dev Suggested packages: libboost-doc graphviz libboost1.71-doc gccxml libboost-contract1.71-dev libmpfrc++-dev libntl-dev xsltproc doxygen docbook-xsl default-jdk fop icu-doc The following NEW packages will be installed: icu-devtools libboost-all-dev libboost-atomic-dev libboost-atomic1.71-dev libboost-atomic1.71.0 libboost-chrono-dev libboost-chrono1.71-dev libboost-chrono1.71.0 libboost-container-dev libboost-container1.71-dev libboost-container1.71.0 libboost-context-dev libboost-context1.71-dev libboost-context1.71.0 libboost-coroutine-dev libboost-coroutine1.71-dev libboost-coroutine1.71.0 libboost-date-time-dev libboost-date-time1.71-dev libboost-dev libboost-exception-dev libboost-exception1.71-dev libboost-fiber-dev libboost-fiber1.71-dev libboost-fiber1.71.0 libboost-filesystem-dev libboost-filesystem1.71-dev libboost-graph-dev libboost-graph-parallel-dev libboost-graph-parallel1.71-dev libboost-graph-parallel1.71.0 libboost-graph1.71-dev libboost-graph1.71.0 libboost-iostreams-dev libboost-iostreams1.71-dev libboost-locale-dev libboost-locale1.71-dev libboost-log-dev libboost-log1.71-dev libboost-log1.71.0 libboost-math-dev libboost-math1.71-dev libboost-math1.71.0 libboost-mpi-dev libboost-mpi-python-dev libboost-mpi-python1.71-dev libboost-mpi-python1.71.0 libboost-mpi1.71-dev libboost-mpi1.71.0 libboost-numpy-dev libboost-numpy1.71-dev libboost-numpy1.71.0 libboost-program-options-dev libboost-program-options1.71-dev libboost-program-options1.71.0 libboost-python-dev libboost-python1.71-dev libboost-python1.71.0 libboost-random-dev libboost-random1.71-dev libboost-random1.71.0 libboost-regex-dev libboost-regex1.71-dev libboost-regex1.71.0 libboost-serialization-dev libboost-serialization1.71-dev libboost-serialization1.71.0 libboost-stacktrace-dev libboost-stacktrace1.71-dev libboost-stacktrace1.71.0 libboost-system-dev libboost-system1.71-dev libboost-system1.71.0 libboost-test-dev libboost-test1.71-dev libboost-test1.71.0 libboost-thread-dev libboost-thread1.71-dev libboost-timer-dev libboost-timer1.71-dev libboost-timer1.71.0 libboost-tools-dev libboost-type-erasure-dev libboost-type-erasure1.71-dev libboost-type-erasure1.71.0 libboost-wave-dev libboost-wave1.71-dev libboost-wave1.71.0 libboost1.71-dev libboost1.71-tools-dev libicu-dev mpi-default-bin mpi-default-dev 0 upgraded, 93 newly installed, 0 to remove and 104 not upgraded. Need to get 37.1 MB of archives.

while using octool to setup opencog repo, this occured:

".....-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.46") found components: filesystem program_options system thread "
If octool can locate Boost-1.71.0, as ably depicted above in order to set tup its accompanying depedences, why should opencog repo find it difficult to locate the same package when executing "make" command?
...

@linas , my question is, regardless of the atomspace version, and less the full components for locally building opencog via octool(ocpkg), is this repo short of something that may have been overlooked, waiting to "explode in its full glory?", whilst others are yet to encounter this issue?

Please try again with the latest atomspace, and the latest cogserver. So I think that the latest change to the atomspace, opencog/atomspace#2738 might fix this problem maybe .. and maybe not. An additional set of changes to python linking in the cogserver repo also fixed some faulty file paths. Between these two, it might fix your problem.

octool

This looks reasonable.

lboost

Its actually called libboost-whatever.so but by very old convention, the linker arguments would be -l boost-whatever.so and the space is optional, and the suffix is optional, so one can validly write -lboost-whatever Some 35+ years ago, when Richard Stallman was creating/bootstrapping the compiler and linker-loader out of thin air, he named one of the earliest support libraries libiberty, which on the command line was -liberty, thus formally declaring independence from commercial compiler tools.

opencog via octool

The opencog repo is built regularly, by many people. I believe that octool is widely used as well, and usually, everything works as expected. Which is not to say they are bug-free -- I'm sure they have bugs (don't know what they are) ... but your bug is unusual, and I can't think of any good way determining the cause. The -lBoost::system is very strange... that is never a valid library name. That means that cmake is tangled up about something, but its hard to say.

After git-pulling and rebuilding atomspace and the cogserver, go to the opencog directory, try doing rm -r build; mkdir build; cd build; cmake .. and stop there, and look at CMakeCache.txt -- there should not be any mention of Boost or boost anywhere... i.e. grep -r Boos * should return nothing

roger that @linas . I will look for an alternate system to carry out the ne test and report back. Cos octool has already configured opencog, cogutil, atomspace and guile on the current system.
But, once again, which is better between cloning opencog and octool which the wiki recommends?

as a developer, its easier for me to work directly with git. as a first-time user, it is easier for you to use octool, since it avoids having to run many, many steps by hand.

opencog/atomspace#2738 fixed the linking issue on my side.

I had this problem on Manjaro, opencog/atomspace#2738 fixed it (well done @linas, I have no idea how you came up with the solution, respect).

closing I think this is fixed