Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: no readelf found #138

Closed
mfr69bs opened this issue Jun 20, 2012 · 19 comments
Closed

ERROR: no readelf found #138

mfr69bs opened this issue Jun 20, 2012 · 19 comments
Labels
request request for new package

Comments

@mfr69bs
Copy link

mfr69bs commented Jun 20, 2012

while running configure, i've got this error:

Checking for C compiler ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc ()
Checking for linker ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld ()
Checking for ar ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ar ()
Checking for ranlib ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib ()
Checking for readelf ... none found
ERROR: no readelf found
Checking for objdump ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump ()
ERROR: configure --mode=target failed
@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

It seems you are not on a Debian x86 VM, please check the requirements to spksrc.

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

you are wrong ;-)

uname -a
Linux debian 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux

in a vm on

uname -a
Linux matrix 3.2.0-25-generic-pae #40-Ubuntu SMP Wed May 23 22:11:24 UTC 2012 i686 i686 i386 GNU/Linux

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

it seems readelf is missing in TC_ENV:

TC_ENV :=
TC_ENV += LD=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld
TC_ENV += CPP=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-cpp
TC_ENV += NM=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-nm
TC_ENV += CC=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
TC_ENV += AS=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-as
TC_ENV += RANLIB=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib
TC_ENV += CXX=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
TC_ENV += AR=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ar
TC_ENV += STRIP=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-strip
TC_ENV += OBJDUMP=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump

if i add readelf to TOOLS in spksrc.tc.mk like:
TOOLS = ld cpp nm cc:gcc as ranlib cxx:g++ ar strip objdump readelf
the file tc_vars.mk in $(WORK_DIR) seems to be ok:

TC_ENV :=
TC_ENV += LD=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld
TC_ENV += CPP=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-cpp
TC_ENV += NM=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-nm
TC_ENV += CC=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
TC_ENV += AS=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-as
TC_ENV += RANLIB=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib
TC_ENV += CXX=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
TC_ENV += AR=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ar
TC_ENV += STRIP=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-strip
TC_ENV += OBJDUMP=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump
TC_ENV += READELF=/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-readelf

the file exists:

-rwxr-xr-x 1 administrator administrator 241508 Feb 26  2008 /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-readelf

but i've got the error again:

Checking for readelf ... none found
ERROR: no readelf found
Checking for objdump ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump ()
ERROR: configure --mode=target failed

any ideas?

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

next try:

if i remove --target-tools-prefix=arm-none-linux-gnueabi- from CONFIGURE_ARGS, it seems readelf would be found:

Checking for C compiler ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc ()
Checking for linker ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld ()
Checking for ar ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ar ()
Checking for ranlib ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib ()
Checking for readelf ... readelf
Checking for objdump ... /root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump ()
Checking for GNU cc in disguise and/or its version number ... gcc ver. 4.2.1

but readelf seems to be from build-host (no path to toolchain binary) and not from toolchain :-(

@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

http://en.wikipedia.org/wiki/Executable_and_Linkable_Format

"Unlike many proprietary executable file formats, ELF is flexible and extensible, and it is not bound to any particular processor or architecture."

Have you installed build-essentials on your Debian ? I think readelf is part of it.

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

yes, you are right! but this could only a work-around, because the toolchain contains a readelf, which should be used.

@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

What are you trying to compile so I give it a shot?

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

maybe the hardest software to cross-compile: perl :-)

i can compile it in my own environment. actually i use perl-5.14.2 with perlcross from berlios. the following script works for me and i want to switch to spksrc as a new environment.

#!/bin/bash
echo "Cross compile perl for synology"
echo ""
echo "Change to buildroot..."
cd ~/src/synology/build/perl/
echo ""

PATH=$PATH:/usr/local/arm-none-linux-gnueabi/bin/
CROSS_COMPILE=arm-none-linux-gnueabi-

export PATH
export CROSS_COMPILE

