gmb problem on rhel6

Asked by Nemanja Savic

Hi all,

I am trying to build arm tool chain on my rhel6 machine.
I have the same problem like in https://answers.launchpad.net/gcc-arm-embedded/+question/205168

I have downloaded latest version of arm gcc.

The native gcc is installed like it was described in step 4, but I don't know how to use it.

The suggested solution with updating ppl to version 12 something is not possible since I can install only version 10 something.

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Nemanja Savic
Solved:
Last query:
Last reply:
Revision history for this message
Freddie Chopin (freddie-chopin) said :
#1

Today I've found another solution - replace "--with-libgmp-prefix" (which is wrong) with "--with-gmp" (which is right according to PPL docs) - that worked for me and now I can use PPL in version recommended for GCC - 0.11. I suggest that build scripts for linaro toolchain should be upgraded...

I've compiled the toolchain several times, solving dozens of problems, so feel free to ask (;

BTW - I'm compiling using my "normal" gcc (most recent), without installing specific version like in the description. If you do the same, make sure to update variables in build-common.sh. I have them like that:
BUILD=x86_64-linux-gnu
HOST_LINUX=x86_64-linux-gnu
HOST_MINGW=x86_64-w64-mingw32
HOST_MINGW_TOOL=x86_64-w64-mingw32

Revision history for this message
Nemanja Savic (vlasinac) said :
#2

Unfortunately, this suggestions didn't solve my problem.
I changed --with-libgmp-prefix with --with-gmp in build-prerequisites.sh and still I have following problem, here you can see part ofconsole view.

checking how to link with libgmp... -lgmp
checking how to link with libgmpxx... -lgmpxx -lgmp
checking for the GMP library version 4.1.3 or above... no
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.
[savi_ne@ts-070046nl gcc-arm-none-eabi-4_6-2012q2-20120614]$ gedit build-prerequisites.sh &
[1] 11945
[savi_ne@ts-070046nl gcc-arm-none-eabi-4_6-2012q2-20120614]$ sudo yum install gmp
DLR passwd:
Loaded plugins: refresh-packagekit, rhnplugin
Setting up Install Process
Package gmp-4.3.1-7.el6_2.2.x86_64 already installed and latest version
Nothing to do

Revision history for this message
Nemanja Savic (vlasinac) said :
#3

I have just found that I make a mistake and put on one plate --with-gmp-prefix. When I changed that, I got similar proble, slightly different:

checking for shared library run path origin... done
checking how to link with libgmp... /home/savi_ne/tools/arm_toolchain/gcc-arm-none-eabi-4_6-2012q2-20120614/build-linux/host-libs/usr/lib/libgmp.a
checking how to link with libgmpxx... /home/savi_ne/tools/arm_toolchain/gcc-arm-none-eabi-4_6-2012q2-20120614/build-linux/host-libs/usr/lib/libgmpxx.a /home/savi_ne/tools/arm_toolchain/gcc-arm-none-eabi-4_6-2012q2-20120614/build-linux/host-libs/usr/lib/libgmp.a
checking for the GMP library version 4.1.3 or above... no
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.
[1]- Done gedit build-prerequisites.sh
[2]+ Done gedit build-prerequisites.sh

I hope somebody will have any suggestion what to do next.
P.S. I am using RHEL6

Regards
Nemanja

Revision history for this message
Freddie Chopin (freddie-chopin) said :
#4

