Author Topic: Compilation Troubles  (Read 11724 times)

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« on: March 18, 2005, 11:33:02 pm »
hi,
sl-5500, OZ-3.5.2, OPIE-1.2
First try to compile on Z. I have to read more about that in this forum, but maybe somebody could help ?

#./configure
gives :
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See 'config.log' for more details.

I dl gcc and install it :
#ipkg -d sd install /mnt/cf/dl_ipk/8_gcc/gcc_3.4.3-r4_arm.ipk
Installing gcc (...) to sd...
Configuring apache
addgroup: www-data: group already in use
postinst script returned status 1
ERROR: apache.postinst returned 1
Configuring gcc

#ipkg-link mount /mnt/card

But when I ./configure again, I still have the same errors.
I am a bit lost with all the gcc packages; which ones are needed to compile ? And how do I add them in $PATH ?

tks
blaise

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Compilation Troubles
« Reply #1 on: March 19, 2005, 05:51:51 am »
Before you run configure, you need to run something like this in the terminal:

'export PATH=$PATH;/path/to/gcc/bin/directory/'


Si

P.S. Looks like your apache install has a problem (it was presumably a Sharp ROM version, you want to look at the script under <mount point>/usr/lib/ipkg/scripts/ to see whether there's a path/binary which doesn't exist, but which is used in the script).

P.P.S What are you trying to compile? Unless it's a trivial program, you may have troubles with other binaries which it needs, but which you don't have installed - have you thought about cross-compiling with OE?
« Last Edit: March 19, 2005, 05:53:22 am by lardman »
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

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #2 on: March 19, 2005, 06:46:00 am »
Quote
Before you run configure, you need to run something like this in the terminal:
'export PATH=$PATH;/path/to/gcc/bin/directory/'
ok, I will try, but I have to find out what is the path to gcc bin directory ! I tryied to install a gcc-ipkg to a sd card, and now, I have a /mnt/card/usr/bin/arm-linuxgcc and arm-linux-cpp files. Is this /mnt/card/usr/bin/ the right path ? I will check and try.

Quote
P.S. Looks like your apache install has a problem (it was presumably a Sharp ROM version, you want to look at the script under <mount point>/usr/lib/ipkg/scripts/ to see whether there's a path/binary which doesn't exist, but which is used in the script).
ok, I will check this script, but I managed to run apache nicely yesterday (well, it just served me a basic html page, but gave me a lot of satisfaction !). It was complaining at startup about missing log file in /var/log/apache/ so I created the /apache directory in /var/log and that made it. But after reboot, this /apache directory had disappeared from /var/log ... ! So I will try either to have it stay at each shutdown, or create it automatically at startup, or change the log file path in apache conf. This should not be too much a problem.

