So far I've successfully launched the configure, but when I type make, I get the following error, after some time (there's a lot which compile successfully):
ld: unknown/unsupported architecture name for: -arch i686
/usr/bin/libtool: internal link edit command failed
make[2]: *** [libgcc_s.dylib] Error 1
make[1]: *** [libgcc.a] Error 2
make: *** [all-gcc] Error 2
Is there a way to tell gcc not to compile itself for the i686 architecture?
Here's my uname -a if it can help:
Darwin Frizlabs-Computer.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
Someone on serverfault answered the same question. So here's the way to compile gcc-4.0 on OS X Mountain Lion (copied from serverfault):
First get the old 4.0 package that was included with XCode 3.1 from Apple's Open Source page
Download the gcc-5493 package and build using:
mkdir darwin
cd darwin
../configure --prefix=/tmp/testplace --enable-languages=objc,c++
make bootstrap
make install
Related
I'm trying to cross-compile a modified version of the official Debian kernel for armhf on my amd64 machine. I'm using the HowToCrossBuildAnOfficialDebianKernelPackage instructions on the Debian wiki.
The kernel itself builds fine, but I get an error from ld when trying to build objtool for the linux-kbuild package:
# make -f debian/rules.real build-kbuild KBUILD_HOSTLDFLAGS="-L/usr/lib/arm-linux-gnueabihf"
[...]
arm-linux-gnueabihf-gcc /usr/src/linux.buster-backports/debian/build/build-tools/tools/objtool/objtool-in.o -lelf /usr/src/linux.buster-backports/debian/build/build-tools/tools/objtool/libsubcmd.a -L/usr/lib/arm-linux-gnueabihf -o /usr/src/linux.buster-backports/debian/build/build-tools/tools/objtool/objtool
/usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lelf
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:67: /usr/src/linux.buster-backports/debian/build/build-tools/tools/objtool/objtool] Error 1
You can see that make did add the -L/usr/lib/arm-linux-gnueabihf flag to gcc. And /usr/lib/arm-linux-gnueabihf does contain libelf:
# ls -l /usr/lib/arm-linux-gnueabihf/libelf*
-rw-r--r-- 1 root root 67296 May 28 2019 /usr/lib/arm-linux-gnueabihf/libelf-0.176.so
lrwxrwxrwx 1 root root 15 May 28 2019 /usr/lib/arm-linux-gnueabihf/libelf.so.1 -> libelf-0.176.so
# file /usr/lib/arm-linux-gnueabihf/libelf-0.176.so
/usr/lib/arm-linux-gnueabihf/libelf-0.176.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=51d60560aa6c0538f0bf34c07e4e2bc230c00834, stripped
I installed libelf like this:
dpkg --add-architecture armhf
apt-get update
apt-get install libelf1:armhf
The ld that's being used does appear to be for arm:
# /usr/lib/gcc-cross/arm-linux-gnueabihf/8/../../../../arm-linux-gnueabihf/bin/ld -V
GNU ld (GNU Binutils for Debian) 2.31.1
Supported emulations:
armelf_linux_eabi
armelfb_linux_eabi
I'm stumped. How do I get ld to link libelf?
Neither libelf-0.176.so nor libelf.so.1 are searched by the -lelf option to the linker. You still need libelf.so file. This file can be created:
By installing libelf-dev package (as usual, the libraries with exact .so are installed by *-dev packages). Make sure to choose a package suitable for cross-compiling.
By creating symlink libelf.so pointed to the libelf-0.176.so file which you have.
I made a softwareupdate on a simulationsoftware which needs a newer version of glibc. Therefore I wanted to install the glibc version 2.14 on a new prefix.
According to How to upgrade glibc from version 2.12 to 2.14 on CentOS?
i tried to install it on a sles11sp3
mkdir /var/mpi/Libraries/glibc_install; cd /var/mpi/Libraries/glibc_install
wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
tar zxvf glibc-2.14.tar.gz
cd glibc-2.14
mkdir build
cd build
../configure --prefix=/var/mpi/Libraries/glibc-2.14
make -j4
During the make I get the following error:
readlink.c:26: error: conflicting types for ‘__readlink’
../include/unistd.h:120: error: previous declaration of ‘__readlink’ was here
make[2]: *** [/var/mpi/Libraries/glibc_install/glibc-2.14/build/io/readlink.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/var/mpi/Libraries/glibc_install/glibc-2.14/io'
make[1]: *** [io/subdir_lib] Error 2
make[1]: Leaving directory `/var/mpi/Libraries/glibc_install/glibc-2.14'
make: *** [all] Error 2
Do you have a clue how to solve this problem?
io/readlink.c is just a stub implementation which always fails at run time. It is not supposed to be compiled at all when building for GNU/Linux. Instead, the implementation should come from the generic system call wrapper in sysdeps/unix/syscalls.list:
readlink - readlink i:spi __readlink readlink
However, recent Linux architectures (those called generic in Linux parlance, currently aarch64, csky, nios2, and riscv) no longer have a readlink system call, and the function as to be implemented using readlinkat. This implementation is in the file sysdeps/unix/sysv/linux/generic/readlink.c.
It's not clear what you are doing so that the wrong file is compiled. Are you sure you have installed compatible kernel headers?
The particular upstream commit (which went into glibc 2.15):
commit 95b7042bac3e2cfc6fef7aec6acc7d46dd50eba5
Author: Roland McGrath <roland#hack.frob.com>
Date: Fri Nov 11 10:02:42 2011 -0800
Fix __readlink declaration.
But given the fundamental nature of the build problem you encountered, I doubt that applying this patch, while addressing the immediate build failure, will give you a functional glibc build in the end.
GLIBC : 2.14 → 2011-06-01. The "bugfix version" 2.14.1 → 2011-10-07 https://ftp.gnu.org/gnu/glibc/
Note : make -j4 is not recommended for glibc, as far as I remember.
My tests (old SLE11 SP2) : The SLE 11 SP2 gcc 4.3.2 is too old for glibc-2.14.1, may be the SP3 minor gcc update (to 4.3.4) is also too old?
Using the "extra EL 6 gcc-4.9.3" .... for glibc-2.14.1 :
cd build-glibc214/ # the recommended build directory outside the glibc source
export CC=gcc49 CXX=g++49 && ../glibc-2.14.1/configure --prefix=/opt/glibc214
make # no errors
# make install # OK
Extra gcc´s : how to install gcc 4.9.2 on RHEL 7.4
I am trying to bootstrap cmake 3.11.3 on Ubuntu 16.04.4 LTS xenial.
I have upgrade my gnu g++ compiler as follows:
> $ g++ --version
g++ (Ubuntu 8.1.0-5ubuntu1~16.04) 8.1.0 Copyright (C) 2018 Free
Software Foundation, Inc. This is free software; see the source for
copying conditions. There is NO warranty; not even for MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
And manually re-pointed the symbolic links:
$ ll /usr/bin/*g++*
lrwxrwxrwx 1 root root 5 Jun 8 16:57 /usr/bin/g++ -> g++-8*
-rwxr-xr-x 1 root root 919832 Apr 24 15:02 /usr/bin/g++-5*
lrwxrwxrwx 1 root root 22 Jun 6 04:26 /usr/bin/g++-8 -> x86_64-linux-gnu-g++-8*
lrwxrwxrwx 1 root root 22 Jun 8 16:58 /usr/bin/x86_64-linux-gnu-g++ -> x86_64-linux-gnu-g++-8*
lrwxrwxrwx 1 root root 5 Apr 24 15:02 /usr/bin/x86_64-linux-gnu-g++-5 -> g++-5*
-rwxr-xr-x 1 root root 1071984 Jun 6 04:26 /usr/bin/x86_64-linux-gnu-g++-8*
However, I get the following error in the configuration of cmake:
$ sudo ./bootstrap
---------------------------------------------
CMake 3.11.3, Copyright 2000-2018 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc
C++ compiler on this system is: g++
Makefile processor on this system is: make
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
make: Warning: File 'Makefile' has modification time 2.3 s in the future
make: 'cmake' is up to date.
make: warning: Clock skew detected. Your build may be incomplete.
loading initial cache file /mnt/ganymede/user/gpeytavi/srv_admin/software/cmake-3.11.3/Bootstrap.cmk/InitialCacheFlags.cmake
CMake Error at CMakeLists.txt:92 (message):
The C++ compiler does not support C++11 (e.g. std::unique_ptr).
-- Configuring incomplete, errors occurred!
See also "/mnt/ganymede/user/gpeytavi/srv_admin/software/cmake-3.11.3/CMakeFiles/CMakeOutput.log".
See also "/mnt/ganymede/user/gpeytavi/srv_admin/software/cmake-3.11.3/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
Any idea why I get a c++11 std::unique_ptr non-compliant error?
In my case, the issue is because of the folder where I have CMake source code is in a mounted directory (in fact my entire rootfs is mounted over NFS)
So, I looked in 'mount' command output and selected '/run/user/1000' location as a local location as this is mounted using tmpfs and moved my CMake source code to this location.
with this, ./bootstrap && make && sudo make install executed successfully.
Actually the ./bootstrap script does try the different C++ standard flags with the compiler. So it should detect its capabilities automatically.
Please make sure you don't have any CXXFLAGS environment variable set and try from scratch again (the messages/warnings you get indicate several tries/errors in the same directory).
Output when Successful
As a reference on my Ubuntu calling CMake's ./bootstrap looks like this:
---------------------------------------------
CMake 3.11.20180423, Copyright 2000-2018 Kitware, Inc. and Contributors
Warning: This is an in-source build
Found GNU toolchain
C compiler on this system is: gcc
C++ compiler on this system is: g++ -std=gnu++1y
Makefile processor on this system is: make
g++ has setenv
g++ has unsetenv
g++ does not have environ in stdlib.h
g++ has stl wstring
g++ has <ext/stdio_filebuf.h>
---------------------------------------------
Debugging
For debugging your problem you also could:
Call ./bootstrap --verbose
Look into Bootstrap.cmk/cmake_bootstrap.log
Known Problem
I only once had a problem with bootstrap using clang compilers where I needed to do the following call:
export CXXFLAGS=-Xclang -std=c++1z -Xclang -stdlib=libc++
Alternative
If you just want to install the latest version see How to specify where CMake is installed in Ubuntu?
I was able to resolve the issue by ensuring that both the build machine and the NFS file server were synchronized by running ntpd on both.
For me it was clock skew. I use the below command :
date -s "2021-11-30 15:08:21"
to set the time to now for the server. Then it work, thanks...
I am attempting to install the Perl package Math::GMP on OS X El Capitan.
I had one computer where this worked without issue - but a second computer is running into the following problem:
The Perl module Math::GMP requires the C library for GMP, so I have done a brew install gmp
This installed GMP including the following file:
/usr/local/include/gmp.h
But the package install still fails claiming I don't have gmp installed:
$ sudo perl -MCPAN -e shell
cpan[1]> install Math::GMP
Reading '/Users/chaosadmin/.cpan/Metadata'
Database was generated on Sat, 14 Nov 2015 09:17:02 GMT
Running install for module 'Math::GMP'
Checksum for /Users/me/.cpan/sources/authors/id/S/SH/SHLOMIF/Math-GMP-2.11.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring S/SH/SHLOMIF/Math-GMP-2.11.tar.gz with Makefile.PL
Can't link/include C library 'gmp.h', 'gmp', aborting.
No 'Makefile' created SHLOMIF/Math-GMP-2.11.tar.gz
/usr/bin/perl Makefile.PL -- NOT OK
Failed during this command:
SHLOMIF/Math-GMP-2.11.tar.gz : writemakefile NO -- No 'Makefile' created
The obvious line is:
Can't link/include C library 'gmp.h', 'gmp', aborting.
But I definitely have "gmp.h" installed in /usr/local/include/gmp.h
I'm unsure why it's failing to install on this OS X El Capitan machine (it worked fine on my other one).
In the CPAN shell I used:
look Math::GMP
And updated the Makefile.PL to debug:
check_lib_or_exit(
header => 'gmp.h',
lib => 'gmp',
debug => 'true'
);
Which displayed the following error when running perl Makefile.PL
# /usr/bin/cc -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -arch i386 -arch x86_64 -fstack-protector assertlibD4RJzZEa.c -o assertlibwGFzIVsM
assertlibD4RJzZEa.c:1:10: fatal error: 'gmp.h' file not found
include
On Centos :
Just install this : yum install gmp* -y
Good Luck :)
I need get rsync binary with -iconv parameter (>v3.0.0) to OS X Lion (10.7.5) what doesn't have Xcode installed. (The default rsync on OS X is only archaic v2.6.9)
How to compile it from the sources on another computer running Mountain Lion (10.8.4)?
Tried:
export CFLAGS="-arch i386"
./configure
make
the compiled rsync run ok on the 10.8.4 but when copied it to 10.7.5 says:
$ ./rsync
Illegal instruction: 4
not works either:
export CFLAGS="-arch i386 -m32"
./configure
make
Can please someone tell me how to cross-compile the rsync v3.0.9 on OS X 10.8 for 10.7?
My system:
$ uname -a
Darwin jonatan.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
target system
Darwin panda.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:26:45 PDT 2012; root:xnu-1699.32.7~1/RELEASE_I386 i386
Or, have anyone compiled rsync-3.0.9 for OS X 10.7.5 for download? ;)
Just found this question: What is the "Illegal Instruction: 4" error and why does "-mmacosx-version-min=10.x" fix it?
and the
export CFLAGS="-arch i386 -mmacosx-version-min=10.7"
./configure
make
works. :)