PDA

Bekijk de volledige versie : making toolchain fails



!gm
26-03-2012, 13:42
Hi, because I need the swftools http://www.swftools.org I want to build it via the wl500g-repo openwrt buildroot. (thx ryzhov_al)

http://code.google.com/p/wl500g-repo/source/browse/trunk/INSTALL
http://code.google.com/p/wl500g-repo/source/browse/trunk/Makefile

but instead of just make - at first I need to make .toolchain_installed
(I'll do the Makefile steps manually, because of integrating the swftools via this guide: http://wiki.openwrt.org/doc/devel/packages)

the build-system is an ubuntu-virtual machine

ok, a title says the make of toolchain fails:


Build dependency: Please install ncurses. (Missing libncurses.so or ncurses.h)
Build dependency: Please install zlib. (Missing libz.so or zlib.h)


uhmm, I don't know, whats wrong, because I allready have the ncurses and zlib developer-libs:

gm@ubuntu:~/openwrt/rtn$ sudo apt-get install libncurses-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libncurses5-dev' instead of 'libncurses-dev'
libncurses5-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.


and


gm@ubuntu:~/openwrt/rtn$ sudo apt-get install libz-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'zlib1g-dev' instead of 'libz-dev'
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

anyone an Idea?

ryzhov_al
26-03-2012, 14:33
anyone an Idea?Ubuntu, yes? The same bug on my Ubuntu 11.10 x64.

Find ./toolchain-1.9.2.7-rtn-r3988/src/include/prereq-build.mk file and fix these lines:

...
define Require/ncurses
echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
echo -include ncurses.h -x c -o $(TMP_DIR)/a.out -lncurses -
endef

$(eval $(call Require,ncurses, \
Please install ncurses. (Missing libncurses.so or ncurses.h) \
))


define Require/zlib
echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
echo -include zlib.h -x c -o $(TMP_DIR)/a.out -lz -
endef

Yes, i know its dirty hack, but works. I have no time to fix toolchain buildroot script.

BTW, toolchain buildroot is taken from OpenWRT too^)

lly
27-03-2012, 07:26
Ubuntu, yes? The same bug on my Ubuntu 11.10 x64.
...

Yes, i know its dirty hack, but works. I have no time to fix toolchain buildroot script.
To fix it we must know exact error message, can you post it?

Just execute following command in default shell (bash??):

echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
gcc -include ncurses.h -x c -o /tmp/a.out -lncurses -

wpte
27-03-2012, 08:20
the error

/tmp/ccbNsdgJ.o: In function `main':
:(.text+0x10): undefined reference to `initscr'
collect2: ld returned 1 exit status

I ended up with "echo 1", since I knew I had everything correctly installed on my mint box:)

lly
27-03-2012, 08:37
the error

/tmp/ccbNsdgJ.o: In function `main':
:(.text+0x10): undefined reference to `initscr'
collect2: ld returned 1 exit status

It means that libncurses.so library cannot be found by gcc :confused:
Where is it located? OpenSUSE store it in /usr/lib (/usr/lib64)

Is library contains initscr():

readelf -s libncurses.so | grep initscr
?

wpte
27-03-2012, 09:40
yeah, that's the weird thing...
I've had other problems with finding libraries on previous versions of ubuntu's gcc, like libusb.

The current version I have:

gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

libncurses.so is on my 64bit machine just in /lib/


readelf -s /lib/libncurses.so.5 | grep initscr
399: 000000000000c6d0 179 FUNC GLOBAL DEFAULT 11 initscr

the packages I use: http://packages.ubuntu.com/search?keywords=libncurses5&searchon=names&suite=oneiric&section=all
you can just open the deb files with an archive manager:)

In the end, all other programs I've compiled so far, including some other toolchains for my uni projects did find ncurses without any problem :)

lly
27-03-2012, 11:06
yeah, that's the weird thing...
I've had other problems with finding libraries on previous versions of ubuntu's gcc, like libusb.
All seems to be ok, but gcc can't find library...
I can't imagine whats wrong in such simple test-case. Have you another gcc version installed, 4.5.3 or 4.6.3 for example?


In the end, all other programs I've compiled so far, including some other toolchains for my uni projects did find ncurses without any problem :)
Probably, they seek for library path via package manager. But I'm not sure.

