aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Error in linking while crosscompiling for Synology DS-410 (PPC)  (Read 9666 times)

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8

Hi all, I'm trying to crosscompile amule for my brand new Synology DS-410 which has a PPC CPU.
I've already downloaded the synology toolchain for my Ubuntu 9.10

First of all I crosscompiled wx-base using the following configure:

Code: [Select]
env CC=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc \
LD=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ld \
RANLIB=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ranlib \
CFLAGS="-I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double" \
LDFLAGS="-L/usr/local/lib -L/usr/local/powerpc-linux-gnuspe/lib" \
./configure \
--host=powerpc-unknown-linux \
--target=powerpc-unknown-linux \
--build=i686-pc-linux \
--prefix=/usr/local \
--enable-unicode \
--enable-largefile \
--without-subdirs \
--disable-gui \
--disable-shared

Then I tried compiling amule using the following configure:

Code: [Select]
env CC=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc \
LD=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ld \
RANLIB=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ranlib \
CFLAGS="-I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double" \
LDFLAGS="-L/usr/local/lib -L/usr/local/powerpc-linux-gnuspe/lib" \
./configure \
--host=powerpc-unknown-linux \
--target=powerpc-unknown-linux \
--build=i686-pc-linux \
--prefix=/usr/local \
--with-toolkit=base \
--with-wxdir=/home/marco/My_Stuff/syno/wxWidgets-2.8.11 \
--disable-monolithic \
--enable-amule-daemon \
--enable-amulecmd \
--enable-webserver \
--enable-upnp \
--disable-debug \
--enable-static

But, after lauching "make"....a get a linking error:

Code: [Select]
[...]
Compiling php_parser.c
Compiling php_lexer.c
Compiling php_syntree.cpp
Compiling php_amule_lib.cpp
Compiling php_core_lib.cpp
Linking amuleweb
/usr/bin/ld: amuleweb-php_parser.o: Relocations in generic ELF (EM: 20)
/usr/bin/ld: amuleweb-php_parser.o: Relocations in generic ELF (EM: 20)
amuleweb-php_parser.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[4]: *** [amuleweb] Errore 1
make[3]: *** [all-recursive] Errore 1
make[2]: *** [all-recursive] Errore 1
make[1]: *** [all-recursive] Errore 1
make: *** [all] Errore 2

How can I solve it?

Thanks in advance!
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #1 on: May 06, 2010, 11:08:23 PM »

And I'd start with amuled, not amuleweb. You can always run amuleweb on your Ubuntu machine when needed, or use amulegui.
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

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #2 on: May 07, 2010, 10:11:51 AM »

Thanks for your suggestions guys!  ;)

Well, I changed a little bit my configure script....here you are:

Code: [Select]
#! /bin/bash

CONFIG_OPTS="--host=powerpc-unknown-linux --target=powerpc-unknown-linux --build=i686-pc-linux --prefix=/usr/local --with-toolkit=base --with-wxdir=/home/marco/My_Stuff/syno/wxWidgets-2.8.11 --disable-monolithic --enable-amule-daemon --enable-amulecmd --disable-debug --with-denoise-level=0"

CC=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc
export CC
CXX=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-g++
export CXX
LD=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ld
export LD
RANLIB=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ranlib
export RANLIB
CFLAGS="-I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double"
export CFLAGS
CXXFLAGS="$CFLAGS"
export CXXFLAGS
LDFLAGS="-L/usr/local/powerpc-linux-gnuspe/lib"
export LDFLAGS

./configure $CONFIG_OPTS $*


Thus I added CXX and CXXFLAGS, removed amuleweb from config and set denoise-level=0.
Now it seems like it's linking correctly, maybe my fault in not setting CXX and CXXFLAGS caused the problem.
Right now I have some compiling issue, it seems like there's some ASM code which is not correctly handled by the specific target platform?
Is my analysis correct?

Anyway...here you are my error:


Code: [Select]
In file included from amuled.cpp:75:
/usr/include/sys/wait.h:116: warning: `__pid_t wait(void*)' hides constructor for `union wait'
amuled.cpp: In member function `void CSocketSet::FillSet(int&)':
amuled.cpp:257: error: impossible constraint in `asm'
make[3]: *** [amuled-amuled.o] Errore 1
make[3]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6/src»
make[2]: *** [all-recursive] Errore 1
make[2]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6/src»
make[1]: *** [all-recursive] Errore 1
make[1]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6»
make: *** [all] Errore 2

Well here it is the function:
Code: [Select]
void CSocketSet::FillSet(int &max_fd)
{
FD_ZERO(&m_set);

for(int i = 0; i < m_count; i++) {
    FD_SET(m_fds[i], &m_set);
    if ( m_fds[i] > max_fd ) {
    max_fd = m_fds[i];
    }
}
}

