How to cross-build GZIP? - embedded

I am trying to build gzip for an embedded platform on a Linux machine. I downloaded the latest gzip distribution from here. Then, make requires first to run the configure program in order to tailor a Makefile for the specific target.
So I run configure and get some error messages. The problem seems to be a combination of a few things. Our compiler version is called e-gcc, so I used the following line, and got this error:
~/Projects/gzip-1.4$ ./configure CC=e-gcc
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 for style of include used by make... GNU
checking for gcc... e-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... configure: error: in `/home/xyz/Projects/gzip-1.4':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
Obviously, C compiled programs cannot run, b/c it is cross-compiler. The message say I have to use the --host option, but the problem is that we don't really have a defined name in gcc. However, I tried:
./configure CC=e-gcc --host=epiphany
and the error received is:
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
blah blah blah
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `epiphany': machine `epiphany' not recognized
configure: error: /bin/bash build-aux/config.sub epiphany failed
Last thing, I tried cheating and setting the host to arm as it is closest in spirit to our architecture. The configuration went much further, but eventually failed as well with the following message:
checking for GNU libc compatible realloc... no
checking for rmdir... no
configure: error: in `/home/xyz/Projects/gzip-1.4':
configure: error: Your system lacks the rmdir function.
Please report this, along with the output of "uname -a", to the
bug-coreutils#gnu.org mailing list. To continue past this point,
rerun configure with SKIP_RMDIR_CHECK=yes.
E.g., ./configure SKIP_RMDIR_CHECK=yes
See `config.log' for more details.
I am now pretty clueless on how to continue. Any suggestions?

Does the embedded platform have an environment in which a command-line gzip program makes sense? If you want to do gzip compression and decompression from software that you're writing for the embedded platform, then you should consider zlib instead.

Did you try running with the
SKIP_RMDIR_CHECK=yes
directive?

OK, Thanks, very helpful, it gave me the clues I needed.
I have gone a little further in that I now have a more correct --host string :
--host=eIII-parallella-epiphany
so I call configure as :
./configure CC=/cygdrive/[MYPATH]/Parallella/INSTALL/bin/e-gcc --host=eIII-parallella-epiphany
However you need to do a few other things, including copying the config.sub script from the epiphany sources into your own configure space. I also had to do some other edits, so that MACHOS was defined.
see : http://forums.parallella.org/viewtopic.php?f=13&t=337&p=2014#p2014 for more details.
cheers, Beau Webber

Related

How to fix libtool: undefined symbols not allowed in x86_64-pc-msys shared

I am trying to build heimdal package for msys2. To my dismay, during linking of the first constituent library, roken, dlls fail to be built, and that causes sort of a chain reaction further on.
The only message i get is:
libtool: undefined symbols not allowed in x86_64-pc-msys shared ... only static will be built
however, there is no information provided on what symbols are undefined. How can i find that out?
If i turn on output of commands wuth make V=1 i get libtool command that links from a large numbert of .lo files. If i try to run gcc over them (copying command from there), it does not recognize them as anything.
I am trying to follow instructions as outlined in msys2 package build script for heimdal.
On Windows building a shared library while allowing undefined symbols is not allowed.
Try to build with the -Wl,-no-undefined linker flag, for example by adding LDFLAGS="-Wl,-no-undefined" to the ./configure command.
If that didn't work try this after ./configure and before make:
sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool
If you already had a failed build earlier you should also clean up any .la files like this before running make again:
rm $(find -name '*.la')

ld: cannot open output file conftest.exe: Permission denied