wpte
27-03-2012, 11:16
All seems to be ok, but gcc can't find library...
I can't imagine whats wrong in such simple test-case. Have you another gcc version installed, 4.5.3 or 4.6.3 for example?


Probably, they seek for library path via package manager. But I'm not sure.

I have only 1 gcc installed, and some toolchains, but those have different names obviously, so shouldn't intefere:)

I could look in some ./configure scripts perhaps? to find out how they test it?

lly
27-03-2012, 11:29
I have only 1 gcc installed, and some toolchains, but those have different names obviously, so shouldn't intefere:)
Actually, gcc 4.6.1 is unstable. I suspect that compiler incorrectly processes options passed. If you have extra time, you can play with "-include ncurses.h" & "-x c", take source from filesystem rather than stdin, reorder gcc options.


I could look in some ./configure scripts perhaps? to find out how they test it?
For now I'm not ready to migrate from simple checks to huge autoconf/automake scripts.

ryzhov_al
27-03-2012, 12:19
If you have extra time, you can play with "-include ncurses.h" & "-x c", take source from filesystem rather than stdin, reorder gcc options.Yes, you are right again^)

$ echo 'int main(int argc, char **argv) { initscr(); return 0; }' > ./ncurses_test.c
$ gcc -include ncurses.h -x c ./ncurses_test.c -o /tmp/a.out -lncurses
runs without any issues.

lly
27-03-2012, 13:45
runs without any issues.
Well, if wpte confirm that solution too, we will modify prereq-build.mk

P.S. I suspect that autoconf creators know about this issue - configure script always create "conftest.c" file.

!gm
27-03-2012, 14:00
Yes, you are right again^)

$ echo 'int main(int argc, char **argv) { initscr(); return 0; }' > ./ncurses_test.c
$ gcc -include ncurses.h -x c ./ncurses_test.c -o /tmp/a.out -lncurses
runs without any issues.


same here.

Ubuntu 11.10 (GNU/Linux 3.0.0-17-generic i686)

wpte
27-03-2012, 16:25
Well, if wpte confirm that solution too, we will modify prereq-build.mk

P.S. I suspect that autoconf creators know about this issue - configure script always create "conftest.c" file.

I use mint 12, they use the very same deb repository as ubuntu does:)
so yeah, it works (I even tested it:D)
mint just has a slightly better interface:)

so what about zlib? same solution?

lly
28-03-2012, 17:05
so what about zlib? same solution?
Hope, yes. Please try r4014 (http://code.google.com/p/wl500g/source/detail?r=4014)

!gm
28-03-2012, 17:39
Hope, yes. Please try r4014 (http://code.google.com/p/wl500g/source/detail?r=4014)

tonight - after Champions League :cool:


edit: nah got some time now... wait a minute



Compiling toolchain, revision r4014...
make -C "../../toolchain-1.9.2.7-rtn-r4014/src" V=99
make[2]: Entering directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4014/src'
make[2]: Leaving directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4014/src'
make[2]: Entering directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4014/src'
make[3]: Entering directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4014/src'
Checking 'working-make'... ok.
Checking 'case-sensitive-fs'... ok.
Checking 'working-gcc'... ok.
Checking 'working-g++'... ok.
Checking 'ncurses'... failed.
Checking 'zlib'... failed.


nope :(

after checkout rtn I altered config.mk to match the reversion

TOOLCHAIN_REVISION:=r4014
FIRMWARE_REVISION:=r4014

it was tested via make .toolchain_installed

lly
28-03-2012, 18:11
nope :(

Strange, I implement nearly same solution that you confirmed working... The single difference in arguments order!

Can you try:

echo 'int main(int argc, char **argv) { initscr(); return 0; }' > ./ncurses_test.c
gcc -include ncurses.h -x c -o /tmp/a.out -lncurses ./ncurses_test.c
?
it should fail for you.

wpte
28-03-2012, 22:11
yeah same error:(

!gm
29-03-2012, 05:45
Strange, I implement nearly same solution that you confirmed working... The single difference in arguments order!

Can you try:

echo 'int main(int argc, char **argv) { initscr(); return 0; }' > ./ncurses_test.c
gcc -include ncurses.h -x c -o /tmp/a.out -lncurses ./ncurses_test.c
?
it should fail for you.

yes


undefined reference to `initscr'

lly
29-03-2012, 17:17
Ok, next approach - please try r4029

!gm
29-03-2012, 18:33
ok, the zlib and ncurses issue seems to be resolved...

but, whats this?
the kernel??

make: *** /home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src/build_dir/toolchain-mipsel_gcc4.5.3/linux-2.6.22.19: No such file or directory. Stop.
make[5]: *** [/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src/build_dir/toolchain-mipsel_gcc4.5.3/linux-2.6.22.19/.prepared3067c836db47c9f5293c09032749151d] Error 2
make[5]: Leaving directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src/toolchain/kernel-headers'
make[4]: *** [toolchain/kernel-headers/prepare] Error 2
make[4]: Leaving directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src'
make[3]: *** [/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src/staging_dir/mipsel/stamp/.toolchain_install] Error 2
make[3]: Leaving directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src'
make[2]: *** [world] Error 2
make[2]: Leaving directory `/home/gm/openwrt/toolchain-1.9.2.7-rtn-r4029/src'
make[1]: *** [.toolchain_compiled] Error 2
make[1]: Leaving directory `/home/gm/openwrt/rtn/toolchain'
make: *** [.toolchain_installed] Error 2

wpte
29-03-2012, 18:40
ok, the zlib and ncurses issue seems to be resolved...

but, whats this?
the kernel??

Try with

make V=99

for more debug info :)

!gm
30-03-2012, 15:50
Try with

make V=99

hmmmm, I've done this... but


gm@ubuntu:/$ sudo find -name build.log
[sudo] password for gm:
gm@ubuntu:/$

:(

lly
30-03-2012, 17:00
!gm
Not all scripts, imported from OpenWRT, produces detailed log. Seems that you have invalid path to kernel source(patched) - check CONFIG_EXTERNAL_KERNEL_TREE in toolchain .config

!gm
02-04-2012, 20:17
Hi, I'm back

hmmm

after a general make - the toolchain and the buildroot seems to be correctly installed :eek:

(it stopped at a package, because of a missing perl dependency on my system...)

i now just do a
make package/swftools/compile V=99 in openwrt/trunk to compile the package from my custom-feed

the dependencies compile well, but...


make[2]: Entering directory `/home/gm/custom-feed/swftools'
mkdir -p /home/gm/openwrt/trunk/dl
/home/gm/openwrt/trunk/scripts/download.pl "/home/gm/openwrt/trunk/dl" "swftools-0.9.1.tar.gz" "72dc4a7bf5cdf98c28f9cf9b1d8f5d7a" "http://swftools.org/"
--2012-04-02 20:41:07-- http://swftools.org/swftools-0.9.1.tar.gz
Resolving swftools.org... 78.46.32.74
Connecting to swftools.org|78.46.32.74|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2649789 (2.5M) [application/octet-stream]
Saving to: `STDOUT'

100%[================================================== ================================================== ==========================>] 2,649,789 1.05M/s in 2.4s

2012-04-02 20:41:09 (1.05 MB/s) - written to stdout [2649789/2649789]

. /home/gm/openwrt/trunk/include/shell.sh; gzip -dc /home/gm/openwrt/trunk/dl/swftools-0.9.1.tar.gz | /bin/tar -C /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/.. -xf -
touch /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/.prepared_95eda5cdc0bd0dda6b82f72e555bfbb6
(cd /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/./; if [ -x ./configure ]; then /usr/bin/find /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/ -name config.guess | xargs -r chmod u+w; /usr/bin/find /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/ -name config.guess | xargs -r -n1 cp /home/gm/openwrt/trunk/scripts/config.guess; /usr/bin/find /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/ -name config.sub | xargs -r chmod u+w; /usr/bin/find /home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/ -name config.sub | xargs -r -n1 cp /home/gm/openwrt/trunk/scripts/config.sub; AR=mipsel-uclibc-ar AS="mipsel-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32" LD=mipsel-uclibc-ld NM=mipsel-uclibc-nm CC="mipsel-uclibc-gcc" GCC="mipsel-uclibc-gcc" CXX="mipsel-uclibc-g++" RANLIB=mipsel-uclibc-ranlib STRIP=mipsel-uclibc-strip OBJCOPY=mipsel-uclibc-objcopy OBJDUMP=mipsel-uclibc-objdump SIZE=mipsel-uclibc-size CFLAGS="-Os -pipe -mips32 -mtune=mips32 " CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 " CPPFLAGS="-I/home/gm/openwrt/trunk/staging_dir/target-mipsel-linux-gnu/opt/include -I/home/gm/openwrt/trunk/staging_dir/target-mipsel-linux-gnu/include -I/opt/brcm/hndtools-mipsel-uclibc/include " LDFLAGS="-L/home/gm/openwrt/trunk/staging_dir/target-mipsel-linux-gnu/opt/lib -L/home/gm/openwrt/trunk/staging_dir/target-mipsel-linux-gnu/lib -Wl,--dynamic-linker=/opt/lib/ld-uClibc.so.0 -Wl,-rpath,/opt/lib -L/opt/brcm/hndtools-mipsel-uclibc/lib " ./configure --target=mipsel-linux-gnu --host=mipsel-linux-gnu --build=i686-linux-gnu --program-prefix="" --program-suffix="" --prefix=/opt --exec-prefix=/opt --bindir=/opt/bin --sbindir=/opt/sbin --libexecdir=/opt/lib --sysconfdir=/opt/etc --datadir=/opt/share --localstatedir=/opt/var --mandir=/opt/man --infodir=/opt/info --disable-nls --prefix=/opt ; fi; )
configure: WARNING: unrecognized options: --disable-nls
configure: loading site script /home/gm/openwrt/trunk/include/site/mipsel-linux-gnu
checking build system type... i686-pc-linux-gnu
checking host system type... mipsel-unknown-linux-gnu
checking for mipsel-linux-gnu-gcc... mipsel-uclibc-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether mipsel-uclibc-gcc accepts -g... yes
checking for mipsel-uclibc-gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether mipsel-uclibc-g++ accepts -g... yes
checking whether gcc supports lazy variable declaration... yes
checking how to run the C preprocessor... mipsel-uclibc-gcc -E
checking for mipsel-linux-gnu-ranlib... mipsel-uclibc-ranlib
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for gzip... gzip
checking host system type... (cached) mipsel-unknown-linux-gnu
checking for target system...
checking for sin in -lm... yes
checking for deflate in -lz... yes
checking for PDF_open_file in -lpdf... no
checking for jpeg_write_raw_data in -ljpeg... yes
checking for DGifOpen in -lungif... no
checking for DGifOpen in -lgif... no
checking for zzip_file_open in -lzzip... no
checking for byte order... we are cross compiling- trying to guess from system type
checking target system type... mipsel-unknown-linux-gnu
checking for byte order, try 2... unknown
Byte order could not determined.
make[2]: *** [/home/gm/openwrt/trunk/build_dir/target-mipsel-linux-gnu/swftools-0.9.1/.configured_] Error 1
make[2]: Leaving directory `/home/gm/custom-feed/swftools'
make[1]: *** [package/feeds/rtncustom/swftools/compile] Error 2
make[1]: Leaving directory `/home/gm/openwrt/trunk'
make: *** [package/swftools/compile] Error 2

anyone an idea, how to overcome the byte order detection?

I've attached the provisional Makefile.

!gm
03-04-2012, 12:39
ok, I added our target-architecture to the byte order-check in the configure script. (I know we are citizens of Lilliput ;) )

but compiling stops later... its a loong long way :o

ryzhov_al
03-04-2012, 12:57
ok, I added our target-architecture to the byte order-check in the configure script. (I know we are citizens of Lilliput ;) )Too complicated. Just give a hint to ./configure script:

...
CONFIGURE_VARS += \
LITTLEENDIAN=1
...

!gm
03-04-2012, 13:06
yeah, read the mailinglist, but wasn't sure, where to put that :D
than i got deeper

ryzhov_al
11-04-2012, 17:44
Strange, I implement nearly same solution that you confirmed working...yeah same error:(
Ok, next approach - please try r4029Tried (http://code.google.com/p/wl500g-repo/source/browse/trunk/config.mk?spec=svn494&r=494) r4086, everything is fine. A toolchain compilations on Ubuntu 11.10 is working.