I'm not good at all in ASM (the only one I barely new was the one of PD32....I know...shame on me!  :P )
thus, just to see if I cold end the compile phase, I just tried to comment the line 257:

 FD_ZERO(&m_set);

Anyway, the problem came out again in the function below the one incriminated

Code: [Select]
void CSocketSet::Detected(void (GSocket::*func)())
{
for (int i = 0; i < m_count; i++) {
int fd = m_fds[i];
if ( FD_ISSET(fd, &m_set) ) {
GSocket *socket = m_gsocks[fd];
(*socket.*func)();
}
}
}

The problem here is in line 271

if ( FD_ISSET(fd, &m_set) ) {

another ASM function, stating that it could not find a registry or something like that!
Then, if the problem is that the target platform cannot handle ASM code which is specifically written for, I suppose, Intel ASM, how can amule be compiled for another target platform different from the Intel one? I must be wrong....or I hope so! :P

Thanks once more for any help you could give me!

Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #3 on: May 07, 2010, 10:37:51 AM »

Is my analysis correct?
No.

The compiler includes /usr/include/sys/wait.h whereas it should include /usr/local/powerpc-linux-gnuspe/include/sys/wait.h instead. A library aMuled uses has its headers in /usr/include, thus that directory is included in the -I list of the compiler. This usually means that the configure script found the wrong version of a library. If and only if you're sure that the library is the right version, in the wrong place, you can work around this problem by setting INCLUDES="-I/usr/local/powerpc-linux-gnuspe/include". Otherwise you'd better make configure find the right version of the library.
Logged
concordia cum veritate

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #4 on: May 07, 2010, 11:55:52 AM »

Is my analysis correct?
No.

The compiler includes /usr/include/sys/wait.h whereas it should include /usr/local/powerpc-linux-gnuspe/include/sys/wait.h instead. A library aMuled uses has its headers in /usr/include, thus that directory is included in the -I list of the compiler. This usually means that the configure script found the wrong version of a library. If and only if you're sure that the library is the right version, in the wrong place, you can work around this problem by setting INCLUDES="-I/usr/local/powerpc-linux-gnuspe/include". Otherwise you'd better make configure find the right version of the library.

Hi, thank you very much for your suggestion!
Anyway I treid adding the line you suggested me to my configure launch script like this

Code: [Select]
#! /bin/bash

CONFIG_OPTS="--host=powerpc-unknown-linux --target=powerpc-unknown-linux --build=i686-pc-linux --prefix=/usr/local --with-toolkit=base --with-wxdir=/home/marco/My_Stuff/syno/wxWidgets-2.8.11 --disable-monolithic --enable-amule-daemon --enable-amulecmd --disable-debug --with-denoise-level=0"

CC=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-gcc
export CC
CXX=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-g++
export CXX
LD=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ld
export LD
RANLIB=/usr/local/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-ranlib
export RANLIB
CFLAGS="-I/usr/local/powerpc-linux-gnuspe/include -mcpu=8548 -mhard-float -mfloat-gprs=double"
export CFLAGS
CXXFLAGS="$CFLAGS"
export CXXFLAGS
LDFLAGS="-L/usr/local/powerpc-linux-gnuspe/lib"
export LDFLAGS
INCLUDES="-I/usr/local/powerpc-linux-gnuspe/include"
export INCLUDES

./configure $CONFIG_OPTS $*

but nothing changed. Here you are my error message (I added some more lines):

Code: [Select]
/usr/include/signal.h:371: warning: `int sigaltstack(const sigaltstack*, sigaltstack*)' hides constructor for `struct sigaltstack'
In file included from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/filefn.h:29,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/stream.h:22,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/wfstream.h:21,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/unix/pipe.h:93,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/unix/execute.h:13,
                 from amule.h:39,
                 from amuled.cpp:26:
/usr/include/sys/stat.h:219: warning: `int stat(const char*, stat*)' hides constructor for `struct stat'
/usr/include/sys/stat.h:229: warning: `int stat64(const char*, stat64*)' hides constructor for `struct stat64'
amuled.cpp:50:1: warning: "_XOPEN_SOURCE" redefined
In file included from /usr/include/assert.h:37,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/debug.h:18,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/defs.h:521,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/event.h:15,
                 from /home/marco/My_Stuff/syno/wxWidgets-2.8.11/include/wx/app.h:20,
                 from amule.h:31,
                 from amuled.cpp:26:
/usr/include/features.h:160:1: warning: this is the location of the previous definition
In file included from amuled.cpp:75:
/usr/include/sys/wait.h:116: warning: `__pid_t wait(void*)' hides constructor for `union wait'
amuled.cpp: In member function `void CSocketSet::FillSet(int&)':
amuled.cpp:252: error: impossible constraint in `asm'
make[3]: *** [amuled-amuled.o] Errore 1
make[3]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-2.2.6/src»
make[2]: *** [all-recursive] Errore 1
make[2]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-2.2.6/src»
make[1]: *** [all-recursive] Errore 1
make[1]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-2.2.6»
make: *** [all] Errore 2

Then I though that it could be beacause of I didn't use crosscompiled version of crypto++ but  alocal one, shall I crosscompile crypto++ too?
But then, while I was looking at the config.log (attached to this post) it seemed to me like there are many headers the configure script cannot find!
Is is right? Thus the problem has nothing to do with crosscompiling crypto++!?!?
I'm sorry, I'm not good at all in such a situation (I though that the /usr/include stuff has nothing to deal but warnings!)....any help would be greatly appreciated!

Thank you very much one more! ;)
Logged

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #5 on: May 07, 2010, 12:00:45 PM »

