b2 icon indicating copy to clipboard operation
b2 copied to clipboard

error during installation "make -j check"

Open Icxa opened this issue 8 years ago • 28 comments

I was trying to install bertini2 but when I run the command "make -j check" then all the tests fail. The common error is undefined reference to boost:: I am working on ubuntu 16.04 with gcc version 4.9.4 and boost version 1.62.0.1 (used llibboost-all-dev for installing boost) Please help. I have attached the whole error log in the file below. Issues-15.08.txt Thank you.

Icxa avatar Aug 15 '17 10:08 Icxa

i've received similar errors when the autotools/m4 macros that find boost, instead of finding the newer apt installed one, find the one that came with the system. i'll poke around, see if i can generate the errors with the same installs, and get back to you.

thanks for the report!

ofloveandhate avatar Aug 15 '17 15:08 ofloveandhate

the boost version that goes with 16.04 is 1.58, as shown here. are you sure you have 16.04? 17.04 gets 1.62.

ofloveandhate avatar Aug 15 '17 15:08 ofloveandhate

on a fresh install of ubuntu 17.04, with apt-installed libboost1.62-all-dev, and gcc-4.9, i got what i expected -- a single test failed, and i know which test it was and why (a fix is incoming).

I think you have multiple versions of boost installed, and it's confusing the macros. I think this is not my responsibility, strictly speaking, but rather the macros are perhaps faulty. in either case, this has bitten me enough times that I need to resolve it, and get the macros to find the correct version.

consider posting your config.log file from b2/core to help me understand where it thinks boost-libdir is.

there are a few immediate solutions:

  • manually specify the version of boost while configureing, --with-boost=/path/to/boost and --with-boost-libdir=/path/to/boost/libs. for me, it appears to be /usr/lib/x86_64-linux-gnu
  • remove all but one version of boost, and leave it installed at /usr/ or whereever. since you are using apt, removing the default system-provided and out-of-date one at some mystery location is likely to break things, so i don't recommend this.

again, i will see if I can adjust the way the macros are finding the boost-libdir, and push to master asap.

ofloveandhate avatar Aug 15 '17 16:08 ofloveandhate

the more i think about your problem, the more i am becoming convinced that there are multiple versions of boost installed on your machine. the search for headers picked up one version, but the linker is linking to another version, causing them to fight.

adjusting the options to ./configure will probably be the fastest solution. here's one that worked for me:

./configure --with-boost=/usr/include --with-boost-libdir=/usr/lib/x86_64-linux-gnu

perchance, do you know CMake? I'd love to change to CMake for the build system...

ofloveandhate avatar Aug 15 '17 17:08 ofloveandhate

Thank you very much.

Yes it is 17.04, I am sorry for that.

I used command "./configure --with-boost=/usr/include --with-boost-libdir=/usr/lib/x86_64-linux-gnu" but still I get the same error.

Unfortunately I do not Know CMake.

I am attaching the log file.

config.log.txt

Icxa avatar Aug 16 '17 10:08 Icxa

i see the include path -I/usr/include/includein your attached config.log shows up when it's finding boost. Can you check if you have boost libraries at the location/usr/include/lib? that's my best guess. if that's the case, then ./configure --with-boost=/usr/include --with-boost-libdir=/usr/include/lib/ might get you there.

i think you should poke around in your library installations, at /usr/ and /usr/local, and see what's in there. it looks like there's some weird stuff going on. the path /usr/include/include/ is strange... and to my eyes, undesirable.

i empathize that managing library installations is a pain. i hope to learn Docker or a similar tool, so I can simply distribute b2 that way. would eliminate this whole mess.

ofloveandhate avatar Aug 16 '17 15:08 ofloveandhate

Thank you. I tried with /configure --with-boost=/usr/include --with-boost-libdir=/usr/include/lib/ but then I get an error cannot find Boost.System library. When I searched manually for Boost. System library then it shows the location in /usr/lib/x86_64-linux-gnu. I am thinking of reformatting the whole system if that would help!!

Icxa avatar Aug 17 '17 11:08 Icxa

you certainly could nuke it from orbit, but i don't think that in this instance, that's the only way to be safe. instead, let's work to educate you more fully about library installations.

libraries consist of two pieces, generally speaking:

  1. header
  2. compiled library

