Cross-compile python arm - python-2.7

I want to cross-compile python 2.7.3 for ARM.
I've followed this example:
https://gist.github.com/bmount/6929380
But during the last step with make install, I get an error:
running install
running install_lib
creating /_install
error: could not create '/_install': Permission denied
make: *** [sharedinstall] Erreur 1
This is how I have done my cross-compilation:
./configure
make python Parser/pgen
mv python hostpython
mv Parser/pgen Parser/hostpgen
make distclean
patch -p1 < ../Python-2.7.3-xcompile.patch
CC=arm-unknown-linux-gnueabihf-gcc CXX=arm-unknown-linux-gnueabihf-g++ AR=arm-unknown-linux-gnueabihf-ar RANLIB=arm-unknown-linux-gnueabihf-ranlib ./configure --host=arm-unknown-linux --build=x86_64-linux-gnu --prefix=/python
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-unknown-linux-gnueabihf-gcc -shared" CROSS_COMPILE=arm-unknown-linux-gnueabihf- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-unknown-linux BUILDARCH=x86_64-linux-gnu
make install HOSTPYTHON=./hostpython BLDSHARED="arm-unknown-linux-gnueabihf-gcc -shared" CROSS_COMPILE=arm-unknown-linux-gnueabihf- CROSS_COMPILE_TARGET=yes prefix=../Python-2.7.3/_install
If I run this command with "sudo", I get an other error:
Creating directory ../Python-2.7.3/_install/lib/python2.7/config
Creating directory ../Python-2.7.3/_install/lib/pkgconfig
/bin/sh: 7: arm-unknown-linux-gnueabihf-ranlib: not found

When you use "sudo", not found the "arm-unknown-linux-", maybe you should add the path of the "arm-unknow-linux-" to the root's envirenment.

Related

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

GNU gcc mysys make command no rule to make target libpng

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

Error while compiling srilm in linux ubuntu 12.04

I am trying to install SRILM on my computer using os linux ubuntu 12.04, the gcc version 4.6.3 and the machine type is i686. at the end of the process it gives result of 2 errors as follows:
-o ../obj/i686/tclmain.o tclmain.cc
tclmain.cc:8:17: fatal error: tcl.h: No such file or directory
compilation terminated.
make[2]: * [../obj/i686/tclmain.o] Error 1
make[2]: Leaving directory /home/supriadi/workspace/srilm/misc/src'
make[1]: *** [release-libraries] Error 1
make[1]: Leaving directory/home/supriadi/workspace/srilm'
make: * [World] Error 2
what should I do to fix this problem? thanks friend
You're missing the dev files of tcl. Use
sudo apt-get install tcl-dev tk-dev
You need to install tcl development files.
You can find tcl-dev package for ubuntu 12.04 here https://launchpad.net/ubuntu/precise/+package/tcl-dev
Try this instead of make:
make MACHINE_TYPE=i686-m64 World
or
make NO_TCL=1 MACHINE_TYPE=i686-ubuntu World
In my case this lead me into another error
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such
file or directory
Which I found a fix here, such that:
sudo aptitude install libc6-dev-amd64

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.

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.