Using MSYS2 (version x86_64-20160205) on Windows 7 64bits, I'm trying to compile corkscrew.
Here is the output:
$ ./configure
loading cache ./config.cache
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... (cached) no
checking for working aclocal... found
checking for working autoconf... missing
checking for working automake... found
checking for working autoheader... missing
checking for working makeinfo... missing
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ANSI C... (cached) none needed
checking how to run the C preprocessor... (cached) gcc -E
checking for function prototypes... yes
checking for gcc... (cached) gcc
checking whether the C compiler (gcc -g -O2 ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
And the content of config.log:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:556: checking for a BSD compatible install
configure:609: checking whether build environment is sane
configure:666: checking whether make sets ${MAKE}
configure:712: checking for working aclocal
configure:725: checking for working autoconf
configure:738: checking for working automake
configure:751: checking for working autoheader
configure:764: checking for working makeinfo
configure:783: checking for gcc
configure:896: checking whether the C compiler (gcc ) works
configure:912: gcc -o conftest conftest.c 1>&5
configure:909:1: warning: return type defaults to 'int' [-Wimplicit-int]
main(){return(0);}
^
configure:938: checking whether the C compiler (gcc ) is a cross-compiler
configure:943: checking whether we are using GNU C
configure:971: checking whether gcc accepts -g
configure:1006: checking for gcc option to accept ANSI C
configure:1083: checking how to run the C preprocessor
configure:1165: checking for function prototypes
configure:1327: checking for gcc
configure:1440: checking whether the C compiler (gcc -g -O2 ) works
configure:1456: gcc -o conftest -g -O2 conftest.c 1>&5
configure:1453:1: warning: return type defaults to 'int' [-Wimplicit-int]
main(){return(0);}
^
/usr/lib/gcc/x86_64-pc-msys/5.3.0/../../../../x86_64-pc-msys/bin/ld: cannot open output file conftest.exe: Permission denied
collect2: error: ld returned 1 exit status
configure: failed program was:
#line 1451 "configure"
#include "confdefs.h"
main(){return(0);}
I've tested this answer without any success. Or to be more precise, it goes to the next step (which is failing at detecting my system, which is more a corkscrew's config issue I think) randomly...
This is not a rights problem as I have all the rights on that folder and I use my user to execute ./configure.
Any idea?
It looks like ld is having trouble creating an executable file due to permission problems. Try building the program in a folder that you are sure that you own (like C:\Users\yourusername) or try adjusting the permissions for the folder you are building in.

Problems with the compilation and installation of the Apache HTTP Server on Unix

When I try "Configuring the source tree" in the link below:
http://httpd.apache.org/docs/current/install.html#upgrading
I get the following error and can't see the problem any ideas?
Thanks
$ sudo CC="pgcc" CFLAGS="-O2" \
./configure --prefix=/sw/pkg/apache \
--enable-ldap=shared \
--enable-lua=shared
[sudo] password for dosullivan:
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CPP to "x86_64-linux-gnu-gcc -E"
adding "-pthread" to CFLAGS
setting CPPFLAGS to " -D_REENTRANT -D_GNU_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... pgcc
checking whether the C compiler works... no
configure: error: in /home/dosullivan/httpd-2.4.4':
configure: error: C compiler cannot create executables
Seeconfig.log' for more details
It appears that 'pgcc' is not the name of your compiler. Are you sure you didn't mean to use 'gcc'?
Basically, the configure command is trying to produce a 'hello world' style program just to make sure that it has access to a working compiler.

G++: error: unrecognized option ‘-soname’

