DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-07-26 22:08:20

noodle
Member
Registered: 2007-07-13
Posts: 62

A little help on crosstools

Hi Guys

I'm trying to build apcupsd for DNS-323 in crosstools environment (Fonz 0.3 environment), configuration is fine, but it require "arm-linux-uclibc-g++" to build it which I cannot found. I tried to create symbol link from arm-linux-uclibc-gcc, it doesn't work. Do anybody know where is g++ for crosstools?

thanks

noodle

Offline

 

#2 2007-07-27 00:24:02

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: A little help on crosstools

How did you build the cross-compiler? Used the wiki instructions or my fw103-scripts? Not sure about the wiki-version, but my scripts won't build the c++ compiler. You can verify by running

Code:

tp@motte:/opt/dns323/fw103$ arm-linux-uclibc-gcc -v
Reading specs from /home/tp/bob/fw103-0.2/crosstools/gcc-3.3.x/toolchain_arm/lib/gcc-lib/arm-linux-uclibc/3.3.3/specs
Configured with: /home/tp/bob/fw103-0.2/crosstools/gcc-3.3.x/toolchain_build_arm/gcc-3.3.3/configure --prefix=/home/tp/bob/fw103-0.2/crosstools/gcc-3.3.x/toolchain_arm --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c --disable-shared --includedir=/home/tp/bob/fw103-0.2/crosstools/gcc-3.3.x/toolchain_arm/arm-linux-uclibc/include --with-sysroot=/home/tp/bob/fw103-0.2/crosstools/gcc-3.3.x/toolchain_build_arm/uClibc_dev/ --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-multilib
Thread model: posix
gcc version 3.3.3

Search for enable-languages. I my case, it shows only c: "--enable-languages=c". In fact, the toolchain build is incomplete, and it should have built another cross-compiler with support for both c and c++. Though, I haven't investigated this, yet.

Offline

 

#3 2007-07-27 03:44:36

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

I'm using your script. looks like c++ is not build. wiki version build all, I'm rebuilding it by following wiki version now.

Looks like missing gcc-3.3.3-final.

Last edited by noodle (2007-07-27 04:04:26)

Offline

 

#4 2007-07-27 20:13:22

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

Figure it out, fonz. You missed one patch file: gcc-uclibc-3.3-121-softfloat.patch. So the crosstools.sh didn't finished successfully.

And it works with gcc 34 only, not gcc 4. So, on Fedora system, I installed compat-gcc-34, and export CC=gcc34

Code:

# Dimitry Andric <dimitry@andric.com>, 2004-05-01
#
# * Removed the extra -lfloat option from LIBGCC_SPEC, since it isn't needed
#   anymore.  (The required functions are now in libgcc.)
#
# Fixes errors like
# arm-softfloat-linux-gnu/3.4.0/../../../../arm-softfloat-linux-gnu/bin/ld: cannot find -lfloat
# collect2: ld returned 1 exit status
# make[2]: *** [arm-softfloat-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/iconvdata/ISO8859-1.so] Error 1
# when building glibc-2.3.3 with gcc-3.4.0 for arm-softfloat

diff -urNd gcc-3.4.0-orig/gcc/config/arm/linux-elf.h gcc-3.4.0/gcc/config/arm/linux-elf.h
--- gcc-3.4.0-orig/gcc/config/arm/linux-elf.h   2004-01-31 07:18:11.000000000 +0100
+++ gcc-3.4.0/gcc/config/arm/linux-elf.h        2004-05-01 19:19:06.935979200 +0200
@@ -55,7 +73,7 @@
    %{shared:-lc} \
    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"

-#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
+#define LIBGCC_SPEC "-lgcc"

 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which

Last edited by noodle (2007-07-27 20:40:45)

Offline

 

#5 2007-07-27 21:41:15

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: A little help on crosstools

noodle wrote:

Figure it out, fonz. You missed one patch file: gcc-uclibc-3.3-121-softfloat.patch. So the crosstools.sh didn't finished successfully.

And it works with gcc 34 only, not gcc 4. So, on Fedora system, I installed compat-gcc-34, and export CC=gcc34

Thanks, this will save me some time this weekend :-)

Offline

 

#6 2007-07-30 19:18:03

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

Ok, I got crosstools compiled, I got g++, I got apcupsd compiled (install has some problem, because it depend on the system folder layout). I copied executable files, configuration files into dns323, and try to launch it for a quite test.

Guess what I got? "/mnt/sys/fun_plug.d/bin/sh: /mnt/sys/fun_plug.d/bin/apcupsd/apctest: not found". But the file is there and permission is correct.

# ls -l /mnt/sys/fun_plug.d/bin/apcupsd/
-rwxr-xr-x    1 root     root          587 Jul 29 17:04 apcaccess
-rwxr-xr-x    1 root     root        39710 Jul 29 17:04 apctest
-rwxr-xr-x    1 root     root        39710 Jul 29 17:04 apcupsd
-rwxr-xr-x    1 root     root          587 Jul 29 17:04 smtp

What could be wrong? Missing library? there has no ".so" file after build. g++ require more library?

Thanks for your advice.

noodle

Offline

 

#7 2007-07-30 19:20:50

KRH
Member
From: Denmark
Registered: 2006-10-27
Posts: 219
Website

Re: A little help on crosstools

try running it whit strace and se what gets written out.


First user to fun_plug the dns-323.

Offline

 

#8 2007-07-30 19:26:42

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: A little help on crosstools

noodle wrote:

Ok, I got crosstools compiled, I got g++, I got apcupsd compiled (install has some problem, because it depend on the system folder layout). I copied executable files, configuration files into dns323, and try to launch it for a quite test.

Guess what I got? "/mnt/sys/fun_plug.d/bin/sh: /mnt/sys/fun_plug.d/bin/apcupsd/apctest: not found". But the file is there and permission is correct.

How did you start it?
What is /mnt/sys/? Is it a mount point? Does the mount have the "exec" flag (Ouput of "mount")?

Offline

 

#9 2007-07-31 00:32:42

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

I start it like: "/mnt/sys/fun_plug.d/bin/apcupsd/apctest --help"

yes, /mnt/sys is my mount point for my USB flash drive. I installed your fun_plug there, and all the others worked fine. I think it has exec flag. The output of mount is:
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw)
proc on /proc type proc (rw,nodiratime)
/dev/loop0 on /sys/crfs type cramfs (ro)
/dev/md0 on /mnt/HD_a2 type ext2 (rw)
/dev/md1 on /mnt/HD_b2 type ext2 (rw)
none on /proc/bus/usb type usbfs (rw)
/dev/sdc1 on /mnt/sys type ext2 (rw)
devpts on /dev/pts type devpts (rw)
As I know, only if you have noexec flag, it going show here.

BTW, that dns323-fan, dns323-temp, dns323-spindown is very useful. dns323-spindown is much better way to detect if hard disk is standby or active. I'm thinking to write a new fan control by use them later.

Last edited by noodle (2007-07-31 00:37:25)

Offline

 

#10 2007-07-31 00:35:20

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

KRH, here is the output of strace:

execve("/mnt/sys/fun_plug.d/bin/apcupsd/apctest", ["/mnt/sys/fun_plug.d/bin/apcupsd/"...], [/* 16 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
_exit(1)                                = ?
Process 20117 detached

Thanks

Offline

 

#11 2007-07-31 02:44:01

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: A little help on crosstools

Does it run from e.g. /tmp? Do the other programs fail, too?
What type of file is "/mnt/sys/fun_plug.d/bin/apcupsd/apctest"?
Try

Code:

file /mnt/sys/fun_plug.d/bin/apcupsd/apctest
ldd /mnt/sys/fun_plug.d/bin/apcupsd/apctest

Why have apctest/apcupsd, and apcaccess/smtp the same size? Are these hard-links?

Offline

 

#12 2007-07-31 02:58:38

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

All the files I build under /mnt/sys/fun_plug.d/bin/apcupsd folder have problem.

the outputs are:

Code:

/ # file /mnt/sys/fun_plug.d/bin/apcupsd/apctest
/mnt/sys/fun_plug.d/bin/apcupsd/apctest: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), not stripped
/ # ldd /mnt/sys/fun_plug.d/bin/apcupsd/apctest
        libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
        libc.so.0 => /lib/libc.so.0 (0x00000000)
        /lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)

I'm not sure why there have same size, but that's what I got after build.

Code:

/ # /mnt/sys/fun_plug.d/bin/apcupsd/apcupsd
/mnt/sys/fun_plug.d/bin/sh: /mnt/sys/fun_plug.d/bin/apcupsd/apcupsd: not found
/ # /mnt/sys/fun_plug.d/bin/apcupsd/apctest
/mnt/sys/fun_plug.d/bin/sh: /mnt/sys/fun_plug.d/bin/apcupsd/apctest: not found
/ # /mnt/sys/fun_plug.d/bin/apcupsd/smtp
/mnt/sys/fun_plug.d/bin/apcupsd/smtp: line 1: syntax error: word unexpected (expecting ")")
/ # /mnt/sys/fun_plug.d/bin/apcupsd/apcaccess
/mnt/sys/fun_plug.d/bin/apcupsd/apcaccess: line 1: syntax error: word unexpected (expecting ")")
/ #

Code:

/ # file /mnt/sys/fun_plug.d/bin/apcupsd/apcaccess
/mnt/sys/fun_plug.d/bin/apcupsd/apcaccess: ELF 32-bit LSB executable, ARM, version 1, corrupted program header size, corrupted section header size

Last edited by noodle (2007-07-31 02:59:28)

Offline

 

#13 2007-07-31 03:24:36

noodle
Member
Registered: 2007-07-13
Posts: 62

Re: A little help on crosstools

I found some warning in my build log, may occurred this issue, but not sure.

Code:

makedepend: warning:  action.c (reading /usr/include/stdio.h, line 34): cannot find include file "stddef.h"
        not in /opt/dns323/funplug-0.3/sys-root/mnt/sys/fun_plug.d/include/stddef.h
        not in /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/include/stddef.h
        not in /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/include/stddef.h
        not in /usr/include/stddef.h
makedepend: warning:  action.c (reading /usr/include/bits/types.h, line 31): cannot find include file "stddef.h"
        not in /opt/dns323/funplug-0.3/sys-root/mnt/sys/fun_plug.d/include/stddef.h
        not in /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/include/stddef.h
        not in /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/include/stddef.h
        not in /usr/include/stddef.h
makedepend: warning:  action.c (reading /usr/include/_G_config.h, line 14): cannot find include file "stddef.h"
        not in /opt/dns323/funplug-0.3/sys-root/mnt/sys/fun_plug.d/include/stddef.h
        not in /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/include/stddef.h
        not in /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/include/stddef.h
        not in /usr/include/stddef.h

Code:

arm-linux-uclibc-ld -g -O apcupsd.o options.o reports.o action.o apcnis.o device.o /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/src/drivers/libdrivers.a -lpthread  /opt/dns323/funplug-0.3/tmp/apcupsd-3.14.1/src/lib/libapc.a   -lsupc++  -o apcupsd
arm-linux-uclibc-ld: warning: cannot find entry symbol _start; defaulting to 00009084

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB