You are not logged in.

#1 2016-05-08 08:59:00

marcthe12
Member
From: Singapore
Registered: 2016-05-08
Posts: 5

configure scripts in PKGbuild not reconizing limits.h

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

#2 2016-05-08 11:08:18

mis
Member
Registered: 2016-03-16
Posts: 234

Re: configure scripts in PKGbuild not reconizing limits.h

Could you post the PKGBUILD and error message, please?
Makes it easier to help you. wink

Offline

#3 2016-05-09 05:53:21

marcthe12
Member
From: Singapore
Registered: 2016-05-08
Posts: 5

Re: configure scripts in PKGbuild not reconizing limits.h

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

#4 2016-05-09 10:12:48

mis
Member
Registered: 2016-03-16
Posts: 234

Re: configure scripts in PKGbuild not reconizing limits.h

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

#5 2016-05-09 10:29:18

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: configure scripts in PKGbuild not reconizing limits.h

Look at how it is handled in the Arch binutils PKGBUILD.

Offline

#6 2016-05-10 10:29:39

marcthe12
Member
From: Singapore
Registered: 2016-05-08
Posts: 5

Re: configure scripts in PKGbuild not reconizing limits.h

Thamk you mis. I now works, even with clang

@Allan
I did use mingw-w64-binutils as a reference

Offline

#7 2016-05-10 11:27:36

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,385
Website

Re: configure scripts in PKGbuild not reconizing limits.h

marcthe12 wrote:

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

#8 2016-05-10 11:39:07

mis
Member
Registered: 2016-03-16
Posts: 234

Re: configure scripts in PKGbuild not reconizing limits.h

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

#9 2016-05-11 04:07:06

marcthe12
Member
From: Singapore
Registered: 2016-05-08
Posts: 5

Re: configure scripts in PKGbuild not reconizing limits.h

@Allan Yes I mistook that for the removal of cflags for removal of libiberty tongue

Last edited by marcthe12 (2016-05-11 04:07:43)

Offline

Board footer

Powered by FluxBB