But the scripts search for GMP in toolchain build directory - something like build_linux/host_libs/usr/... (don't remember now), so installing that in your system probably won't help much...

Why can't you try to replace PPL with 0.12.1 in toolchain src dir and updating version number in build-common.sh? That's all it takes to use newer PPL.

4\/3!!

Revision history for this message
Nemanja Savic (vlasinac) said :
#5

I suppose because of this:

[savi_ne@ts gcc-arm-none-eabi-4_6-2012q2-20120614]$ sudo yum install ppl
Loaded plugins: refresh-packagekit, rhnplugin
Setting up Install Process
Package ppl-0.10.2-11.el6.x86_64 already installed and latest version
Nothing to do

I think the main problem is that I am not so involved in using linux.

Revision history for this message
Zhenqiang Chen (zhenqiang-chen) said :
#6

If you only use the toolchain on the build system, you can use the gmp from your system, i.e. remove the build for gmp.

Revision history for this message
Nemanja Savic (vlasinac) said :
#7

Does this mean that I should comment his in build-prerequisites.sh:

echo Task [1-1] /$HOST_LINUX/gmp/
rm -rf $BUILDDIR_LINUX/gmp && mkdir -p $BUILDDIR_LINUX/gmp
pushd $BUILDDIR_LINUX/gmp

CPPFLAGS="-fexceptions" $SRCDIR/$GMP/configure --build=$BUILD \
    --host=$HOST_LINUX \
    --prefix=$BUILDDIR_LINUX/host-libs/usr \
    --enable-cxx \
    --disable-shared \
    --disable-nls

make -j$JOBS
make install
#make check
popd

?

Revision history for this message
Freddie Chopin (freddie-chopin) said :
#8

Yes, but you'll need to supply proper paths to GMP to other components that need it. Actually you probably don't need most of the libraries from the prerequisites if you have them on your system.

4\/3!!

Revision history for this message
Nemanja Savic (vlasinac) said :
#9

OK, can you suggest me how to install proper version of ppl or how to supply proper paths to GMP?
I commented mentioned part and nothing happened again.

Revision history for this message
chengbin (can-finner) said :
#10

Hi Nemanja Savic,
Can you help me confirm whether the problem can be fixed by using the newly built gcc as in step 4?
You can just modify the environment files to add the path, for example on Ubuntu:
edit "~/.bashrc" by adding following code at the end of file:

export PATH=XXX:$PATH

in which XXX is the path where you installed the newly built GCC.

I think it's something similar for rhel6 system.
After that, please use following command to verify the newlib built GCC is in PATH:

$ which gcc

Hoping this help.

Revision history for this message
Nemanja Savic (vlasinac) said :
#11

I built new gcc like few days ago, or I hope that it was successful build, cause it lasted for one hour or so.
I added new path as it was suggested.

[savi_ne@ts-070046nl native-gcc]$ export $PATH
bash: export: `/home/savi_ne/tools/native-gcc/target/bin:/home/savi_ne/tools/native-gcc/target/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/savi_ne/bin': not a valid identifier
[savi_ne@ts-070046nl native-gcc]$ which gcc
/usr/bin/gcc

Obviousely, something is wrong.

Revision history for this message
Nemanja Savic (vlasinac) said :
#12

Ok, I managed to install properly native gcc:

[savi_ne@ts-070046nl ~]$ which gcc
~/tools/native-gcc/target/bin/gcc

Does this mean that my default gcc is nativ-gcc or not?
Is there any specific action for compiling arn tool chain using native-gcc or I should act as usual?

Regards

Revision history for this message
Nemanja Savic (vlasinac) said :
#13

@chengbin

the problem vannot be solved using native-gcc. I still have the same problem.

checking how to link with libgmp... -lgmp
checking how to link with libgmpxx... -lgmpxx -lgmp
checking for the GMP library version 4.1.3 or above... no
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.

Revision history for this message
chengbin (can-finner) said :
#14

Sorry I haven't tried the build process on rhel6, now I am not sure what the problem is.
Basically, in our release, GCC(version 4.6) requires GMP/MPFR/MPC/PPL/CLOOG.
You can refer to GCC document at http://gcc.gnu.org/install/prerequisites.html to see how to specify correct gmp package when configuring GCC.
After understanding the relations between these prerequisites and GCC, you can open config.log and check why it cannot find the correct version GMP.

NOTE, the GCC document is for GCC trunk, it requires ISL, rather than ppl as our release.

Hoping this can help.

Revision history for this message
Freddie Chopin (freddie-chopin) said :
#15

But it's PPL that doesn't find GMP, not GCC... It's in the "build-prerequisites.sh" stage, not during final compilation of toolchain. That's the problem.

Revision history for this message
Nemanja Savic (vlasinac) said :
#16

Yes, that is the problem. So, any new suggestions?

Revision history for this message
Nemanja Savic (vlasinac) said :
#17

Somewhere is stated about installing first gmp, mpfr, mps and ppl with some proper configuration, and then installing GCC using previously installed tools.
Do you think that this is proper way?

Revision history for this message
Freddie Chopin (freddie-chopin) said :
#18

You always do it this way, but that's not the problem anyway [; Try PPL 0.12.1 - when I tried some time ago it solved the problem you have. Now - when I build "natively" (so my PC is x86_64-... and I set BUILD and HOST variables in build-common.sh to this type) - it works with PPL 0.11, but when I try to do it non-natively (like specifying that HOST would be i686) it still fails. Fortunately I don't need 32-bit binary anyway (; Maybe you could try that too? If your PC and your OS is 64-bits you should specify these variables to be the same as your system, so x86_64-linux-gnu it I remember correctly.

4\/3!!

Revision history for this message
Nemanja Savic (vlasinac) said :
#19

There is also another question (sorry for a lot of them):

In native gcc as you can see this path

~/tools/native-gcc/target/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/

There is no i686, can this be becuse of bad native-gcc installation?

Revision history for this message
Freddie Chopin (freddie-chopin) said :
#20

Actually I was talking about compiling the toolchain with the "native compiler" of your system (the one from RHEL6), not compiling your own compiler. Try looking for that compiler in /usr, /bin or sth like that (sorry, don't know much about linux), and use it. It will probably be x86_64-unknown-linux-gnu too, and that's exactly what you should enter as BUILD and HOST_LINUX

Revision history for this message
Nemanja Savic (vlasinac) said :
#21

I still haven't installed this tool under RHEL6. Any new suggestions?

Revision history for this message
chengbin (can-finner) said :
#22

Very sorry that we have no RHEL6 system, so no progress on this issue yet.
Is it possible for you to re-build the toolchain on other validated platforms?

Revision history for this message
Terry Guo (terry.guo) said :
#23

Hi Nemanja,

I managed to set up a 64bit RHEL 6.2 system and can reproduce this issue. During the PPL configuration, a file named conftest.c will be generated and built to verify whether there are GMP head files and library files in current environment. So to successfully build this file, the PPL configuration process needs to know where to find those head files and library files. With option "--with-gmp-prefix=$BUILDDIR_LINUX/host-libs/usr", on 32bit system, a "/lib" will be appended to constitute a search patch. This works because we do install all files under this path. But on 64bit system, PPL will append "/lib64" to that path. Thus the GMP files can't be found. So the PPL configuration aborts on 64bit system. Unlike PPL, the other prerequisite libraries use "/lib" for both 64 and 32 bit systems, so they don't have this issue.

If use options like "--with-gmp=DIR" or "--with-gmp-build=DIR", PPL can only deduce library files from them, not the head files. So the build of conftest.c still fails.

To quick fix this issue, just specify the correct path to .h files in CXXFLAGS and CFLAGS, the path to .a files in LDFLAGS when configure PPL. In my system, I configure PPL with:

###############################################
echo Task [I-4] /$HOST_LINUX/ppl/
rm -rf $BUILDDIR_LINUX/ppl && mkdir -p $BUILDDIR_LINUX/ppl
pushd $BUILDDIR_LINUX/ppl

CFLAGS="-I$BUILDDIR_LINUX/host-libs/usr/include" \
CXXFLAGS="-I$BUILDDIR_LINUX/host-libs/usr/include" \
LDFLAGS="-L$BUILDDIR_LINUX/host-libs/usr/lib" \
$SRCDIR/$PPL/configure --build=$BUILD \
    --host=$HOST_LINUX \
    --target=$TARGET \
    --prefix=$BUILDDIR_LINUX/host-libs/usr \
    --disable-shared \
    --disable-nls \
    --enable-interfaces=c,c++ \
    --with-gmp-prefix=$BUILDDIR_LINUX/host-libs/usr

make
make install
popd
###############################################

The new option "--enable-interfaces=c,c++" is to prevent building PPL for JAVA. If JAVA isn't installed in your platform, this build will be disabled automatically.

Also please remember to update the --host and --build to something like:
BUILD=x86_64-linux-gnu
HOST_LINUX=x86_64-linux-gnu

With above changes, I can build the prerequisite libraries and toolchain on my 64bit RHEL 6.2 machine.

Hope those are helpful.

Revision history for this message
Nemanja Savic (vlasinac) said :
#24

Hi all,

hm, I haven't been trying to install this for a two months or so now, so I have forgot about the things I was doing before. But this looks very promissing. Here I can only use RHEL and nothing else, that's the biggest problem, because otherwise I would install ubuntu and be in peace.

Since I have deleted everything I have to start again from scratch.

I have changed variables BUILD and HOST_LINUX.
In build-prerequisites.sh, do I have to comment installing gmp, mpfr and mpc and use them from my system, or I should install them as well?

Best regards and thank you
Nemanja

Revision history for this message
Nemanja Savic (vlasinac) said :
#25

And also maybe this can be usefull for u to tell me what's wrong. i mean obviousely gmp libraries again, but maybe something else

/home/savi_ne/tools/toolchain/gcc-arm-none-eabi-4_6-2012q4-20121016/src/ppl-0.11/configure --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-none-eabi --prefix=/home/savi_ne/tools/toolchain/gcc-arm-none-eabi-4_6-2012q4-20121016/build-linux/host-libs/usr --disable-shared --disable-nls --enable-interfaces=c,c++ --with-gmp-prefix=/home/savi_ne/tools/toolchain/gcc-arm-none-eabi-4_6-2012q4-20121016/build-linux/host-libs/usr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
checking for x86_64-linux-gnu-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether we are actually using the Intel C compiler... no
checking for x86_64-linux-gnu-g++... no
checking for x86_64-linux-gnu-c++... no
checking for x86_64-linux-gnu-gpp... no
checking for x86_64-linux-gnu-aCC... no
checking for x86_64-linux-gnu-CC... no
checking for x86_64-linux-gnu-cxx... no
checking for x86_64-linux-gnu-cc++... no
checking for x86_64-linux-gnu-cl.exe... no
checking for x86_64-linux-gnu-FCC... no
checking for x86_64-linux-gnu-KCC... no
checking for x86_64-linux-gnu-RCC... no
checking for x86_64-linux-gnu-xlC_r... no
checking for x86_64-linux-gnu-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking whether we are actually using the Intel C++ compiler... no
checking for grep that handles long lines and -e... /bin/grep
checking for fgrep... /bin/grep -F
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking how to run the C++ preprocessor... g++ -E
checking whether make sets $(MAKE)... (cached) yes
checking whether to compile with debug info... yes
checking whether to compile for profiling... no
checking whether to compile for test coverage... no
checking whether to enable checking of run-time assertions... no
checking whether to enable even more run-time assertions... no
checking whether to enable optimizations... standard
checking for which architecture to optimize... default
checking whether to select specific floating point arithmetics... default
checking whether to use precompiled headers... no
checking the type of integral values to use as coefficients... GMP mpz
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking for typeof syntax and keyword spelling... typeof
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of size_t... 8
checking size of float... 4
checking size of double... 8
checking size of long double... 16
checking size of int*... 8
checking size of fp... 8
checking for perl... /usr/bin/perl
checking for library containing sqrt... none required
checking fenv.h usability... yes
checking fenv.h presence... yes
checking for fenv.h... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking if it is possible to control the FPU... yes
checking whether the C++ compiler provides proper long doubles... yes
checking the binary format of C++ floats... IEEE754 Single Precision
checking whether C++ provides exact output for floats... yes
checking the binary format of C++ doubles... IEEE754 Double Precision
checking whether C++ provides exact output for doubles... yes
checking the binary format of C++ long doubles... Intel Double-Extended
checking whether C++ provides exact output for long doubles... yes
checking whether the C++ compiler supports flexible arrays... yes
checking whether the IEEE inexact flag is supported in C++... yes
checking if the compiler has the remainder bug... yes
checking whether the C++ compiler supports __attribute__ ((weak))... yes
checking for fenv.h... (cached) yes
checking for ieeefp.h... (cached) no
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking whether ffs is declared... yes
checking whether getenv is declared... yes
checking whether strtof is declared... yes
checking whether strtod is declared... yes
checking whether strtold is declared... yes
checking whether strtoll is declared... yes
checking whether strtoull is declared... yes
checking whether fma is declared... yes
checking whether fmaf is declared... yes
checking whether fmal is declared... yes
checking whether rintf is declared... yes
checking whether rintl is declared... yes
checking for int_fast16_t... yes
checking for int_fast32_t... yes
checking for int_fast64_t... yes
checking for uint_fast16_t... yes
checking for uint_fast32_t... yes
checking for uint_fast64_t... yes
checking for uintptr_t... yes
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking how to link with libgmp... -lgmp
checking how to link with libgmpxx... -lgmpxx -lgmp
checking for the GMP library version 4.1.3 or above... no
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.

Revision history for this message
Nemanja Savic (vlasinac) said :
#26

Fortunatelly guys, it finally works thanks to Terry Guo. I read few times his post and realized the problem abput the folder, so I have just added following line before confiiguring ppl (except changing host and build variables as was stated above):

#################################

cp -R $BUILDDIR_LINUX/host-libs/usr/lib $BUILDDIR_LINUX/host-libs/usr/lib64

#################################

and it made my life easier.

Many thanks, and I hope that this will be helpful to the other people.

Nemanja