echo -n "remove old sources..."
rm -rf perl-5.14.2
echo " done"
echo -n "unpacking perl archiv..."
tar xzf perl-5.14.2.tar.gz
echo " done"
echo -n "unpacking perl-cross archiv..."
tar xzf perl-5.14.2-cross-0.6.5.tar.gz
cp miniperl_top perl-5.14.2
echo " done"
echo -n "copy CPAN modules..."
MODULES="Device-SerialPort Encode-Locale File-Listing HTML-Form HTML-Parser HTTP-Cookies HTTP-Daemon HTTP-Date HTTP-Message HTTP-Negotiate libwww-perl Lirc-Client LWP-MediaTypes LWP-Protocol-https Net-HTTP NTLM OWNet PathTools podlators Switch URI XML-Simple WWW-RobotRules XSLoader IO-Socket-SSL Net-SSLeay Scalar-List-Utils"
for MODULE in $MODULES; do
  cp -dpR ./cpan/${MODULE} ./perl-5.14.2/cpan
done
echo " done"

echo ""
echo "change to sources, ready for run..."
cd perl-5.14.2

./configure --prefix=/usr/local/perl5 \
-Dprefix='/usr/local/perl5' \
-Dhtml1dir='/usr/local/perl5/share/doc/perl5/html' \
-Dhtml3dir='/usr/local/perl5/share/doc/perl5/html' \
-Dman1dir='/usr/local/perl5/share/man/man1' \
-Dman3dir='/usr/local/perl5/share/man/man3' \
-Darchlib='/usr/local/perl5/lib/perl5/5.14.2' \
-Dbin='/usr/local/perl5/bin' \
-Dprivlib='/usr/local/perl5/share/perl5/5.14.2' \
-Dscript='/usr/local/perl5/bin' \
-Dcf_by='Martin Fischer' \
--target=arm-none-linux-gnueabi --target-tools-prefix=arm-none-linux-gnueabi-

make

echo ""
echo "build completed. Check for errors! otherwise install with"
echo "make DESTDIR=~/src/synology/build/perl/target install"
echo ""
echo "have a nice day ;-)"
exit 0

my extended miniperl_top:

#!/bin/bash

# This script can be used to run Makefile.PL 
# Note that is relies on $0 to tell where lib/ is; typically
#   you should call it as ../../miniperl_top
# This script replaces lib/buildcustomize.pl functionality
# Check write_buildcustomize.pl for the list of modules to include here

top=`dirname "$0"`
if [ -f $top/lib/buildcustomize.pl ]; then
        # buildcustomize.pl silently overrides all -I options below
        echo "Remove $top/lib/buildcustomize.pl before running miniperl_top" >&2
        exit 1
fi
exec $top/miniperl\
        -I$top/lib\
        -I$top/cpan/AutoLoader/lib\
        -I$top/dist/Cwd -I$top/dist/Cwd/lib\
        -I$top/dist/ExtUtils-Command/lib\
        -I$top/dist/ExtUtils-Install/lib\
        -I$top/cpan/ExtUtils-MakeMaker/lib\
        -I$top/dist/ExtUtils-Manifest/lib\
        -I$top/cpan/File-Path/lib\
        -I$top/ext/re\
        -I$top/cpan/ExtUtils-Constant/lib\
        -I$top/dist/ExtUtils-ParseXS/lib\
        -I$top/dist/constant/lib\
        -I$top/cpan/Getopt-Long/lib\
        -I$top/cpan/Text-Tabs/lib\
        -I$top/cpan/List-Util/lib\
        -I$top/cpan/Digest-MD5\
        -I$top/cpan/MIME-Base64\
        -I$top/dist/IO/lib\
        -I$top/cpan/Encode -I$top/cpan/Encode/lib\
        -I$top/cpan/URI\
        -I$top/cpan/LWP-MediaTypes/lib\
        -I$top/cpan/LWP-Protocol-https/lib\
        -I$top/cpan/HTML-Parser -I$top/cpan/HTML-Parser/lib\
        -I$top/cpan/HTML-Form/lib\
        -I$top/cpan/HTTP-Cookies/lib\
        -I$top/cpan/HTTP-Daemon/lib\
        -I$top/cpan/HTTP-Date/lib\
        -I$top/cpan/HTTP-Message/lib\
        -I$top/cpan/HTTP-Negotiate/lib\
        -I$top/cpan/Net-HTTP/lib\
        -I$top/cpan/Net-SSLeay/lib\
        -I$top/cpan/NTLM\
        -I$top/cpan/podlators/lib\
        -I$top/dist/base/lib\
        -I$top/cpan/File-Listing/lib\
        -I$top/cpan/Encode-Locale/lib\
        -I$top/cpan/Scalar-List-Utils/lib\
        -I$top/cpan/WWW-RobotRules/lib\
        -I$top/cpan/XSLoader\
        "$@"

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

as i wrote before: when --target-tools-prefix=arm-none-linux-gnueabi- is removed from CONFIGURE_ARGS it starts compling (with the readelf from build-host).

but it fails on new erros:

make -C cpan/List-Util/ all PERL_CORE=1 LIBPERL=libperl.a
make[3]: Entering directory `/root/spksrc/cross/perl/work-88f6281/perl-5.14.2/cpan/List-Util'
cp lib/List/Util/XS.pm ../../lib/List/Util/XS.pm
cp lib/Scalar/Util/PP.pm ../../lib/Scalar/Util/PP.pm
cp lib/List/Util/PP.pm ../../lib/List/Util/PP.pm
cp lib/List/Util.pm ../../lib/List/Util.pm
cp lib/Scalar/Util.pm ../../lib/Scalar/Util.pm
../../miniperl_top "-I../../lib" "-I../../lib" ../../lib/ExtUtils/xsubpp  -typemap ../../lib/ExtUtils/typemap  ListUtil.xs > ListUtil.xsc && mv ListUtil.xsc ListUtil.c
/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc -c   -I/root/spksrc/cross/perl/work-88f6281/install//usr/local/include    -DVERSION=\"1.23\" -DXS_VERSION=\"1.23\" -fPIC "-I../.."  -DPERL_EXT ListUtil.c
Running Mkbootstrap for List::Util ()
chmod 644 Util.bs
rm -f ../../lib/auto/List/Util/Util.so
/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld  -L/root/spksrc/cross/perl/work-88f6281/install//usr/local/lib ListUtil.o  -o ../../lib/auto/List/Util/Util.so       \
                \

/root/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: warning: cannot find entry symbol _start; defaulting to 00008094
ListUtil.o: In function `XS_List__Util_min':
ListUtil.c:(.text+0x390): undefined reference to `__aeabi_ui2d'
ListUtil.c:(.text+0x3b0): undefined reference to `__aeabi_i2d'
ListUtil.c:(.text+0x408): undefined reference to `Perl_sv_2nv_flags'
...

and so on...

make[3]: *** [../../lib/auto/List/Util/Util.so] Error 1
make[3]: Leaving directory `/root/spksrc/cross/perl/work-88f6281/perl-5.14.2/cpan/List-Util'
make[2]: *** [cpan/List-Util/pm_to_blib] Error 2
make[2]: Leaving directory `/root/spksrc/cross/perl/work-88f6281/perl-5.14.2'
make[1]: *** [compile_target] Error 2
make[1]: Leaving directory `/root/spksrc/cross/perl'
make: *** [arch-88f6281] Error 2

all described errors in this issue does not occur in my environment. at the moment i'm at the end of the road :-(

@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

Well I don't know why the configure script doesn't pick the good one but really that's no big deal. Maybe look into the script and hack some stuff or find a way to pass the good variable that will override the detected "readelf" as it seems that READELF doesn't work.

You should convert your scripts to makefile targets within the Makefile of "perl". There are several places where you can put your targets : (PRE|POST)_(CONFIGURE|COMPILE|INSTALL)_TARGET = myTarget
There are more possibilities but those are the common ones.

Does it work with the readelf from your local system? Can you cross compile perl?

@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

I don't know what was your previous process but some stuff is overriden in SPKSRC : environment variables. Try to erase some targets and write them by hand without the $(RUN) so that TC_ENV isn't evaluated.

COMPILE_TARGET = myCompile
myCompile:
    make

and so on

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

yes, i can cross compile perl in my environment. i provide also a ready-build spk on my homepage (search for "perl mfr spk" on google ;-) ). i need a newer perl on synology for an other open source project im working for. these project need some cpan stuff, that missed at original synology perl. I dont want impose optware to the users.

actually my Makefile within spksrc looks like:

PKG_NAME = perl
PKG_VERS = 5.14.2
PKG_EXT = tar.gz
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://www.cpan.org/src/5.0
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS =

HOMEPAGE = http://www.perl.org/
COMMENT  = A highly capable, feature-rich programming language
LICENSE  =

GNU_CONFIGURE = 1
CONFIGURE_ARGS  = --prefix=/usr/local/perl5
CONFIGURE_ARGS += --html1dir='/usr/local/perl5/share/doc/perl5/html'
CONFIGURE_ARGS += --html3dir='/usr/local/perl5/share/doc/perl5/html'
CONFIGURE_ARGS += --man1dir='/usr/local/perl5/share/man/man1'
CONFIGURE_ARGS += --man3dir='/usr/local/perl5/share/man/man3'
CONFIGURE_ARGS += --target=arm-none-linux-gnueabi
#CONFIGURE_ARGS += --target-tools-prefix=arm-none-linux-gnueabi-
CONFIGURE_ARGS += -Darchlib='/usr/local/perl5/lib/perl5/5.14.2'
CONFIGURE_ARGS += -Dbin='/usr/local/perl5/bin'
CONFIGURE_ARGS += -Dprivlib='/usr/local/perl5/share/perl5/5.14.2'
CONFIGURE_ARGS += -Dscript='/usr/local/perl5/bin'
CONFIGURE_ARGS += -Dcf_by='Martin Fischer'

CONFIGURE_TARGET = myConfigure

include ../../mk/spksrc.cross-cc.mk

CROSS_COMPILE=$(shell echo $(ENV) | sed 's/ /\n/g' | sed -n -e 's/CC=\(.*-\)gcc/\1/p')

.PHONY: myConfigure
myConfigure:
        tar -C $(WORK_DIR) -xzf src/perl-5.14.2-cross-0.6.5.tar.gz
        $(RUN) CROSS_COMPILE=$(CROSS_COMPILE) PATH=$(INSTALL_DIR)/$(INSTALL_PREFIX)/bin/:$(PATH) ./configure $(REAL_CONFIGURE_ARGS)

@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

As I said, get rid of $(RUN) and create a target that can reproduce the exact same environment as you have (without all the TC_ENV variables defined). I think maybe the original CC (from host) is needed to do some native compilation in the process. Environment variables could maybe set certain values on variables that do not belong here.

Also, do not hesitate to join #synocommunity on Freenode

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

ok.. thanks for now.. i will give it a try...

last question:
if i do my own target, do i need the including of spksrc.cross-cc.mk or anything else?

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

another last question: :-)
is there an global variable for the toolchain directory (including bin, libs, include, etc...)?

@Diaoul
Copy link
Member

Diaoul commented Jun 20, 2012

By target I just meant redefine the compile and install targets just as you did with the configure target.
If you do not use $(RUN) you will have to cd in the good dir yourself and set up environment variables.

Override CONFIGURE_TARGET, COMPILE_TARGET and INSTALL_TARGET and put the same stuff as you do within your env.

As for the paths, don't worry about that just now and hardcode them. You'll replace with the dynamic ones later on when you make a successful build :)

@mfr69bs
Copy link
Author

mfr69bs commented Jun 20, 2012

ok.. thanks again..

@Diaoul
Copy link
Member

Diaoul commented Jun 24, 2012

Any news on that? Good luck.

@Diaoul Diaoul closed this as completed Jun 25, 2012
@mfr69bs
Copy link
Author

mfr69bs commented Jun 28, 2012

no, not yet. i had to switch back to my own environment, because i had to fix a bug in my perl-package for the other open source project i am working on.

so it's ok, to close this issue at this moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request request for new package
Projects
None yet
Development

No branches or pull requests

2 participants