Ops...sorry!
HEre you are the config.log! :P
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #6 on: May 07, 2010, 06:40:51 PM »

Code: [Select]
In file included from amuled.cpp:75:
/usr/include/sys/wait.h:116: warning: `__pid_t wait(void*)' hides constructor for `union wait'
amuled.cpp: In member function `void CSocketSet::FillSet(int&)':
amuled.cpp:257: error: impossible constraint in `asm'
make[3]: *** [amuled-amuled.o] Errore 1
make[3]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6/src»
make[2]: *** [all-recursive] Errore 1
make[2]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6/src»
make[1]: *** [all-recursive] Errore 1
make[1]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6»
make: *** [all] Errore 2

You're in the wrong place here, pal. aMule-AdunanzA is NOT supported by us. Use aMule or ask them for help.
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
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #7 on: May 07, 2010, 10:28:57 PM »

I though that it could be beacause of I didn't use crosscompiled version of crypto++ but  alocal one, shall I crosscompile crypto++ too?
Yes.
Logged
concordia cum veritate

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #8 on: May 09, 2010, 11:38:12 PM »

Code: [Select]
In file included from amuled.cpp:75:
/usr/include/sys/wait.h:116: warning: `__pid_t wait(void*)' hides constructor for `union wait'
amuled.cpp: In member function `void CSocketSet::FillSet(int&)':
amuled.cpp:257: error: impossible constraint in `asm'
make[3]: *** [amuled-amuled.o] Errore 1
make[3]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6/src»
make[2]: *** [all-recursive] Errore 1
make[2]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6/src»
make[1]: *** [all-recursive] Errore 1
make[1]: uscita dalla directory «/home/marco/My_Stuff/syno/aMule-AdunanzA-2010.1-2.2.6»
make: *** [all] Errore 2

You're in the wrong place here, pal. aMule-AdunanzA is NOT supported by us. Use aMule or ask them for help.


That's right, my first attempt was with aMule Adunanza. But, as I wanted to be sure that it was a problem with aMule itself and not the Adunanza version I tried to do the same with the "vanilla" Amule and I had the same problem (as you can see in the config.log attached to the post).
Logged

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #9 on: May 09, 2010, 11:40:43 PM »

I though that it could be beacause of I didn't use crosscompiled version of crypto++ but  alocal one, shall I crosscompile crypto++ too?
Yes.

Thanks. Then I'll try to cross compile crypto++ too and I'll let you know if ti helps!
Of course, I'll continue using "vanilla" aMule!
Thanks one more!
Logged

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #10 on: May 09, 2010, 11:43:00 PM »

I though that it could be beacause of I didn't use crosscompiled version of crypto++ but  alocal one, shall I crosscompile crypto++ too?
Yes.

Sorry, just to be sure: is there anything else beside wxwidget and crypto++ that I have to crosscompile to have aMule correctly compiled?
Thanks in advance! ;)
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #11 on: May 10, 2010, 08:05:22 PM »

Zlib.
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

aratheba

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 8
Re: Error in linking while crosscompiling for Synology DS-410 (PPC)
« Reply #12 on: May 13, 2010, 03:25:00 PM »

Mhhh.... I finally gave up crosscompiling: too many libs to crosscompile (zlib, crypto++, gettext, libpng...).
Thus I decided to compile directly on the syno itself and I did it!  ;D
Oh well, I had many problems too: although I could use many libs already compiled for my syno's platform I had to recompile some of then (wxwidget) and compile the missing one (crypto++). Moreover the default configure script had some problem in recognizing the wxwidget version having 4 char for the version number (i.e: 2.8.10.0 instead of 2.8.10) and I had to manually adjust it.
Anyway...I could finally compile amule for my syno and even integrate amule management web page into syno's web interface! ;)

Logged