aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2

Author Topic: Problem with autotools when cross compiling for ARMEL with OpenEmbedded  (Read 14472 times)

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

I'm trying to cross compile aMule 2.2.6 for ARMEL architecture to use aMule in my GuruPlug Server+. I'm using OpenEmbedded (OE) for the dirty work, as it helps automating the compilation process, but I faced several problems:

1.- Libcrypto++ wasn't available for OE. I solved it creating my own recipe to add this library to OE.
2.- OE builds wxbase libs by default without unicode support. Solved editing wxbase config flags in wxbase recipe.
3.- Autotools fails creating the configure script. This is the error OE spits out:

Code: [Select]
| checking for a BSD-compatible install... /home/doragasu/src/oe/stuff/build/tmp/sysroots/x86_64-linux/usr/bin/install -c
| checking whether build environment is sane... yes
| checking for arm-angstrom-linux-gnueabi-strip... arm-angstrom-linux-gnueabi-strip
| checking for a thread-safe mkdir -p... /home/doragasu/src/oe/stuff/build/tmp/sysroots/x86_64-linux/usr/bin/mkdir -p
| checking for gawk... gawk
| checking whether make sets $(MAKE)... yes
| checking whether to enable maintainer-specific portions of Makefiles... no
| checking build system type... x86_64-pc-linux-gnu
| checking host system type... arm-angstrom-linux-gnueabi
| checking if this is a FreeBSD 4 or earlier system... no
| checking whether the C++ compiler works... yes
| checking for C++ compiler default output file name... a.out
| checking for suffix of executables...
| checking whether we are cross compiling... yes
| checking for suffix of object files... o
| checking whether we are using the GNU C++ compiler... yes
| checking whether arm-angstrom-linux-gnueabi-g++ -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb accepts -g... yes
| checking for style of include used by make... GNU
| checking dependency style of arm-angstrom-linux-gnueabi-g++ -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb... gcc3
| checking how to run the C++ preprocessor... arm-angstrom-linux-gnueabi-g++ -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb -E
| checking for arm-angstrom-linux-gnueabi-gcc... arm-angstrom-linux-gnueabi-gcc -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb
| checking whether we are using the GNU C compiler... yes
| checking whether arm-angstrom-linux-gnueabi-gcc -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb accepts -g... yes
| checking for arm-angstrom-linux-gnueabi-gcc -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb option to accept ISO C89... none needed
| checking dependency style of arm-angstrom-linux-gnueabi-gcc -march=armv5te -mtune=arm926ej-s -mthumb-interwork -mno-thumb... gcc3
| checking how to run the C preprocessor... arm-angstrom-linux-gnueabi-gcc -E
| checking for x86_64-linux-gcc... gcc
| checking whether the C compiler works... yes
| checking for C compiler default output file name... a.out
| checking for suffix of executables...
| checking whether we are cross compiling... no
| checking for gawk... (cached) gawk
| checking for grep that handles long lines and -e... /bin/grep
| checking for egrep... /bin/grep -E
| checking whether make sets $(MAKE)... (cached) yes
| checking for flex... flex
| checking lex output file root... lex.yy
| checking lex library... -lfl
| checking whether yytext is a pointer... yes
| checking for arm-angstrom-linux-gnueabi-ranlib... arm-angstrom-linux-gnueabi-ranlib
| checking for bison... bison -y
| checking for arm-angstrom-linux-gnueabi-ranlib... (cached) arm-angstrom-linux-gnueabi-ranlib
| checking for arm-angstrom-linux-gnueabi-strip... (cached) arm-angstrom-linux-gnueabi-strip
| checking for arm-angstrom-linux-gnueabi-ar... arm-angstrom-linux-gnueabi-ar
| checking for arm-angstrom-linux-gnueabi-ld... arm-angstrom-linux-gnueabi-ld
| checking for zlib >= 1.1.4... yes (version 1.2.3)
| checking for ANSI C header files... yes
| checking for sys/types.h... yes
| checking for sys/stat.h... yes
| checking for stdlib.h... yes
| checking for string.h... yes
| checking for memory.h... yes
| checking for strings.h... yes
| checking for inttypes.h... yes
| checking for stdint.h... yes
| checking for unistd.h... yes
| checking for File::Copy... ok
| checking whether we need the GUI... no
| checking for the --with-toolkit option... will be automatically detected
| checking for the --with-wxshared option... will be automatically detected
| checking for the --with-wxdebug option... will be automatically detected
| checking for the --with-wxversion option... will be automatically detected
| checking for wx-config... /home/doragasu/src/oe/stuff/build/tmp/sysroots/x86_64-linux/usr/bin/armv5te-angstrom-linux-gnueabi/wx-config
| checking for wxWidgets version >= 2.8.0 (--unicode=yes)... yes (version 2.8.9)
| checking for wxWidgets static library... no
| checking if wxWidgets was built in DEBUG mode... no
| checking if wxWidgets was built in STATIC mode... no
| checking which wxWidgets toolkit was selected... base
| checking for arm-angstrom-linux-gnueabi-pkg-config... no
| checking for pkg-config... /home/doragasu/src/oe/stuff/build/tmp/sysroots/x86_64-linux/usr/bin/pkg-config
| configure: WARNING: using cross tools not prefixed with host triplet
| checking pkg-config is at least version 0.9.0... yes
| /home/doragasu/src/oe/stuff/build/tmp/work/armv5te-angstrom-linux-gnueabi/amule-2.2.6-r0/aMule-2.2.6/configure: line 8538: syntax error near unexpected token `{'
| /home/doragasu/src/oe/stuff/build/tmp/work/armv5te-angstrom-linux-gnueabi/amule-2.2.6-r0/aMule-2.2.6/configure: line 8538: `fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result$resultstr" >&5'
| FATAL: oe_runconf failed
NOTE: Task failed: /home/doragasu/src/oe/stuff/build/tmp/work/armv5te-angstrom-linux-gnueabi/amule-2.2.6-r0/temp/log.do_configure.4299
ERROR: TaskFailed event exception, aborting
ERROR: Build of /home/doragasu/src/oe/stuff/bbcollections/recipes/amule/amule_2.2.6.bb do_configure failed
ERROR: Task 7 (/home/doragasu/src/oe/stuff/bbcollections/recipes/amule/amule_2.2.6.bb, do_configure) failed
NOTE: Tasks Summary: Attempted 566 tasks of which 566 didn't need to be rerun and 1 failed.
ERROR: '/home/doragasu/src/oe/stuff/bbcollections/recipes/amule/amule_2.2.6.bb' failed

