You are not logged in.
Hello
I have tried to make a cross compile package of binutils with libiberty but it is failing. When I configure it using makepkg/PKGBUILD limits.h is not found and there creates build errors. But if I build it using ./configure it work. All options are the same
Offline
Could you post the PKGBUILD and error message, please?
Makes it easier to help you.
Offline
PKGBUILD
_targets="i686-elf"
pkgname=osdev-binutils
pkgver=2.26
pkgrel=1
pkgdesc="Cross binutils for the Osdev cross-compiler"
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/binutils"
license=('GPL')
groups=('osdev-toolchain')
depends=('zlib')
options=('!libtool' '!emptydirs')
source=("http://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.gz")
md5sums=('d66e2b663757cbf5d4b060feb4ef6b4b')
build() {
for _target in $_targets; do
msg "Building ${_target} cross binutils"
mkdir -p ${srcdir}/binutils-${_target} && cd "${srcdir}/binutils-${_target}"
$srcdir/binutils-${pkgver}/configure --prefix=/usr \
--target=${_target} \
--with-sysyroot\
--disable-nls \
--disable-werror
make
done
}
package() {
for _target in ${_targets}; do
msg "Installing ${_target} cross binutils"
cd ${srcdir}/binutils-${_target}
make DESTDIR=${pkgdir} install
rm -r ${pkgdir}/{info ,man}
done
}
Output when makepkg 2>mkpkg.log
==> Making package: osdev-binutils 2.26-1 (Mon May 9 12:25:32 SGT 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found binutils-2.26.tar.gz
==> Validating source files with md5sums...
binutils-2.26.tar.gz ... Passed
==> Extracting sources...
-> Extracting binutils-2.26.tar.gz with bsdtar
==> Removing existing $pkgdir/ directory...
==> Starting build()...
==> Building i686-elf cross binutils
*** removing intl/Makefile to force reconfigure
*** removing libiberty/Makefile to force reconfigure
*** removing bfd/Makefile to force reconfigure
/home/marc/abs/mingw-w64-binutils/src/binutils-2.26/libiberty/fibheap.c:220:30: error: use of undeclared identifier 'LONG_MIN'
if (okey == key && okey != FIBHEAPKEY_MIN)
^
/home/marc/abs/mingw-w64-binutils/src/binutils-2.26/libiberty/fibheap.c:38:24: note: expanded from macro 'FIBHEAPKEY_MIN'
#define FIBHEAPKEY_MIN LONG_MIN
^
/home/marc/abs/mingw-w64-binutils/src/binutils-2.26/libiberty/fibheap.c:261:36: error: use of undeclared identifier 'LONG_MIN'
fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
^
/home/marc/abs/mingw-w64-binutils/src/binutils-2.26/libiberty/fibheap.c:38:24: note: expanded from macro 'FIBHEAPKEY_MIN'
#define FIBHEAPKEY_MIN LONG_MIN
^
2 errors generated.
make[2]: *** [fibheap.o] Error 1
make[1]: *** [all-libiberty] Error 2
make: *** [all] Error 2
==> ERROR: A failure occurred in build().
Aborting...
It works when runing config and make manually. The config option are same
Some personal dignostics:
limit.h is not found with makepkg is run
But is found with make is run
The out come should be the result of this tutorial
Last edited by marcthe12 (2016-05-09 07:00:43)
Offline
Add !buildflags to options or put CPPFLAGS='' in build() function.
Seems CPPFLAGS=-DCPPFLAGS="-D_FORTIFY_SOURCE=2" set in makepkg.conf is the reason for the error.
Works with this here
build() {
# overwrite settings from makepkg.conf
# build fails with CPPFLAGS=-D_FORTIFY_SOURCE=2
CPPFLAGS=''
for _target in $_targets; do
msg "Building ${_target} cross binutils"
mkdir -p "${srcdir}/binutils-${_target}" && cd "${srcdir}/binutils-${_target}"
$srcdir/binutils-${pkgver}/configure --prefix=/usr \
--target=${_target} \
--with-sysyroot\
--disable-nls \
--disable-werror
make
done
}
edit: corrected typo
Last edited by mis (2016-05-09 10:13:46)
Offline
Look at how it is handled in the Arch binutils PKGBUILD.
Offline
Thamk you mis. I now works, even with clang
@Allan
I did use mingw-w64-binutils as a reference
Offline
Thamk you mis. I now works, even with clang
@Allan
I did use mingw-w64-binutils as a reference
Then you would have seen
# hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
Offline
I think Allan meant this
# hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
edit: too late ..
Last edited by mis (2016-05-10 11:39:55)
Offline
@Allan Yes I mistook that for the removal of cflags for removal of libiberty
Last edited by marcthe12 (2016-05-11 04:07:43)
Offline