Quote
P.P.S What are you trying to compile? Unless it's a trivial program, you may have troubles with other binaries which it needs, but which you don't have installed - have you thought about cross-compiling with OE?
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]
I want to compile MapServer ( [a href=\"http://mapserver.gis.umn.edu]http://mapserver.gis.umn.edu[/url] ), a kind of GIS software (geographical Informations System) also called "webmapping".
I am almost sure that it won't be easy at all, but I want to know if it is possible, and use it if yes. Actually, this is why I bought a Z a few days ago; I'm no geek at all yet, but might fall in it !  Depending on the ./configure options, MapServer might need some other libraries to compile fine. I am going to look at the compilator output when.... it will start !
Basic MapServer (without special ./configure options) compiles quite well on almost any linux box, so I suppose it should also on Z...
I have seen on this forum and elsewhere a lot of informations about C compilation, gcc-2.x, gcc--3.x, zgcc, and more. I am not a compilator expert so I have to read all this messages in details to understand how it works on Z. For sure, I will need a bit more help later... :-)
Cross-compilation ? Ha ? Sorry about that. I learnt almost all I know about computers by myself; and myself did not told me anything about cross-compilation ! Does that mean compiling something on another computer (such a linux PC) and then putting the resulting files in the Z ? I think I have read that somewhere ? Yes, it sounds really nice and I would be glad to try that. Complex MapServer configurations take quite a lot of time to compile on a PC, so I really wonder how long it will on a Z...
But isn't cross-compilation making things more difficult (synchronise PC and Z compilators, libraries, pathes... ?). I'll read about it and try to set it up, but I think the easyest way for me for now would be to compile on the Z, am I wrong ?
So I'm gonna read the docs again and I'll be back.
tks
Blaise

Teletubbie

  • Sr. Member
  • ****
  • Posts: 252
    • View Profile
    • http://
Compilation Troubles
« Reply #3 on: March 19, 2005, 07:23:15 am »
Hi,
the whole openzaurus and opie are compiled with the crosscompiling/developement framework openembedded.
You can find it here:
http://openembedded.org/
It is fast, depending on you machine.
There is very good documentation for openembedded.
If you have a linux machine, set up openembedded, then have a look at metadata.
You can browse also metadata here:
http://openembedded.bkbits.net:8080/openem...index.html|src/.
There you will find a lot of similar packages as example and construct the metadata file (they are called bb files, because of the bb extension, that stands for bitbake) for your mapserver.
Once you have this, the frame work build all the necessary packages for crosscompiling mapserver. It gets all the sources via internet and compiles them for your target host.
Once it builds succesfully, you can submit your metadata to the openembedded source tree, so other users can build it too and make some imporovements.
You can find help at #oe on freenode irc, by the mailing list and sometimes here on these forums.
Cheers,
Sam
SL-5500G
OZ 3.3.6-pre1
Opie 1.1.4

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #4 on: March 19, 2005, 10:44:28 pm »
Tks for your suggestions about cross-compilation. Maybe I'm wrong, but I would like to compile natively on the Z. I have the feeling that if it compiles well, it is more likely to run fine than being x-compiled. But I will learn about x-compil later anyway.
I found on the "Live Cd For Developpers" thread that some people managed to compile natively, so I keep on trying... (btw, I made some customs livecd a few month ago, and find this process real cool, so I'll look for these Z development livecds.)

I followed lardman export PATH suggestion without success, I must miss something :

I dl gcc and install it, but maybe I need more than 1 gcc ipk ? :
#ipkg -d sd install /mnt/cf/dl_ipk/8_gcc/gcc_3.4.3-r4_arm.ipk
Installing gcc (...) to sd...
Configuring apache
addgroup: www-data: group already in use
postinst script returned status 1
ERROR: apache.postinst returned 1
Configuring gcc

#ipkg-link mount /mnt/card

(Apache error is ok, Apache runs fine)
This gives me the following files :
#ls /mnt/card/usr/bin
arm-linux-cpp
arm-linux-gcc
arm-linux-gccbug
arm-linux-gcov

(all are executable by everybody)


Then :
#echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:
#export PATH=$PATH/mnt/card/usr/bin
#echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/mnt/card/usr/bin

Then :
#./configure
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See 'config.log' for more details.


Do I miss other than "gcc_3.4.3-r4_arm.ipk" gcc ipk (as there is plenty of) ?
Is my path to the C compiler wrong ?
Something else ?
blaise

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Compilation Troubles
« Reply #5 on: March 20, 2005, 10:38:27 am »
Quote
#ipkg-link mount /mnt/card

(Apache error is ok, Apache runs fine)
This gives me the following files :
#ls /mnt/card/usr/bin
arm-linux-cpp
arm-linux-gcc
arm-linux-gccbug
arm-linux-gcov

You should more properly now use the symlinked files which are/should be in /usr/bin (as you've run ipkg-link).

The reason it can't find gcc, is that gcc isn't there - arm-linux-gcc is. Try creating some symlinks from /usr/bin/arm-linux-gcc -> /usr/bin/gcc etc.


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

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #6 on: March 20, 2005, 04:33:53 pm »
ok, I'm willing to learn how to properly use smlinked files...
I tryied to create symlinks :

After installing some gcc ipkg, I have the following files :
#ls /mnt/card/usr/bin
arm-linux-cpp
arm-linux-g++
arm-linux-gcc
arm-linux-gccbug
arm-linux-gcov

and links :
#ls -l /mnt/card/usr/bin
arm-linux-cpp -> /mnt/card/usr/bin/arm-linux-cpp
arm-linux-g++ -> /mnt/card/usr/bin/arm-linux-g++
arm-linux-gcc -> /mnt/card/usr/bin/arm-linux-gcc
arm-linux-gccbug -> /mnt/card/usr/bin/arm-linux-gccbug
arm-linux-gcov -> /mnt/card/usr/bin/arm-linux-gcov

I follow your symlink suggestion :
#ln -s /usr/bin/arm-linux-cpp /usr/bin/cpp
#ln -s /usr/bin/arm-linux-g++ /usr/bin/g++
#ln -s /usr/bin/arm-linux-gcc /usr/bin/gcc
#ln -s /usr/bin/arm-linux-gccbug /usr/bin/gccbug
#ln -s /usr/bin/arm-linux-gcov /usr/bin/gcov

to have :
#ls -l /mnt/card/usr/bin
arm-linux-cpp -> /mnt/card/usr/bin/arm-linux-cpp
arm-linux-g++ -> /mnt/card/usr/bin/arm-linux-g++
arm-linux-gcc -> /mnt/card/usr/bin/arm-linux-gcc
arm-linux-gccbug -> /mnt/card/usr/bin/arm-linux-gccbug
arm-linux-gcov -> /mnt/card/usr/bin/arm-linux-gcov
cpp -> /usr/bin/arm-linux-cpp
g++ -> /usr/bin/arm-linux-g++
gcc -> /usr/bin/arm-linux-gcc
gccbug -> /usr/bin/arm-linux-gccbug
gcov -> /usr/bin/arm-linux-gcov


Then try to configure again; it's going farther, but... :
cd /mnt/cf/dl_ipkg/ms/mapserver-4.4.0
./configure
checking for gcc.. gcc
ckecking for C compiler default output file name... configure: error C compiler cannot create executables
See 'config.log' for more details.

This is part of the config.log file where it seems to fail :
. . . . . . . . .
gcc driver version 3.4.3 executing gcc
version 3.4.2
configure:1671: $? = 0
configure:1673: gcc -V </dev/null>&5
gcc: '-V' option must have argument
configure:1676: $? = 1
configure:1699: checking for C compiler default output file name
configure:1702: gcc   conftest.c >&5
gcc: installation problem, cannot exec 'as':
No such file or directory
configure:1705: $? = 1
configure: failed program was:
| /* confdefs.h */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h */
|
| int
| main()
| {
|
| ;
| return 0;
| }
configure:error1743: error:C compiler cannot create executables
See 'config.log' for more details
. . . . . . . . .


I am trying to understand what more stands if the config.log file. Can it still be some missing symlinks ? a wrong file tree ? missing directories ? or bad mod settings ? What about the  confdefs.h file ? I am no C guru, but isn't it something wrong with the main function ?
Were should the C compiler try to create executables ? I think I have a wrong gcc configuration, but where ? ! ? I'm searching the forum...
blaise

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #7 on: March 20, 2005, 07:44:20 pm »
Hummm... I have to setup well gcc. Hello world doesn't even compile !

#echo 'int main(int argc, char **argv) { printf("hello, world!"); putchar(10); }' > hello.c
#gcc -o hello hello.c
gcc: installation problem, cannot exec 'as': No such file or directory

but how ? searching ...

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #8 on: March 20, 2005, 08:26:06 pm »
'seems that I was missing the binutils ipkg :

#ipkg-install -d sd install /mnt/cd/dl_ipkg/8_gcc/binutils_2.15.94.0.1-r0_arm.ipk
Installing binutils (...) to sd...
Configuring binutils

ipkg-link mount /mnt/card

#gcc -o hello hello.c
/mnt/card/usr/bin/../lib/gcc/arm-linux/3.4.3/../../../../arm-linux/ld: crt1.o: No such file or directory
collect2: ld returned 1 exit status

investigating.........

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #9 on: March 20, 2005, 10:28:27 pm »
now, it seems I'm missing libc-dev or something, ipkgfind offers libc6-dev.

#ipkg list :
libc6, but no libc6-dev

libc6-dev requires :libthread-db1, glibc-extra-nss

#ipkg-install -d sd install /mnt/cd/dl_ipkg/8_gcc/libthread-db1_2.3.2+cvs20040726-r14_arm.ipk
Installing libthread-db1 (...) to sd...
Configuring libthread-db1

#ipkg-link mount /mnt/card

#ipkg-install -d sd install /mnt/cd/dl_ipkg/8_gcc/glibc-extra-nss_2.3.2+cvs20040726-r13_arm.ipk
Installing glibc-extra-nss (...) to sd...
Configuring glibc-extra-nss

#ipkg-link mount /mnt/card

#ipkg-install -d sd install /mnt/cd/dl_ipkg/8_gcc/libc6-dev_2.3.2+cvs20040726-r14_arm.ipk
Installing libc6-dev (...) to sd...
Configuring libc6-dev

#ipkg-link mount /mnt/card

Then, try to compile again :
#gcc -o hello hello.c
/mnt/card/usr/bin/../lib/gcc/arm-linux/3.4.3/../../../../arm-linux/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status

Is this "-lgcc_s" a file or what ? ? ? What does this error means ?
keeping investigating....

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #10 on: March 20, 2005, 10:56:34 pm »
well... no good news :< I found the same problem in this thread : "How To Setup Native Onboard Development On 3.5.2, using new development section of oz feed", and tryied the :
#ln -sf /lib/libgcc_s.so.1 /mnt/card/usr/lib/libgcc_s.so
trick to try to get rid of my last error. But then compiling helloworld gives me the same error as in the other thread :
libc.so: file format not recognized; treating as linker script
libc.so:4: syntax error
collect2: ld returned 1 exit status

Last post is Feb 2 2005 and it seems not to have been solved. Something related to glibc ? ha ? keep searching... and hoping... Anybody having managed native c compilation around ? ? ?  

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #11 on: March 21, 2005, 12:17:51 am »
Might I need some libstdc++ ipkg to compile properly ?
I don't have any in the output of ipkg-list command.
IpkgFind offers :
gcc3-libstdc++4               the shared library libstdc++.so.4 from gcc3.Used to run p...
libstdc++-dev                  The GNU cc and gcc C compilers.
libstdc++2.10-dev           The GNU stdc++ library (development files)NOTE: This is n...
libstdc++2.10-glibc2.2     The GNU stdc++ libraryNOTE: This is not a final release, ...
libstdc++5                       The GNU Standard C++ Library v3This package contains an a...
libstdc++6                       The GNU cc and gcc C compilers.
Which one should I take ? how canI know which libstc++ lib does my gcc need ?
I'm going to try


Another thing :
In thread :"c Compiler Cannot Create Executable", What's up with this error?
Although it is about cross-compilation, I found this test that gives me :
#cd /mnt/card/usr/bin
#strings arm-linux-gcc | grep GLIBC
GLIBC_2.0
GLIBC_2.3
GLIBC_2.1

#find -name collect2
./mnt/card/usr/libexec/gcc/arm-linux/3.4.3/collect2
./usr/libexec/gcc/arm-linux/3.4.3/collect2
(./mnt/card/usr/libexec/gcc/arm-linux/3.4.3/collect2 is the real file, the other one is a link)

#cd /mnt/card/usr/libexec/gcc/arm-linux/3.4.3
#strings collect2 | grep GLIBC
GLIBC_2.0
GLIBC_2.1

Is this important that it doesn't match ?

keep hoping..... . . .   .

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #12 on: March 21, 2005, 02:01:45 am »
Haven't tryied to install libstdc++ yet, but was figuring out what libc.so was made of :

/usr/lib/libc.so on linux-pc :
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )


/mnt/card/usr/lib/libc.so on Zaurus :
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
***BUG in libc/scripts/output-formated.sed ***
elf32-bigarm,elf32-littlearm
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )

Any idea what this BUG is about ? I tryied to change the libc.so file, keeping only 1 line :
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
This gives, at compilation :
ERROR: /usr/lib/libc_nonshared.a(elf-init.oS) uses hardware FP, whereas 0_hello uses software FP
and a few similar error messages.

... doesn't seem to be a good idea...
Maybe an "OUTPUT_FORMAT" is needed in the libc.so file ?
Wondering if I'm not geting lost ?

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Compilation Troubles
« Reply #13 on: March 21, 2005, 05:04:30 am »
I tried the native compiler a while nack, I'd be happy if you could track down what the problem with it is as it would be a useful tool.

In the meantime, it might be worth your while to set up the BB/OE system and use that to compile your app.


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

Blaise

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://
Compilation Troubles
« Reply #14 on: March 21, 2005, 05:29:15 am »
keep trying... but still stuck with this error :
libc.so: file format not recognized; treating as linker script
libc.so:4: syntax error
collect2: ld returned 1 exit status

I'll see also the BB/OE system you talk about. I would really like to be able to compile :-)
blaise