4

When I'm trying to make CAMB file, I get this error:

usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
make: *** [camb] Error 1

Is a library missing?! How am I supposed to add libraries?!

CAMB is a Fortran code written for 2015 Planck data, camb.info

Also, with this command locate libstdc I get

/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
/usr/share/doc/libstdc++6
/usr/share/gcc-4.8/python/libstdcxx
/usr/share/gcc-4.8/python/libstdcxx/__init__.py
/usr/share/gcc-4.8/python/libstdcxx/v6
/usr/share/gcc-4.8/python/libstdcxx/v6/__init__.py
/usr/share/gcc-4.8/python/libstdcxx/v6/printers.py
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py
/var/cache/apt/archives/libstdc++6_4.8.4-2ubuntu1~14.04.1_amd64.deb
/var/lib/dpkg/info/libstdc++6:amd64.list
/var/lib/dpkg/info/libstdc++6:amd64.md5sums
/var/lib/dpkg/info/libstdc++6:amd64.postinst
/var/lib/dpkg/info/libstdc++6:amd64.postrm
/var/lib/dpkg/info/libstdc++6:amd64.prerm
/var/lib/dpkg/info/libstdc++6:amd64.shlibs
/var/lib/dpkg/info/libstdc++6:amd64.symbols

Does it meant the library is present?! How can I fix the library search path in the makefile?

Could someone help me sort this one out here? I appreciate your time and help

1
  • I have updated the post and figured out how to get rid of that from the makefile as it's not needed anyhow. Please post any more errors, thanks!
    – mchid
    Feb 23, 2016 at 2:48

1 Answer 1

0

UPDATE

I think I may have found a solution. Supposedly, -lstdc++ is not needed and so it can be removed from the makefile. Run the following commands to resolve this issue.

First, cd into the CAMB directory and then run the following commands:

sed -i 's/F90CRLINK ?= -lstdc++/#F90CRLINK ?= -lstdc++/g' Makefile_main
make clean
make CC=/usr/bin/gcc

The CAMB binary file should now exist if all goes well.

Please post any more errors, thanks!


ORIGINAL POST

I followed these steps and it compiled successfully on 15.10:

sudo apt-get install gfortran git
git clone https://github.com/cmbant/CAMB.git
cd CAMB
make CC=/usr/bin/gcc

The binary camb should be built in the current directory.

I also downloaded the source from the main site and got the same result.

Try installing these libs:

sudo apt-get install libstdc++-4.8-dev libstdc++6:amd64 libstdc++6:i386

It should be noted that the dev versions are the ones usually needed to build stuff.

Please post any more errors.


5
  • after making the file I got this error: Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions. make: *** [Releaselib/camb_python.o] Error 1
    – Sara .Eft
    Feb 22, 2016 at 10:13
  • also I couldn't install libraries: E: Unable to locate package libstdc++-4.9-dev E: Couldn't find any package by regex 'libstdc++-4.9-dev' E: Unable to locate package libstdc++-5-dev E: Couldn't find any package by regex 'libstdc++-5-dev'
    – Sara .Eft
    Feb 22, 2016 at 10:14
  • @Sara.Eft Yeah, I guess it looks like 4.9 and 5 aren't available on 14.04. I'm using 15.10 and also I forgot that I also have an alias set for make that runs gcc-5 which also isn't available on 14.04. For now, go ahead and see if you can get it to work with libstdc++-4.8-dev only and please post any errors, thanks.
    – mchid
    Feb 22, 2016 at 10:31
  • I ran the new commands, but it gave me the same error as before Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions. make: *** [Releaselib/camb_python.o] Error 1
    – Sara .Eft
    Feb 24, 2016 at 6:28
  • @Sara.Eft I'm going to try to get a virtual machine or something to try this out on 14.04.
    – mchid
    Feb 29, 2016 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .