Can't compile Rust - llvm

I'm on Debian and following the compile instructions from the Rust wiki: https://github.com/mozilla/rust/wiki/Doc-getting-started
I tried a couple of times but it always ends up with the following error:
llvm[3]: Compiling opt.cpp for Release+Asserts build
make[3]: *** No rule to make target `/home/user/rust/llvm/x86_64-unknown-linux-
gnu/tools/lib/libLLVMipo.a', needed by `/home/user/rust/llvm/x86_64-unknown-
linux-gnu/Release+Asserts/bin/opt'. Stop.
make[3]: Leaving directory `/home/user/rust/llvm/x86_64-unknown-linux-gnu/
tools/opt'
make[2]: *** [opt/.makeall] Error 2
make[2]: Leaving directory `/home/user/rust/llvm/x86_64-unknown-linux-gnu/tools'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/user/rust/llvm/x86_64-unknown-linux-gnu'
make: *** [/home/user/rust/llvm/x86_64-unknown-linux-gnu/Release+Asserts/
bin/llvm-config] Error 2
Edit:
The problem only occurs whithin a debootstrap/chroot environment, not within a full Debian Installation.

If you're referring to these instructions:
git clone git://github.com/mozilla/rust.git
cd rust
mkdir build
cd build
../configure
make check
...I can see at least one thing wrong with them. Try this instead:
git clone git://github.com/mozilla/rust.git
cd rust
git submodule update --init
./configure
make
sudo make install
The git submodule update --init is necessary to initialize Rust's submodules, which include LLVM and libuv.

git submodule update shouldn't be needed, as Rust's configure script tries to handle that itself, but if you run git submodule status and see lines about changes to src/libuv or src/llvm then it could be a problem.
I haven't seen that error before and can't tell what's wrong from that snippet. Possibly run make clean-all then gist the full output of ./configure && make, as well as the contents of config.mk. Also, you will probably get more attention with this question on the rust bug tracker: http://github.com/mozilla/rust/issues

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

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?

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.

Cannot build LLVM and Clang

I have tried to compile clang and llvm using the clang getting started manual. However, at step 5, when I do make, I get the following error. Any idea what is going on here, and how to fix it? Note that I am using Ubuntu 10.04 on a 64 bit x86 system.
cp: cannot stat `/home/MetallicPriest/Desktop/build/tools/clang/runtime/compiler-rt/clang_linux/full-x86_64/libcompiler_rt.a': No such file or directory
make[4]: *** [/home/MetallicPriest/Desktop/build/Debug+Asserts/lib/clang/3.1/lib/linux/libclang_rt.full-x86_64.a] Error 1
rm /home/MetallicPriest/Desktop/build/Debug+Asserts/lib/clang/3.1/lib/linux/.dir
make[4]: Leaving directory `/home/MetallicPriest/Desktop/build/tools/clang/runtime/compiler-rt'
make[3]: *** [compiler-rt/.makeall] Error 2
make[3]: Leaving directory `/home/MetallicPriest/Desktop/build/tools/clang/runtime'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/MetallicPriest/Desktop/build/tools/clang'
make[1]: *** [clang/.makeall] Error 2
make[1]: Leaving directory `/home/MetallicPriest/Desktop/build/tools'
make: *** [all] Error 1
## Heading ##
The instruction given on this site work!
I had the same problem. As Eli suggested, I got the 3.0 release. It doesn't come with a 'getting started' but you can follow the INSTALL file from clang's root top.
You should be able to copy/paste the following (as root of course for the /usr/local/ part)
export NUMCPU=4 # or however many cores you want to paralell build with
export ORIGDIR=$PWD
wget http://llvm.org/releases/3.0/llvm-3.0.tar.gz
tar -zxf llvm-3.0.tar.gz
cd llvm-3.0.src/tools
wget http://llvm.org/releases/3.0/clang-3.0.tar.gz
tar -zxf clang-3.0.tar.gz
mv clang-3.0.src clang
cd $ORIGDIR
mkdir build
cd build
../llvm-3.0.src/configure --prefix=/usr/local
make -j$NUMCPU
cd tools/clang
make install
--
update, I should also note that following the 'getting started guide' with latest subversion (2012 09 10) actually does work , and i copy/pasted the lines exactly from the 'getting started' page http://clang.llvm.org/get_started.html (including 'optional' stuff) on a Fedora machine on ppc64.

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.