GNU gcc mysys make command no rule to make target libpng - c++

I've searched around for the problem I encounter when I try to compile libpng, but I can't find a solution.
When I run:
C:\Users\Alex\Desktop\libpng-1.6.21\scripts>make makefile.gcc libpng.a
I receive the following messages:
make: Nothing to be done for `makefile.gcc'.
make: *** No rule to make target `libpng.a'. Stop.
I haven't modified the original makefile.gcc.

I think it's because you didn't call ./configure script.
Accoording to this wiki you need to run in msys shell:
wget http://sourceforge.net/projects/libpng/files/libpng15/older-releases/1.5.16/libpng-1.5.16.tar.xz/download
tar xvfJ libpng-1.5.16.tar.xz
cd libpng-1.5.16
mv INSTALL INSTALL.txt
./configure
make install

Related

Linking error: "relocation R_X86_64_32 ... can not be used when making a shared object; recompile with -fPIC"

I am attempting to compile Tox (specifically toxcore). When I attempt to compile it, I encounter the following error:
>make
make all-recursive
make[1]: Entering directory '/root/Tox/toxcore'
Making all in build
make[2]: Entering directory '/root/Tox/toxcore/build'
CCLD libtoxav.la
/usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libvpx.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1385: recipe for target 'libtoxav.la' failed
make[2]: *** [libtoxav.la] Error 1
make[2]: Leaving directory '/root/Tox/toxcore/build'
Makefile:506: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/Tox/toxcore'
Makefile:410: recipe for target 'all' failed
make: *** [all] Error 2
Following the error message, I have attempted to use fPIC by exporting C++ flags (export CXXFLAGS="$CXXFLAGS -fPIC"), by adding an argument to configure (./configure --enable-shared) and by editing the Makefile (changing CC = gcc to CC = gcc -fPIC), but these attempts have not worked and I still encounter the same error. What might be going wrong?
Here's the approach I have right now (on Ubuntu):
sudo apt-get install pkg-config
sudo apt-get install build-essential
sudo apt-get install libtool
sudo apt-get install autotools-dev
sudo apt-get install automake
sudo apt-get install checkinstall
sudo apt-get install check
sudo apt-get install git
sudo apt-get install yasm
cd ~
mkdir Tox
cd Tox
git clone https://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/1.0.3
./autogen.sh
./configure && make check
sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.0 --nodoc
sudo ldconfig
cd ..
git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
git checkout tags/v1.3.0
./configure
make
make install
cd ..
git clone https://github.com/irungentoo/toxcore.git
cd toxcore
autoreconf -i
./configure
make
sudo make install
cd ..
There must be a bug in the configuration script, it shouldn't come up with libvpx.a.
But worry not, since Ubuntu provides packages for both libvpx-dev and libsodium-dev, and using those seems to work just fine, so you should probably just do that unless there's some strong reason not to.
Also, unless you need classic toxcore, it seems c-toxcore is the successor, so you probably should use it instead.
Configuring with --enable-pic will add in the necessary -fPIC options, and works for me.

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

Building a Debian package tries to install to real /opt

This is again one these nice Debian packaging problems.
I have an app that installs to /opt (the install location is actually irrelevant, the same problem occurs with /usr):
OPT=1 ./configure && make && make install
I took a working Debian packaging from my other app, that used CMake, but the configuring, build and installation were similar. I modified the rules file a bit to build my new app:
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
OPT=1 ./configure && $(MAKE) -j$(shell cat /proc/cpuinfo | grep processor | wc -l)
touch build-stamp
I left the installation part untouched:
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# Add here commands to install the package into debian/<packagename>
DESTDIR=`pwd`/debian/`dh_listpackages` $(MAKE) install
Now, the problem is that when I try to build the package, it tries to install
to the real /opt and crashes:
mkdir: cannot create directory ‘/opt/snm’: Permission denied
make[1]: *** [install_target] Error 1
make: *** [install] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
debuild: fatal error at line 1361:
dpkg-buildpackage -rfakeroot -D -us -uc -i -b failed
I just can't figure out why my packaging doesn't work with my new app. Or alternatively, why it DID work with the other app :)
It seems that my install step was just ignoring the DESTDIR given by the Debian rules file.

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/

Cannot open libmpc.so.3 while making gcc4.8.1

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.