Cannot open libmpc.so.3 while making gcc4.8.1 - c++

I want to install gcc4.8.1 on ubuntu 10.04.
Here are my installing steps:
Install libgmp, libmpfr and libmpc.
After switch to gcc4.8.1 source code dir, run "./configure --prefix=/usr/bin/gcc4.8.1 --with-gmp=/opt/pkg/gmp5.1.2 --with-mpfr=/opt/pkg/mpfr3.1.2 --with-mpc=/opt/pkg/mpc1.0.1"
make
export LD_LIBRARY_PATH=/opt/pkg/gmp5.1.2/lib:/opt/pkg/mpfr3.1.2/lib:/opt/pkg/mpc1.0.1/lib
sudo make install.
In the last step I get this error:
/usr/local/sbin/gcc-4.8.1/host-i686-pc-linux-gnu/gcc/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
make[5]: *** [install-exec-hook] Error 1
make[5]: Leaving directory `/usr/local/sbin/gcc-4.8.1/i686-pc-linux-gnu/libjava'
make[4]: *** [install-exec-am] Error 2
make[4]: Leaving directory `/usr/local/sbin/gcc-4.8.1/i686-pc-linux-gnu/libjava'
make[3]: *** [install-am] Error 2
make[3]: Leaving directory `/usr/local/sbin/gcc-4.8.1/i686-pc-linux-gnu/libjava'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/usr/local/sbin/gcc-4.8.1/i686-pc-linux-gnu/libjava'
make[1]: *** [install-target-libjava] Error 2
make[1]: Leaving directory `/usr/local/sbin/gcc-4.8.1'
make: *** [install] Error 2
I have switched to the libmpc library path and tested libmpc.so.3 with ldd. It has been installed successfully. Why does it say it cannot open shared object libmpc.so.3? How can I fix it?

According to your suggest, I have installed gcc4.8.1 successfully. Here are my steps:
Remove gmp, mpfr and mpc from /opt/pkg.
Install gmp, mpfr and mpc with the default configure. These packages will be installed in /usr/local/lib.
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH.
Enter the gcc source dir, run "./configure".
make.
Add symbol links:
sudo ln -s /usr/local/lib/libgmp.so.10 /usr/lib/libgmp.so.10
sudo ln -s /usr/local/lib/libmpfr.so.4 /usr/lib/libmpfr.so.4
sudo ln -s /usr/local/lib/libmpc.so.3 /usr/lib/libmpc.so.3
sudo make install.
Than you KiaMorot. Thank you trojanfoe.

I don't believe any of the answers here address the issue. Your problem is the last two steps
export LD_LIBRARY_PATH=/opt/pkg/gmp5.1.2/lib:/opt/pkg/mpfr3.1.2/lib:/opt/pkg/mpc1.0.1/lib
sudo make install
exporting your LD_LIBRARY_PATH is correct, but then you reset all environment variables when you change to root user with sudo in the last step.
One way to get around this:
sudo -s # become root user
export LD_LIBRARY_PATH=/opt/pkg/gmp5.1.2/lib:/opt/pkg/mpfr3.1.2/lib:/opt/pkg/mpc1.0.1/lib
make install # don't use sudo here

If anybody stumbles upon this using their own manually-built version of libgmp, libmpfr and libmpc instead of the system-provided ones:
export LD_LIBRARY_PATH=/opt/your-prefix-directory
is necessary for make itself, i.e. even when gcc ./configure was run with
--with-gmp=/opt/your-prefix-directory --with-mpc=/opt/your-prefix-directory --with-mpfr=/opt/your-prefix-directory
you need to specify where the linker should go looking for libgmp and friends.

You have to check if the libmpc.so.3 is a successfully created symbolic link to libmpc.so.3.0.0. This error may arise because you have installed this library manually and the sym. link may be missing. You could try this:
sudo ln -s /opt/pkg/mpc1.0.1/lib/libmpc.so.3.0.0 /opt/pkg/mpc1.0.1/lib/libmpc.so.3
Syntax of ln is ln -s <real path to file> <symbolic link name>. For more check out the man page of ln.