the headers describe the functions compiled into the library. they say 'there is such and such a function'. e.g. 'there is a function which eats a string and an int and returns a double, and it is named foo. that is, double foo(string, int); lives in bar.hpp. when you compile against this library, and you want to use foo, you must #include <bar.hpp>, the header which describes foo. this will let you compile. but, when you link (or rather, the build system links), the library must actually contain the compiled code for double foo(string, int). otherwise you get a linker error.1

this is what is happening in your scenario, the issue you first filed. the linker is failing to find some functions it needs. from my experience, this indicates that the headers and libraries for boost are not of the same version. hence, what we (you) need to do is ensure that they match.

we can do this!

first, we (you) will check the version numbers of the boost libraries installed at /usr/lib/x86_linux_gnu. if you ls this folder, you should see version numbers as parts of the filenames of the boost libraries in there. if not, then they are symlinks and you should follow them.

second, you should check the version of boost in the headers. find the file /usr/include/boost/version.hpp, or whereever you find boost headers. based on the fact that your libs live in a subfolder of /usr/lib, i expect the headers in /usr/include/boost. but, we noticed earlier that you have some headers in /usr/include/include/, so also check there.

at the top of this file, version.hpp, are some macros describing the boost version number. on the mac i am typing on right now, i have 1.64 installed, and version.hpp contains this macro: #define BOOST_VERSION 106400. it must match the version numbers for the compiled libraries.

do they?


1 things can get more complicated, but generally speaking, this is how it works. there are templates and inline functions, etc, which do not bear description here

ofloveandhate avatar Aug 17 '17 15:08 ofloveandhate

another thing to try -- based on [this so post], consider removing include from the path you are passing to --with-boost=. that is, try

./configure --with-boost=/usr? ultimately, we just need header and library versions to match! my immediately previous comment will help you achieve that goal.

ofloveandhate avatar Aug 17 '17 15:08 ofloveandhate

Thank you.

The version numbers of the boost libraries installed at /usr/lib/x86_linux_gnu is 1.62. The version.hpp contains #define BOOST_VERSION 106200.

"./configure --with-boost=/usr" this command works as well but then again when I run the command "make -j check" then I get an error of undefined reference

Icxa avatar Aug 18 '17 10:08 Icxa

matching is good. where is that copy of version.hpp? are there multiple version.hpp files floating around? (in multiple boost folders?) can you find one with a different version number? are there boost libraries in the folder /usr/lib/? do their version match? we need to get down to a single copy of the libraries in the path for the compiler and the linker.

also, consider make clean and then remake to ensure that the current configure state is reflected in the built product. maybe even though you are reconfiguring, old object files still contain clashing versions of the libraries?

lastly, i consider that there is a flaw in my build system. but, since it built first time for me in ubuntu 17.04 with all apt-installed libraries and tools, i don't think that's the case.

ofloveandhate avatar Aug 18 '17 14:08 ofloveandhate

I have attached the version.hpp file. No there are not multiple version.hpp files. Also there is only one boost folder. boost libraries are installed at /usr/lib/x86_linux_gnu and version is 1.62 (naming starts as 'libboost_' )

I did make clean and then again ran make -j and make -j check but still it does not works. [File - ErrorAsOnCommandLine] This time in the error there is no undefined reference. But now If I re-run make -j check command then same error as before appears. [ErrorOnSecondRun]

ErrorAsOnCommandLine.txt ErrorOnSecondRun.txt version.hpp.txt

Icxa avatar Aug 21 '17 09:08 Icxa

will you confirm that you have shared libraries at /usr/lib/x86_linux_gnu, please? do you have libboost* libraries with suffixes both .so and .a? this will help me understand whether it is a problem with my use of #define BOOST_LOG_DYN_LINK 1 and other related macros.

also, what do you get as output if you run, from b2/core, ldd .libs/bertini2? it should tell you the libraries the program is linked to. are the boost libs linked at /usr/lib/x86_linux_gnu? this will help us understand whether the correct libraries are being linked.

ofloveandhate avatar Aug 21 '17 22:08 ofloveandhate

also, thanks for sticking with this. i really appreciate it.

ofloveandhate avatar Aug 21 '17 22:08 ofloveandhate

i think your problem in ErrorAsOnCommandLine might be out-of-memory. restrict the number of threads you are using, by make -j 4. or even 2. gcc is a memory hog for templated code. i've seen it use 2gb or more per thread when compiling certain parts of bertini2.

ofloveandhate avatar Aug 21 '17 22:08 ofloveandhate