I don't know why but configure script isn't generated properly. I suspect there must be a problem with autotools scripts (the .in files), but as I'm completely noob to autotools I don't know how to fix it. The line in the middle is the one that has the syntax error:

Code: [Select]
resultstr=" (pkg-config not found)"

fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result$resultstr" >&5
$as_echo "$result$resultstr" >&6; }
libupnp_error="libupnp >= 1.6.6 not found$resultstr"

If I seek that piece of code in the configure script BEFORE autotools are applied by OE, this is how it looks:

Code: [Select]
resultstr=" (pkg-config not found)"

fi
echo "$as_me:$LINENO: result: $result$resultstr" >&5
echo "${ECHO_T}$result$resultstr" >&6
libupnp_error="libupnp >= 1.6.6 not found$resultstr"

I think I could easily fix this error adding a ';' or a new line before the 'fi', but due to the way OE works, I need the process to be entirely done without interruption, so I need to fix the autotools scripts instead of fixing the created configure script.

Are there any autotools gurus here that can shed some light on this?

Thanks in advance!
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685

Why at all do you need to re-create configure?

Btw, the attached patch should solve your problem.
« Last Edit: May 27, 2010, 01:50:04 AM by GonoszTopi »
Logged
concordia cum veritate

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

I'm really noob and I'm not sure why must I re-create it, it's automatically done by OE. I think it's needed for cross compiling, but I can easily be wrong. I can post the full OE build log if it helps to figure what OE is doing (with the commandline) and why. Thanks a lot for the patch, I'll test it as soon as possible (I think I'll not be able to test it until sunday).
Logged

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

Finally I tested the patch today. It removed the error, but there was another one in configure.in. I figured out how to remove it (removing dnl) and the configure stage now works. Now I have a compilation problem:

Code: [Select]
| In file included from kademlia/routing/../../RandomFunctions.h:29,
|                  from kademlia/routing/RoutingBin.cpp:42:
| kademlia/routing/../../CryptoPP_Inc.h:48:33: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/config.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:49:30: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/md4.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:50:30: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/rsa.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:51:33: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/base64.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:52:32: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/osrng.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:53:32: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/files.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:54:30: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/sha.h: No such file or directory
| kademlia/routing/../../CryptoPP_Inc.h:55:30: error: /home/doragasu/src/oe/stuff/build/tmp/sysroots/armv5te-angstrom-1-gnueabi/usr/include/cryptopp/des.h: No such file or directory
| In file included from kademlia/routing/RoutingBin.cpp:42:
| kademlia/routing/../../RandomFunctions.h:35: error: 'CryptoPP' has not been declared
| kademlia/routing/../../RandomFunctions.h:35: error: expected initializer before '&' token
| make[3]: *** [libmuleappcore_a-RoutingBin.o] Error 1
| make[2]: *** [all-recursive] Error 1
| make[1]: *** [all-recursive] Error 1
| make: *** [all] Error 2
| FATAL: oe_runmake failed
NOTE: Task failed: /home/doragasu/src/oe/stuff/build/tmp/work/armv5te-angstrom-linux-gnueabi/amule-2.2.6-r0/temp/log.do_compile.8505

I don't know why, but it looks like the string "armv5te-angstrom-linux-gnueabi" in the libcrypto++ include path gets replaced by "armv5te-angstrom-1-gnueabi". The libcrypto++ install path is properly configured. Searching in the created Makefile for "armv5te-angstrom-1-gnueabi" returns 0 matches, but searching for "armv5te-angstrom-linux-gnueabi" I can see the paths are properly configured...
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming

