Author Topic: Simplest way to an executable ?  (Read 6326 times)

fpp

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://
Simplest way to an executable ?
« on: June 24, 2004, 07:28:17 am »
Hi,

How hard would it be to compile a single C file to an executable that runs on the Z ?

This is a console-mode Linux app that has no user interface (sort of a combined Weblog + http server) and uses flat files for storage, no dependencies. It's quite portable as it runs on almost any Linux/unix and Windows too. It is just one C file.

What's the simplest way to try this on the Z ? is a cross-platform tool chain really necessary, or can it be done on the Z itself (a C760) ?

Thanks for any tips ; just in case it matters, below is the list of includes in the source for the Unix/Linux platforms :

#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <locale.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <dirent.h>
#include <errno.h>
#include <ctype.h>
#include <pwd.h>
#include <grp.h>

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Simplest way to an executable ?
« Reply #1 on: June 24, 2004, 08:38:29 am »
You could download a cross-toolchain but it seems to be a bit of an overkill. There are also a fair few native toolchain cramfs (compressed filesystem) files which you could mount and use.

Not sure off the top of my head but something like:

gcc -o exe_name source_name.c

should do the trick I expect.

Might actually be easier to post the source (or a link to it) and get someone with a toolchain already setup to compile it for you.


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

Stubear

  • Hero Member
  • *****
  • Posts: 1164
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #2 on: June 24, 2004, 08:59:14 am »
You can compile it on the Z if you install zgcc on the Z. Otherwise you will need to install a cross-compielr on your desktop.

The include files you listed seem like standard linux includes and should be no problem

As lardman recommend if you post the link or the file someone can compile it for you

Stu
SL-C1000, Hand converted to English with Japanese Input
Running X apps via X/Qt
iRiver USB host cable; Diatec P-Cord usb power cable (extendable); Acro's Reel Cable USB (A to A, B, Mini-B,  & Mini-B 8pin); GreenHouse 1Gb PicoDrive+; 2x256Mb Hagiwara SD cards; 128Mb Transcend CF card; 512Mb PQI CF card; AmbiCom WL1100C-CF 11B WLAN card

fpp

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #3 on: June 24, 2004, 10:22:07 am »
Quote
You can compile it on the Z if you install zgcc on the Z. Otherwise you will need to install a cross-compielr on your desktop.

The include files you listed seem like standard linux includes and should be no problem

As lardman recommend if you post the link or the file someone can compile it for you
Well, that's what I thought too, but didn't dare ask ;-)

It's actually quite a nice little app, so I don't mind giving it a little advertising here, I'm sure it could have some interesting uses on a Z. Here's the link :

http://midas.psi.ch/elog/

There are several source files but only the big one (elogd.c) is actually needed.

If I get the chance I'll still give zgcc a go, but in the meantime if anyone with the right tools can build the executable, TIA to him/her.

tumnus

  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
    • http://www.cpinkney.org.uk
Simplest way to an executable ?
« Reply #4 on: June 24, 2004, 11:51:26 am »
What about the Handhelds.org Dev Cluster?

http://www.handhelds.org/projects/devcluster.html
« Last Edit: June 24, 2004, 11:51:44 am by tumnus »
# Search the Zaurus Howtos ## Search the Zaurus FAQs ## Find Z software at ELSI #
--------------------
UK SL5500 with Sharp ROM 3.13, SL5600 with Sharp ROM 1.32 - SuSE 9.0 Pro, Windows XP Home
Qualendar for Calendar and Todo
Socket Bluetooth CF Card (Rev F), Kingmax 512MB MMC Card, Palm Tungsten T Stylus,
Pretec CF->Smartmedia Adapter, Semsons Universal Battery Extender

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Simplest way to an executable ?
« Reply #5 on: June 24, 2004, 11:55:27 am »
Quote
What about the Handhelds.org Dev Cluster?

Last time I looked they were using libc 2.3 which means it'll work on my Z, but not the Sharp/pdaXrom ROMs.


Si

P.S. I'll try to compile the code later on when I've got some time.
« Last Edit: June 24, 2004, 11:55:51 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

fpp

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #6 on: June 24, 2004, 12:29:48 pm »
Quote
What about the Handhelds.org Dev Cluster?

http://www.handhelds.org/projects/devcluster.html
Wasn't aware of its existence, actually. Fun stuff though ! ;-)

I wonder if binaries compiled there would run on a C760 with maslovsky's Cacko ROM 1.21 ?...

fpp

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #7 on: June 24, 2004, 12:31:01 pm »
Quote
Quote
What about the Handhelds.org Dev Cluster?

Last time I looked they were using libc 2.3 which means it'll work on my Z, but not the Sharp/pdaXrom ROMs.

P.S. I'll try to compile the code later on when I've got some time.
Thanks a lot !

Stubear

  • Hero Member
  • *****
  • Posts: 1164
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #8 on: June 24, 2004, 12:32:59 pm »
Okay, I've downloaded and compiled the source - actually compiled all the app (not sure what elconv does yet)

It looks like a pretty usefull little app. I tried to attach it here, but looks like we can't attach files to the new forum.

If you PM me your email address, I'll email it to you - the tarball with demo logbook and default theme is only 250K.

I'll also see if I can get web access to load it up so others can download it.

NOTE: Compiled with gcc-2.95.2 and tested on stock standard C760. So should work on any qtopia based Z (and maybe pdaX as well)

Stu
SL-C1000, Hand converted to English with Japanese Input
Running X apps via X/Qt
iRiver USB host cable; Diatec P-Cord usb power cable (extendable); Acro's Reel Cable USB (A to A, B, Mini-B,  & Mini-B 8pin); GreenHouse 1Gb PicoDrive+; 2x256Mb Hagiwara SD cards; 128Mb Transcend CF card; 512Mb PQI CF card; AmbiCom WL1100C-CF 11B WLAN card

fpp

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #9 on: June 24, 2004, 01:07:55 pm »
Quote
Okay, I've downloaded and compiled the source - actually compiled all the app (not sure what elconv does yet)

It looks like a pretty usefull little app. I tried to attach it here, but looks like we can't attach files to the new forum.

If you PM me your email address, I'll email it to you - the tarball with demo logbook and default theme is only 250K.

I'll also see if I can get web access to load it up so others can download it.

NOTE: Compiled with gcc-2.95.2 and tested on stock standard C760. So should work on any qtopia based Z (and maybe pdaX as well)
Great, thanks a lot ! I've sent you the address.

elconv is pretty much legacy : at some point the storage format changed, and it's there in case some people still have very old version of Elog around, to convert their data to the new format.

if/when I succeed in compiling elogd myself, I was thinking of making it available on a web page of mine, or perhaps even maintaining a downsized ipk of sorts if it's not too much trouble.

Thanks for your help anyway, looking forward to try that out on my Z...

fpp

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • http://
Simplest way to an executable ?
« Reply #10 on: June 24, 2004, 06:01:27 pm »
Quote
Quote
What about the Handhelds.org Dev Cluster?

http://www.handhelds.org/projects/devcluster.html
I wonder if binaries compiled there would run on a C760 with maslovsky's Cacko ROM 1.21 ?...
Answering myself : yes, it seems they do !

It was a little awkward because the cluster does not work 100% as described on that page (could not get scp to connect). So once I was logged in a guest directory, I got the Elog tarball through wget, uncompressed it and ran make. Then I uploaded the elogd binary to my website, and from there to the Z.

I haven't tested it extensively, but it runs and displays the demo logbook, so I guess it's OK (right gcc/glibc/whatever). Thanks to Tumnus for pointing out this really useful resource !

Stubear sent me the binaries he built on his own Z ; they're not exactly the same size but they work just fine too.

Thanks to all of you, I now have Elog in my pocket... now let's find some interesting uses for it :-)