I am trying to build SLitrani on Ubuntu 12.04 64-bit. I have already built ROOT 5.34.03 from source and I did figure out how to set the LD_LIBRARY_PATH and PATH variables for $ROOTDEV so the problem is not there but when I try to make SplineFit I get
>>> g++: error: unrecognized option ‘-soname=libSplineFit.so’
make: *** [libSplineFit.so] Error 1
I also did change all the -m32 to -m64 in the Makefiles so I don't know what is going on. I was able to get TwoPad installed but I can't continue from SplineFit. I have been on this build for quite some time and would appreciate any help.
From memory, soname is a linker operation, not a compiler one. So, if you're doing it with g++, you may need to change the option into something like:
-Wl,-soname=libSplineFit.so
The following transcript shows that this is necessary:
pax> g++ --soname=x -Wall -o qq qq.cpp
cc1plus: error: unrecognized command line option "-fsoname=x"
pax> g++ -Wl,-soname=x -Wall -o qq qq.cpp
pax>
From the online GNU docs for gcc:
-Wl,option: pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas.
I know this is an old question but after a week of struggling I thought I should post my findings.
I've successfully edited the makefiles for this so they can compile on Ubuntu 12.04 x64.
You can remove the -soname option completely, it seemingly is unnecessary.
As mentioned: all "m32" change to "m64".
You can replace "$ROOTSYS/libs" with "$ROOTLIBS"
and with TwoPad makefile reorder the library order (under LIBS += (.....)) so that -lTwoPad is NOT last on the list, and for VisuSLitrani make -lPhysMore last in its group.
As far as I know the errors saying "set but not used" can be ignored.
If any of this still doesn't work contact me back and I can send you my makefiles.
Here a nice explanation of the -soname linker option, how to call it and what it is good for.
Summary
You can simply use gcc -shared -Wl,-soname,libfoo_v1.so -o libfoo_v1.so libfoo_v1.o and skip the following discussion ;)
call it as gcc -shared -Wl,-soname,libfoo.so -o libfoo_v1.so libfoo_v1.o
after compiling you need to create an symbolic link pointing to libfoo_v1.so ln -s libfoo_v1.so libfoo.so before you can execute your code.
This is used to link against different shared libraries during compiletime and runtime. Obviously these libraries need a similar interface. You can use this for managing different versions.

Compiling GDC on Windows -- where to get GMP and MPFR dependencies?

I'm trying to compile GDC (v2) on Windows 7, using MinGW's MSYS.
When I get to this step:
$ ../configure --enable-languages=d --disable-shared --disable-bootstrap
I get:
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking target system type... i686-pc-mingw32
checking for a BSD-compatible install... /bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
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 ANSI C... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.
This made me look back at the instructions, which noted that it needs these libraries:
libgmp3-dev
libmpfr-dev
libmpc-dev
So now the question is, where do I find these headers and/or libraries? I've searched all over for libgmp3-dev, but I can't find anything for Windows. (I'm still in the learning process for *nix, so I'm not too familiar with anything.)
Thanks!
Update:
So I tried to make MPFR (I don't even know if it was the right version), and I got this error:
$ make install
Making install in tests
[...]
test -z "/usr/local/lib" || /bin/mkdir -p "/usr/local/lib"
/bin/sh ./libtool --mode=install /bin/install -c libmpfr.la '/usr/local/lib'
libtool: install: /bin/install -c .libs/libmpfr.lai /usr/local/lib/libmpfr.la
libtool: install: /bin/install -c .libs/libmpfr.a /usr/local/lib/libmpfr.a
libtool: install: chmod 644 /usr/local/lib/libmpfr.a
libtool: install: ranlib /usr/local/lib/libmpfr.a
/bin/sh: /home/Home: No such file or directory
make[2]: *** [install-libLTLIBRARIES] Error 127
make[2]: Leaving directory `/home/Home User/mpfr-2.4.2'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/Home User/mpfr-2.4.2'
make: *** [install-recursive] Error 1
Any ideas?
From https://bitbucket.org/goshawk/gdc/wiki/MinGWCompile :
ftp://ftp.gmplib.org/pub/gmp-5.0.1/gmp-5.0.1.tar.bz2
http://www.mpfr.org/mpfr-current/mpfr-3.0.0.tar.bz2
http://gmplib.org/
http://www.mpfr.org/
Just download the source tarballs. As for building these, I don't remember the details (the instructions should be clear on this) but I know you can put these GMP and MPFR in the source tree with GCC and the GCC build process will automatically take care of building these. This may be easier than building/installing/setting environment variables for them as a discrete step.
I always use this for building gdc on Windows: http://gladman.plushost.co.uk/oldsite/computing/gmp4win.php
The error message you posted has the links to find the libraries. You might need to download their source code and compile them, but they are both easy to build.