The path is defined as CRYPTOPP_INCLUDE_PREFIX in config.h .
Looks like a path is turned into a boolean to me.
You can try to get to the root to the problem, or just make a symlink.  :)

Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685

Finally I tested the patch today. It removed the error, but there was another one in configure.in. I figured out how to remove it (removing dnl)
I'd like to know which one it was.

I don't know why, but it looks like the string "armv5te-angstrom-linux-gnueabi" in the libcrypto++ include path gets replaced by "armv5te-angstrom-1-gnueabi".
That's because the compiler predefines
Code: [Select]
#define linux 1

Possible workarounds (fixes):
- turn all minuses to underscores in the path, i.e. use "armv5te_angstrom_linux_gnueabi" instead of "armv5te-angstrom-linux-gnueabi" (one can be a symlink to the other if you want to preserve the old directory name)
- add  the following lines to CryptoPP_Inc.h (near the beginning):
Code: [Select]
#undef linux
#define linux linux

I'll try to find a way to prevent macro expansion in CRYPTOPP_INCLUDE_PREFIX (if at all it's possible).
Logged
concordia cum veritate

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

Again, thanks a lot. I'll try the #undef approach first, and if it doesn't work, I'll try to change libcrypto++ path.

GonoszTopi, I have attached the patch including the "configure.in" changes.
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685

Ok, that's already fixed in the development version. Thanks.
Logged
concordia cum veritate

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

Thanks to you. I got it to compile using the #undef trick, but now I have a link problem (again with libcrypto++). I think I should be able to fix it by myself when I get some more time.

Attached is the patch I made to compile with "linux" in the path.
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685

Thank you in the name of anyone having similar issues (although the patch won't be included in the official sources -- we can't account for all predefined macros of all compilers).

Btw, should you need help with the link issue, feel free to ask.
Logged
concordia cum veritate

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

Finally I have successfully built aMule for my GuruPlug. The problem with the linking process was the linker was searching for libcryptopp.a in the include directory ("$STAGING_DIR/usr/include/libcryptopp"), and the file was in "$STAGING_DIR/usr/lib". I created a symbolic link and it linked perfectly. This trick worked, but I would like to know if  there's other way to set the directory for libcryptopp.a library. (Maybe something similar to the --with-crypto-prefix switch).

I hope I will be able to test this build soon (first I have to figure out how to install my Angstrom build in my Guruplug). Thanks a lot for help.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming

This device looks neat. Like the perfect platform to run aMule 24/7 . Where did you get it and what did it cost?
Please keep us up to date with your progress!  :)
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685

This device looks neat. [...] Where did you get it and what did it cost?
This blog article might be of interest to you: I've ordered a GuruPlug.
Logged
concordia cum veritate

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

I bought it directly to GlobalScale Techonologies.. The link will take you to the order page, where you can find prices for the different available options. I preordered mine about two months ago and got the JTAG for free :). It's really a cool device, tiny, fanless and with a very low power consumption.

I'm planning to replace my current "download server" (an old Intel Celeron 733MHz) with this device, but I'm still learning how to do some things. Guruplugs come with Debian pre-intalled, but I'm trying to replace it with a custom built Angstrom distribution. I'll write here my progress, but it will be slow because I'm pretty busy and I don't have much time to spend on this.
Logged

doragasu

  • Approved Newbie
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 24

I got amuled working in my tiny plug. I have configured it and it's working nicely. Now I want to start it as a daemon. I copied this script from the wiki:

Code: [Select]
#!/bin/bash

NAME=$(basename "$0")
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/amuled
DESC=amuled
USER=g2p #A user who already ran amule once to configure it.

test -x "$DAEMON" || exit 0

case "$1" in
 start)
   echo -n "Starting $DESC: "
     su "$USER" -c "$(printf "%q -f" "$DAEMON" )"
   echo "$NAME."
   ;;
 stop)
   echo -n "Stopping $DESC: "
     killall --quiet "$DAEMON"
   echo "$NAME."
   ;;
 restart|force-reload)
   echo -n "Restarting $DESC: "
     killall --quiet "$DAEMON"
   sleep 1
     su "$USER" -c "$(printf "%q -f" "$DAEMON" )"
   ;;
 *)
   printf "Usage: %q {start|stop|restart|force-reload}\n" "$0" >&2
   exit 1
   ;;
esac

exit 0

This script doesn't work for me, because I use sh instead of bash and the lines launching amuled fail due to the printf syntax:
Code: [Select]
su "$USER" -c "$(printf "%q -f" "$DAEMON" )"
I tried changing that lines like this:
Code: [Select]
su "$USER" -c "$DAEMON -f"
Then I had a problem with stop and restart. "killall amuled" kills amuled, but "killall /usr/bin/amuled" fails to kill amuled. I tried changing the script to exec "killall amuled" instead of "killall /usr/bin/amuled", but it doesn't work because the script is called itself amuled, and killall is killing also the script... Is there a way to prevent this (other than renaming the script :)).
Logged
Pages: [1] 2