Actually I am grateful to you for helping me. Thank you very much. :)

Yes I have shared libraries at /usr/lib/x86_linux_gnu. Please find the file Libboost attached. Libboost.txt

When I run ldd .libs/bertini2 from b2/core then I get an error ldd: .libs/bertini2: No such file or directory

Icxa avatar Aug 22 '17 06:08 Icxa

you're right about the error using ldd... the program bertini2 isn't built by the current version of master. what if you ldd .libs/libbertini2.0.so?

look for a major update to master branch soon, which will bring many performance enhancements, and features. and hopefully fix this issue for you. sorry we're not there yet!!!

ofloveandhate avatar Aug 22 '17 16:08 ofloveandhate

If I run ldd: .libs/libbertini2.0.so then I get an error "No such file or directory"

Sure. I will wait. Thank you very much.

Icxa avatar Aug 22 '17 19:08 Icxa

pull and retry make check? remember, keep -j # low, to avoid OOM problems

ofloveandhate avatar Aug 30 '17 02:08 ofloveandhate

Thank you. I tried. This time when I ran 'make -j 2' then I got errors. I have attached the file error containing the errors as shown on terminal.

Error.txt

Icxa avatar Aug 30 '17 11:08 Icxa

fascinating. check out this issue for another piece of software. they are talking about which version of the compiler was used for libraries, etc. i tried to see what version of gcc was used for the apt-installed boost in my ubuntu17.04, but the .comment section is empty, so failed.

here is another issue having similar issues: pagmo

there is still a conflict between the versions of boost and other things. and i still cannot replicate the errors you are getting. i wish i knew all the things you did when getting your system into its current state. did you ever compile boost yourself? the /usr/include/include path from before is highly suspicious...

at this point, i recommend either

  1. wiping ubuntu and starting over, or
  2. trying building in a virtual machine.

wiping is a bit severe, and may cause loss of data (unless you partitioned your hard disk so you can wipe your OS but keep your home directory... something i suggest for all non-toy linux installations). Virtualbox is easy to use. install a virtual ubuntu 17.04 in it, and see if you get the same problems when you build. then, try to remember what you did differently on the OS you are running on. a wipe may still be the easiest thing.

summary - your install / boost is still not working correctly, and i don't know why. sorry.

ofloveandhate avatar Aug 30 '17 16:08 ofloveandhate

Thank you. I will try that.

Icxa avatar Sep 01 '17 11:09 Icxa

i am curious if you were able to get going?

ofloveandhate avatar Sep 13 '17 23:09 ofloveandhate

Sorry for late reply. Unfortunately I face the same problem (undefined reference to boost) even while running on Ubuntu 17.04 through virtualbox!!

Icxa avatar Sep 18 '17 13:09 Icxa

thanks for getting back to me, i really appreciate it. perchance, did you document the steps you took to install the packages from apt? if i can replicate your problem, i can fix it. i'd love to know how to make this happen on my own virtual install of 17.04.

ofloveandhate avatar Sep 20 '17 14:09 ofloveandhate

Thank you for still helping me out.

I installed ubuntu on virtualbox again and re-did everything. Here is the sequence of commands executed:-

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.9 g++-4.9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

sudo apt-get install automake sudo apt-get install autoconf sudo apt-get install libtool sudo apt-get install libeigen3-dev sudo apt-get install libboost-all-dev sudo apt-get install libboost-python-dev

mkdir Software cd Software sudo apt install git git clone https://github.com/bertiniteam/b2 --recursive cd b2/core

libtoolize autoreconf -fi sudo apt-get install libgmp3-dev (error: unable to find gmp while running ./configure so did this installation) sudo apt-get install libmpfr-dev (error: unable to find mpfr while running ./configure so did this installation) ./configure

make -j 2 I get ' g++: internal compiler error: Killed (program cc1plus)' I have attached a screen shot of what appears on command line in File1.txt File1.txt

I did make clean and then make -j 2 but still the same error. I restarted ubuntu. Then in b2/core, I ran libtoolize autoreconf -fi
./configure make -j 2

Now I get the error undefined reference to boost. I have attached a screen shot of what appears on command line in File2.txt File2.txt

Icxa avatar Sep 22 '17 13:09 Icxa

thanks. i will attempt to replicate your error

ofloveandhate avatar Sep 22 '17 18:09 ofloveandhate

Thank you very much. :)

Icxa avatar Sep 26 '17 10:09 Icxa