Compiling glib2 from the scratch - c

i want to compile glib2 for a specific platform. It needs gettext, so I passed where the gettext libraries are. For example:
$ ./configure CC=.. CFLAGS=... -prefix=.. LDFLAGS="-L../libconv/lib/ -L../gettext/usr/local/lib" --enable-shared=no
but it returns:
....
checking libintl.h usability... no
checking libintl.h presence... no
checking for libintl.h... no
configure: error:
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
Do you have any idea about why it doesn't detect gettext?
Thanks.

While "installing" everything in a directory under your home directory, you needed to add the "bin" subdirectory of the --prefix directory to your $PATH before running configure.

download the latest package from here:
http://ftp.gnu.org/pub/gnu/gettext/
compile it and run your configure command again and it should fix the issue.

Related

How to compile GCC cross-compiler?

I am trying to compile GCC for i586-elf but every time I run the 'configure' file with this command:
./configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable
languages=c --without-headers --with-gmp=$PREFIX --with-mpc=$PREFIX
--with-mpfr=$PREFIX
Then it gives me this error:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no.
Although I have specified where gmp, mpfr, and mpc are located. And I have the latest versions of them. Is there anything I am missing?
Unless you really care about specific gmp/mpfr etc versions I suggest you run the contrib/download_prerequisites script from the top-level GCC source directory and then omit the --with-gmp=$PREFIX --with-mpc=$PREFIX --with-mpfr=$PREFIX from your configure line. The download_prerequisites script will download and unpack the right versions of the libraries that your GCC version needs and it will create the right symlinks in the right places

Recipe for target 'graphite-clast-to-gimple.o' failed when I compile GCC Cross-Compiler

I would like to create a GCC cross-compiler and I follow the instruction here here But the problem is each time when I make gcc will have same error blow.
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:897:24: error: ‘isl_lp_ok’
was not declared in this scope
assert (lp_result == isl_lp_ok);
^
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:898:34: error:
‘isl_int_get_gmp’ was not declared in this scope
isl_int_get_gmp (isl_value, low); ^
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:900:57: error: ‘isl_set_max’
was not declared in this scope
lp_result = isl_set_max (domain, dimension, &isl_value);
^
../../gcc-4.8.2/gcc/graphite-clast-to-gimple.c:904:27: error:
‘isl_int_clear’ was not declared in this scope
isl_int_clear (isl_value); ^
Makefile:1058: recipe for target 'graphite-clast-to-gimple.o' failed
make[1]: *** [graphite-clast-to-gimple.o] Error 1
make[1]: Leaving directory '/home/mike/src/build-gcc/gcc'
Makefile:3927: recipe for target 'all-gcc' failed
make: *** [all-gcc] Error 2
At first,I think it may caused by the version problem because the gcc on my openSUSE is 4.8.3,but nothing changed after I use version 4.8.2.
Thanks a lot!
There's a problem with the latest version (0.14?) of the ISL library - the API is not compatible with gcc as of 4.9.2. As for building CLooG, the ISL-0.12.1 version included with 0.18.2 doesn't get configured properly. So you need to build and install your own libraries, and then use those when configuring gcc.
1/. isl-0.12.2
> ./configure --prefix=$CROSSDIR --with-gmp-prefix=$GMPDIR
> make install # and rehash, etc.
where CROSSDIR is where you're installing your cross compiler toolchain, and GMPDIR is the root directory containing lib and include directories for GMP. Unfortunately, this means you will need to build GMP, MPFR, and MPC separately and install, or install them from a package system first. But you might not need this (see below).
2/. cloog-0.18.2
> ./configure --prefix=$CROSSDIR --with-isl-prefix=$CROSSDIR \
--with-gmp-prefix=$GMPDIR
There's a ridiculous issue where the Makefile has 'cmake' strings lying about. The solution (from clfs.org) :
> sed '/cmake/d' Makefile > Makefile.new
> mv Makefile.new Makefile
> make install # and rehash, etc.
When configuring gcc, use: --with-isl=$CROSSDIR --with-cloog=$CROSSDIR, and you will need options for: --with-gmp, --with-mpfr, --with-mpc
Alternatively - following the instructions you're using, it may be sufficient to move isl-0.12.2 & cloog-0.18.2 to the isl and cloog subtrees in the gcc source tree. After the configure, go into the cloog build subdirectory and edit the Makefile as above. I haven't tried this. I build and install the packages separately under CROSSDIR for other reasons.
If you are on Linux, you could probably get the development packages for your system. I know the commands for a Debian-based system such as Ubuntu and its variants.
sudo apt-get install libisl-dev
sudo apt-get install libcloog-isl-dev
After that, delete the isl and cloog directories in your gcc folder, then try to continue from:
make all-gcc
If you don't have a Debian-based system, some hunting around in Google Forest should help.