Related

How to install memcached from binaries and include in c file

I am trying to install memcached on ubuntu 16.04. I need to install it manually as I want to modify the files. I also don't want to install it locally as my changes might not be what other people want from their memcached.
I have tried following the instructions from the github https://github.com/memcached/memcached/wiki/Install (changing the prefix and libevent path to be in my home directory).
Libevent installation:
./configure --prefix=/path/to/home/local_include
make
make install
This seemed to work as the memcached config did not complain.
memcached installation:
wget https://memcached.org/latest
tar -zxf memcached-1.5.13.tar.gz
./configure --prefix=/path/to/home/local_include --with-libevent=/path/to/home/local_include
make
make test
make install
Doing this I saw no errors. This is the result when I finished make install:
make install-recursive
make[1]: Entering directory `/path/to/home/memcached-1.5.13'
Making install in doc
make[2]: Entering directory `/path/to/home/memcached-1.5.13/doc'
make install-am
make[3]: Entering directory `/path/to/home/memcached-1.5.13/doc'
make[4]: Entering directory `/path/to/home/memcached-1.5.13/doc'
make[4]: Nothing to be done for `install-exec-am'.
/usr/bin/mkdir -p '/path/to/home/local_includes/share/man/man1'
/usr/bin/install -c -m 644 memcached.1 '/path/to/home/local_includes/share/man/man1'
make[4]: Leaving directory `/path/to/home/memcached-1.5.13/doc'
make[3]: Leaving directory `/path/to/home/memcached-1.5.13/doc'
make[2]: Leaving directory `/path/to/home/memcached-1.5.13/doc'
make[2]: Entering directory `/path/to/home/memcached-1.5.13'
make[3]: Entering directory `/path/to/home/memcached-1.5.13'
/usr/bin/mkdir -p '/path/to/home/local_includes/bin'
/usr/bin/install -c memcached '/path/to/home/local_includes/bin'
/usr/bin/mkdir -p '/path/to/home/local_includes/include/memcached'
/usr/bin/install -c -m 644 protocol_binary.h '/path/to/home/local_includes/include/memcached'
make[3]: Leaving directory `/path/to/home/memcached-1.5.13'
make[2]: Leaving directory `/path/to/home/memcached-1.5.13'
make[1]: Leaving directory `/path/to/home/memcached-1.5.13'
when I run ps ax | grep memcached however no trace of the program being installed is apparent.
I also tried reinstalling and change the make install instruction to:
make install --prefix=PREFIX
and
make install --prefix=/path/to/home/local_lib
though neither of them were registered as acceptable arguments (though the INSTALL instructions seemed to indicate they would be).
If anyone has any ideas I would appreciate them. Thanks.
You built the binary but have not started it.
Try starting it via:
sudo service memcached restart
If that doesn't work, then run this:
sudo /etc/init.d/memcached restart

gcc 4.7 on Fedora 23 with gcc 5.3.1

I need to install gcc 4.7.x on my fedora 23 in order to make Matlab compile the code. I also came across an error when I was trying to use Cuda which required gcc 4.9.x or lower.
I tried to compile gcc-4.7.4 from scratch but I get the following errors:
Makefile:4107: recipe for target 'all-stage1-gcc' failed
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/x/src/objdir'
Makefile:19334: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/home/x/src/objdir'
Makefile:903: recipe for target 'all' failed
make: *** [all] Error 2
I made a separate directory for configuration and building and I ran the configure as:
../gcc-4.7.4/configure --enable-languages=c,c++ --disable-multilib --prefix=$HOME/gcc-4.7.4
However I think the problem rises from the fact that I am using gcc-5.3.1 to compile gcc-4.7.4 but I have no idea how to fix it.
I noticed there is no packages available from dnf to install gcc-4.7.x either.
It looks like you put your build dir inside the source tree. Don't do that. Follow the wiki's instructions.
do not run ./configure from within the source directory, this is not supported. You need to run configure from outside the source directory, in a separate directory created for the build
It'll look something like this:
tar xzf gcc-4.7.4.tar.gz
cd gcc-4.7.4
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.7.4/configure --no-multilib --prefix=$HOME/gcc-4.7.4 --enable-languages=c,c++
make
make install
This question is a little dated now, but patching gcc/cp/cfns.gperf did the trick for me. See here: https://gist.github.com/joka90/bb8ef36aa755994d3b3d/. Built using gcc 5.3.1 under Fedora 23.
#Download and apply fix to be able to build gcc 4.7 with gcc 5.1
cd /path/to/build/gcc/source
wget https://patchwork.ozlabs.org/patch/504982/raw/ -O cfns-fix-mismatch-in-gnu_inline-attributes.patch
patch -p1 -i cfns-fix-mismatch-in-gnu_inline-attributes.patch

What is the best way to build the GNU Scientific Library for use on MinGW?

I'm trying to get GSL version 1.16 built using MinGW but I'm running into some problems. I followed these instructions which involve invoking these commands from within sh.exe.
tar zxvf <the name of your gsl source package>
cd gsl-<the version number of your gsl source package>
./configure --enable-static=yes --enable-shared=yes --prefix=/c/GSL-<version number of gsl source package>
make
make install
I obtained these messages before make gave up.
/usr/bin/sed: can't read <my last name>/gsl-1.16/cblas/libgslcblas.la: No such file or directory
libtool: link: `<my last name>/gsl-1.16/cblas/libgslcblas.la' is not a valid libtool archive
make[2]: *** [libgsl.la] Error 1
make[2]: Leaving directory `/usr/home/<my full name>/gsl-1.16'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/home/<my full name>/gsl-1.16'
make: *** [all] Error 2
Can anyone explain this? Could it be something to do with one of the file paths involving a space between my first last names? Alternatively, does anyone know of me another way to install the GSL which has definitely worked for them?

libtool error building thrift 0.9.1 on Ubuntu 13.04

Building thrift 0.9.1 (support C, C++, java, C#, perl, python) on Ubuntu 13.04 I am getting this error.
./configure run without any options, make run without any options...
Making all in test
make[2]: Entering directory `/home/dvb/sw/thrift-0.9.1/test'
Making all in nodejs
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/nodejs'
Making all in cpp
make[3]: Entering directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
Makefile:832: warning: overriding commands for target `gen-cpp/ThriftTest.cpp'
Makefile:829: warning: ignoring old commands for target `gen-cpp/ThriftTest.cpp'
/bin/bash ../../libtool --tag=CXX --mode=link g++ -Wall -g -O2 -L/usr/lib -o libtestgencpp.la ThriftTest_constants.lo ThriftTest_types.lo ../../lib/cpp/libthrift.la -lssl -lcrypto -lrt -lpthread
libtool: link: ar cru .libs/libtestgencpp.a .libs/ThriftTest_constants.o .libs/ThriftTest_types.o
ar: .libs/ThriftTest_constants.o: No such file or directory
make[3]: *** [libtestgencpp.la] Error 1
make[3]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/dvb/sw/thrift-0.9.1/test'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dvb/sw/thrift-0.9.1'
make: *** [all] Error 2
dvb#dvb-u13:~/sw/thrift-0.9.1$
While this seems to be a defect in the 0.9.1 release tarball, it is not a problem in the top of tree pulled via git as of this afternoon.
The solution if one encounters this problem is to use a newer version of thrift by getting the source tree directly via git instead of downloading the tarball. The only difference in build is you will need to run bootstrap.sh before configure. This is well documented.
Note two additional helpful bits of data:
1. Configure to build --without-tests (Mike Johnson below - thanks)
2. This issue is fixed in 0.9.2 release (Luke below- thanks!)
I ran into this problem tonight and "fixed" it. The problem is that ar(1) can't find the .o files in the directory test/cpp/.libs. I'm sure that there's some missing magic in the Makefile.am in test/cpp, but I've neither the patience or automake-fu to fix that.
Instead, I just symlinked the .o files from test/cpp to test/cpp/.libs/. That fixes the build of the C++ tests.
cd thrift-0.9.1/test/cpp/.libs
for i in ../*.o; do echo $i; ln -s $i .; done
Thrift was since released with this compile problem. You can choose to skip compiling tests, instead:
./configure --without-tests
You can also try this:
./configure
(cd test/cpp; ln -s . .libs)
make install
This will simply link .libs back to test/cpp. "ar" will find the files there.
David V is right that 0.9.1 is broken but 0.9.2 works. The build instructions seem to be a broken link as well. So here are the commands that worked for me, from a fresh Ubuntu install:
# Install java if you don't have it
sudo apt-get install default-jre
# install build dependencies
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
cd /tmp
curl http://archive.apache.org/dist/thrift/0.9.2/thrift-0.9.2.tar.gz | tar zx
cd thrift-0.9.2/
./configure
make
sudo make install
#test that it can run
thrift --help
(credit goes to these helpful instructions; I just replaced 0.9.1 with 0.9.2)
I happened to face this problem. You can try cp all test/cpp/*.o to .libs folder.
Or you can skip compiling tests.
cp test/cpp/*.o test/cpp/.libs/

gcc 4.5 installation problem under ubuntu

I tried to install gcc 4.5 on ubuntu 10.04 but failed.
Here is a compile error that I don't know how to solve. Is there anyone successfully install the latest gcc on ubuntu?
Following is my steps and the error message, I'd like to know where is the problem....
Step1: download these files:
gcc-core-4.5.0.tar.gz
gcc-g++-4.5.0.tar.gz
gmp-4.3.2.tar.bz2
mpc-0.8.1.tar.gz
mpfr-2.4.2.tar.gz
Step2: Unzip above files
Step3: move gmp, mpc, mpfr to the gcc-4.5.0/ directory.
mv gmp-4.3.2 gcc-4.5.0/gmp
mv mpc-0.8.1 gcc-4.5.0/mpc
mv mpfr-2.4.2 gcc-4.5.0/mpfr
Step4: go to gcc-4.5.0 directory and do configuration:
sudo ./configure
Step5: compile and install
sudo make
sudo make install
The first 4 steps is OK, I can configure it successfully. However, when I try to compile it, following error message comes out, I cannot figure out what the problem is. Should I change the name from "gcc 4.5" to "gcc"?? It's a little strange that we need to do this by ourself. Is there anything I missed during the installation?
xxx#xxx-laptop:/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0$ sudo make
[sudo] password for xxx:
[ -f stage_final ] || echo stage3 > stage_final
/bin/bash: line 2: test: /media/Data/Tool/linux/gcc: binary operator expected
/bin/bash: /media/Data/Tool/linux/gcc: No such file or directory
make[1]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[2]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[3]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
rm -f stage_current
make[3]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[2]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[2]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
Configuring stage 1 in host-x86_64-unknown-linux-gnu/intl
/bin/bash: /media/Data/Tool/linux/gcc: No such file or directory
make[2]: *** [configure-stage1-intl] Error 127
make[2]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make: *** [all] Error 2
It might not be a good idea to have a space in your path - it's kind of rare and can easily mess up shell scripts that aren't specially designed to deal with it (which is a bad combination!)
Another potential problem is that you're running configure inside the gcc source directory - this isn't recommended (and didn't work at all for me on at least one version of gcc 4). Instead make an empty build directory, parallel to the source directory, so you have something like:
gcc 4.5 <- but might want to avoid the space
gcc-4.5.0
...
build
Then cd into build and run
../gcc-4.5.0/configure
You may also need to start from a freshly unzipped source directory, as the previous failed build may have broken it.