Author Topic: Native Compilation  (Read 8544 times)

Hakkikkt

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://
Native Compilation
« on: November 01, 2006, 02:49:35 pm »
Hi together,
once or twice a year I try to compile R (www.r-project.org) for my C760. For compilation of R gcc and g77 are needed and later the R-binary is used to compile further modules (which makes it diffult to build with a cross-compiler
My latest attempt was a native compilation based on OZ 3.5.4.1 (gpe) and the native sdk + additional packages as listed in the OZ wiki.
Configuration and compilation was without problems until linking of the main R binary.
Linking failed with the following message:

gcc -Wl,--export-dynamic -L/usr/local/lib -o R.bin Rmain.o CConverters.o CommandLineArgs.o Rdynload.o Renviron.o RNG.o apply.o arithmetic.o apse.o array.o attrib.o base.o bind.o builtin.o character.o coerce.o colors.o complex.o connections.o context.o cov.o cum.o dcf.o datetime.o debug.o deparse.o deriv.o dotcode.o dounzip.o dstruct.o duplicate.o engine.o envir.o errors.o eval.o format.o fourier.o gevents.o gram.o gram-ex.o graphics.o identical.o internet.o iosupport.o lapack.o list.o localecharset.o logic.o main.o mapply.o match.o memory.o model.o names.o objects.o optim.o optimize.o options.o par.o paste.o pcre.o platform.o plot.o plot3d.o plotmath.o print.o printarray.o printvector.o printutils.o qsort.o random.o regex.o registration.o relop.o rlocale.o saveload.o scan.o seq.o serialize.o size.o sort.o source.o split.o sprintf.o startup.o subassign.o subscript.o subset.o summary.o sysutils.o unique.o util.o version.o vfonts.o xxxpr.o   ../unix/libunix.a ../appl/libappl.a ../nmath/libnmath.a -L../../lib -lRblas -lg2c -lm -lgcc_s  ../extra/zlib/libz.a ../extra/bzip2/libbz2.a ../extra/pcre/libpcre.a  -lreadline  -ldl -lm
/lib/ld-linux.so.2: undefined reference to `errno'
collect2: ld returned 1 exit status

At the moment I have no idea if this is related to R or if it is a OZ problem. Did someone encounter a similar problem before?
Many thanks, Georg

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Native Compilation
« Reply #1 on: November 02, 2006, 05:39:28 am »
Does this error mean that the declaration of errno has not been performed?

Some places to look:

src/main/source.c has "/* extern int errno; No longer used */"
src/main/dounzip.c does have a declaration of errno:

Code: [Select]
#ifdef HAVE_ERRNO_H
#include
#else
extern int errno;
#endif

Which seems to indicate that errno.h ought to be declared in there...?

I'm not too sure how to get GCC to spit out some more information about where it's not found the declaration (assuming that's what it is). Anyone?

Georg,

Did you need to do anything special to setup your toolchain? Would you mind posting instructions for which ipks were needed?

Thanks,


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Hakkikkt

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://
Native Compilation
« Reply #2 on: November 02, 2006, 03:37:47 pm »
Hoi,
I looked at the sources in src/main too. In some of the files I see #include <errno.h> , in others it is missing, although errno is used. I already included errno.h in all the files  where errno is used, but that did not change anything.

In any case, I can reproduce the behaviour with two slightly different setups:

1) my C760 with OZ  3.5.4.1 (gpe) and the native-sdk-toolchain plus the additional packages from lardmans list: http://wiki.openzaurus.org/HowTos/Native_Development
(inlcuding the packages for X11 developement and g77 and libreadline)
I installed everything on my SD-card. For whatever reason (probably I did by mstake not use a "real" root shell, but used root login via su instead) some symboliks links were broken. But it was straightforward to repair them manually.

2) I tried it also with qemu and Poky (see here http://www.o-hand.com/~richard/qemu.html)
Additionally to the sdk already included in the poky image, I installed (everything from the OZ 3.5.4.1 feed):
g++_3.4.4-r5_arm.ipk          
g++-uc_0.1.9-r1_arm.ipk          
libgmp3_4.1.4-r0_arm.ipk        
mpfr-dev_2.1.1-r1_arm.ipk
g77_3.4.4-r5_arm.ipk          
ldd_2.3.5+cvs20050627-r3_arm.ipk  
libgmp-dev_4.1.4-r0_arm.ipk
g77-symlinks_3.4.4-r5_arm.ipk  
libg2c0_3.4.4-r3_arm.ipk          
libreadline4_4.3-r2_arm.ipk
g++-symlinks_3.4.4-r5_arm.ipk  
libg2c-dev_3.4.4-r5_arm.ipk      
libreadline-dev_4.3-r2_arm.ipk

Both systems give exactly the same behaviour, thats why I think the problem is not related to the broken symlinks on my C760.

Hakkikkt

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://
Native Compilation
« Reply #3 on: November 03, 2006, 04:43:55 am »
Hoi again,

I found a way to get it working. The hack is described here:
https://www.oesf.org/forums/index.php?showt...t=&#entry117262

I changed /usr/lib/libc.so as it is described there.

I am only a stupid user, is htis now a bug or a feature?  

Compilation failed now on another point due to a missing package. In any case, I let you know how far I come with building R.
Thanks for your efforts, Georg

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Native Compilation
« Reply #4 on: November 03, 2006, 05:20:16 am »
Sounds like it's probably a bug.

Can you add it to the bugtracker please (assuming it's not already there of course)? http://bugs.openembedded.org/

I'm looking forward to trying out your newly compiled version of R


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
Native Compilation
« Reply #5 on: November 03, 2006, 05:32:46 am »
Quote
Hoi again,

I found a way to get it working. The hack is described here:
https://www.oesf.org/forums/index.php?showt...t=&#entry117262

I changed /usr/lib/libc.so as it is described there.

I am only a stupid user, is htis now a bug or a feature?   

Compilation failed now on another point due to a missing package. In any case, I let you know how far I come with building R.
Thanks for your efforts, Georg
[div align=\"right\"][a href=\"index.php?act=findpost&pid=145480\"][{POST_SNAPBACK}][/a][/div]

That's why I made a custom script to install gcc and related packages plus do all the required configurations.
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

Hrw

  • Hero Member
  • *****
  • Posts: 1366
    • View Profile
Native Compilation
« Reply #6 on: November 03, 2006, 06:43:08 am »
Editing of libc.so is NOT needed. You need binutils 2.16 installed - they are provided in upgrades feed.
OpenZaurus 3.5.4x Release Manager
OpenEmbedded, Ångström, Poky developer
My website

Misc embedded hardware.

Hakkikkt

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://
Native Compilation
« Reply #7 on: November 03, 2006, 12:21:46 pm »
Quote
Editing of libc.so is NOT needed. You need binutils 2.16 installed - they are provided in upgrades feed.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=145492\"][{POST_SNAPBACK}][/a][/div]

I did a "ipkg update; ipkg upgrade" before starting the whole compilation process and I just checked it again, I have binutils 2.16 installed:

# ipkg list_installed binu*
binutils - 2.16-r3 -
binutils-symlinks - 2.16-r3 -

I will file a bug-report later today. Thanks for your help, Georg

Hakkikkt

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • http://
Native Compilation
« Reply #8 on: November 04, 2006, 03:05:53 am »
Quote
Sounds like it's probably a bug.

Can you add it to the bugtracker please (assuming it's not already there of course)? http://bugs.openembedded.org/


[div align=\"right\"][{POST_SNAPBACK}][/a][/div]

Adding a bug to the bugtracker does not seem necessary...It seems that the bug was resolved a (short?) while ago. According to here: [a href=\"http://bugs.openembedded.org/show_bug.cgi?id=43]http://bugs.openembedded.org/show_bug.cgi?id=43[/url]
 glibc-2.3.5+cvs20050627-r11 should contain a working libc.so.

Installed on OZ 3.5.4.1 is: libc6 - 2.3.5+cvs20050627-r3 (and the same versions of glibc.


And, building R seems to work now (it takes really long building the base modules;-) I will announce the availability in OZ/GPE once I am finished with compiling and testing.

Thanks for your helpfull suggestions and especially to lardman for his several years of work on this    .

Georg

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Native Compilation
« Reply #9 on: November 06, 2006, 09:07:24 am »
Glad you've got it sorted out

Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Native Compilation
« Reply #10 on: November 08, 2006, 10:22:06 am »
One (random) point to note.

The need to pass ac_cv_c_bigendian=yes to configure is related to the fact that the current OZ soft-float implementation, fpa, keeps all fp numbers in bigendian format in memory. Therefore R needs to be told this. I do wonder what this will do when writing to files as R will think it's on a bigendian system. The same is true of Octave, but it automatically checks the endianness (iirc), again by looking at an fp number, so the same problem will probably manifest itself.

This will be sorted out when we move to Angstrom as eabi uses vfp, which keeps fp numbers in the same endianness as the processor.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

xjqian

  • Sr. Member
  • ****
  • Posts: 497
    • View Profile
    • http://
Native Compilation
« Reply #11 on: November 30, 2007, 03:26:29 am »
Quote from: lardman
This will be sorted out when we move to Angstrom as eabi uses vfp, which keeps fp numbers in the same endianness as the processor.
indeed in Angstrom, configure: loading site script /home/gordon/oe/org.openembedded.dev/site/endian-little
My Blog | 6000L Tosa + sled | is: Angstrom | was: pdaXrom 1.1.0beta1 | was: stock 1.12 rom + no-ffpe fash kernel + X/Qt Debian |
CF GPS (FGPCFCD01) | USB "Prolific 2303" GPS (USB-UG-200) | Socket CF BT rev. H |  USB "Pegasus II" Ethernet (ADM8511) | PocketTop IR kbd | sip:527630@fwd.pulver.com
Todo: OESF wiki | stable VOIP app | usable GPS app |      Wishlist: VOIP + Bluetooth | GPS + Routing Calc