Build cross compiler - error: libmpfr not found

I am trying to build a cross compiler. I follow this tutorial: http://wiki.osdev.org/GCC_Cross-Compiler
I installed binutils in in /opt/cross. now I try to install gcc-4.7.4 with mpfr-2.4.2. I used commands to prepare and configure:
export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
mv gmp-4.3.2 gcc-4.7.4/gmp
mv mpfr-2.4.2 gcc-4.7.4/mpfr
mv mpc-0.8.1 gcc-4.7.4/mpc
# i am in usr/src directory
mkdir build-gcc
cd build-gcc
../gcc-4.7.4/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
Now, i use make all-gcc to build, but I receive following error: configure: error: libmpfr not found or uses a different ABI (including static vs shared).
Why is this happening and how I can fix it?
Thanks!
You can check how "configure" checks if libmpfr is available (where configure looks for it) or just give the path to your libmpfr - with probably --enable-libmpfr=/path/ or something like this.
The second option is to give gcc configure option to disable using of mpfr (--disable-mpfr ?)
I assume that you are trying to compile gcc for another architecture than your host. Maybe gcc configure found libmpfr but it is mpfr from your host and not from your target architecture? You may take a look into config.log file if there is any and check which mpfr is using by configure.
Did you try to link libraries with export LD_LIBRARY_PATH=./gcc-4.7.4/mpfr/.libs

error: C compiler cannot create executables (GEOS, basemap)

I am currently getting the following error when attempting to get basemap-1.0.7 to work on my MAC OS v10.7.3:
error: C compiler cannot create executables
I downloaded basemap-1.0.7.tar.gz from here, and upon installation, I followed the numbered instructions in the README file:
0) Install pre-requisite python modules numpy and matplotlib.
1) Then download basemap-X.Y.Z.tar.gz (approx 100 mb) from
the sourceforge download site, unpack and cd to basemap-X.Y.Z.
2) Install the GEOS library. If you already have it on your
system, just set the environment variable GEOS_DIR to point to the location
of libgeos_c and geos_c.h (if libgeos_c is in /usr/local/lib and
geos_c.h is in /usr/local/include, set GEOS_DIR to /usr/local).
Then go to step (3). If you don't have it, you can build it from
the source code included with basemap by following these steps:
> cd geos-3.3.3
> export GEOS_DIR=<where you want the libs and headers to go>
A reasonable choice on a Unix-like system is /usr/local, or
if you don't have permission to write there, your home directory.
> ./configure --prefix=$GEOS_DIR
> make; make install
0) Done: I use anaconda, so both import numpy and import matplotlib work in an interactive session of ipython.
1) Done: basemap 1.0.7 is downloaded, unpacked, and I have changed my working directory to to Downloads/basemap-1.0.7/
2) Problem: I do not have the GEOS library. Therefore, I followed the instructions as per the README file:
cd geos-3.3.3
export GEOS_DIR=/Users/ged/anaconda/lib/python2.7/site-packages/
./configure --prefix=$GEOS_DIR
The ensuing terminal output is:
checking build system type... i386-apple-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking target system type... i386-apple-darwin11.3.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/ged/Downloads/basemap-1.0.7/geos-3.3.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
The config.log file is a bit long to put it here, so I've made it available here
I have tried installing GEOS through GDAL 1.11, and I also looked into upgrading to xcode 4.6.3 but, to be honest, I feel a little out of my depth.
I'm getting the following message:
error: C compiler cannot create executables
Could you please provide some insight on how to solve this issue?
Thanks in advance!

C compiler cannot create executables when trying to build Binutils

I am trying to build Linux From Scratch, and now I am at chapter 5.4, which tells me how to build Binutils. I have binutils 2.20's source code, but when I try to build it:
time { ./binutils-2.20/configure --target=$LFS_TGT --prefix=/tools --disable-nls --disable-werror ; }
it gives me an error:
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-lfs-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... GCC
checking for C compiler default output file name...
configure: error: in `/media/LFS':
configure: error: C compiler cannot create executables
See `config.log' for more details.
You can see my config.log at pastebin.com: http://pastebin.com/hX7v5KLn
I have just installed Ubuntu 10.04, and reinstalled GCC and installed G++. Also, the build is done by a non-root, non-admin user called 'lfs' (which is also described in Linux From Scratch), and on a different partition than where the system is installed.
Can anyone help me? Thanks
The /tools directory didn't exist. I created it and now it compiles fine.
Try:
export CC=/usr/bin/gcc
before running configure.

Resources